google-search

Custom n8n node for performing Google searches with AI agent tool support

Package Information

Downloads: 1 weekly / 12 monthly
Latest Version: 1.5.0

Documentation

n8n-nodes-google-search

Custom n8n node for performing Google searches via the Google Custom Search API.

Features

  • Custom Google search
  • Support for multiple search parameters
  • Filtering by language, country, file type
  • Site-specific search
  • Configurable SafeSearch
  • AI Agent Tool Support: Can be used as a tool by AI agents in n8n

Installation

Prerequisites

  1. Google API Key: Get an API key from the Google Cloud Console

    • Enable the "Custom Search API"
    • Create an API key
  2. Search Engine ID (CX): Create a custom search engine from the Custom Search control panel

    • Configure your search engine
    • Get the engine ID (CX)

Node Installation

npm install @cryptodevops/n8n-nodes-google-search

Or for development:

  1. Clone this repository
  2. Install dependencies: npm install
  3. Build the project: npm run build
  4. Install the node in n8n: npm link

Configuration

  1. In n8n, add the "Google Search API" credentials
  2. Enter your API Key and Search Engine ID (CX)
  3. Use the "Google Search" node in your workflows

AI Agent Tool Usage

This node can be used as a tool by AI agents in n8n workflows. When used as a tool, the AI agent can automatically call this node to perform Google searches.

Setup for AI Agents

  1. Enable Community Tool Usage: Set the environment variable N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true in your n8n installation
  2. Configure Credentials: Set up your Google Search API credentials as described above
  3. Add to Agent: The node will automatically appear as an available tool for AI agents

Tool Parameters for AI Agents

When used by AI agents, the node accepts these parameters:

  • query (required): The search query
  • num_results (optional): Number of results (1-10, default: 5)
  • language (optional): Language code (e.g., "en", "fr", "de")
  • country (optional): Country code (e.g., "us", "fr", "de")

Example AI Agent Usage

The AI agent can call this tool like:

{
  "query": "latest AI developments 2024",
  "num_results": 5,
  "language": "en"
}

The tool will return structured search results that the AI agent can use to answer questions or gather information.

Available Parameters

Main Parameters

  • Query: Search term (required)

Additional Parameters

  • Number of Results: Number of results (1-10)
  • Start Index: Starting index for pagination
  • Language: Language of results
  • Country: Country code for geolocation
  • Safe Search: SafeSearch filtering level
  • File Type: File type restriction
  • Site Search: Search within a specific site

Output Format

Each result contains:

  • title: Page title
  • link: Page URL
  • text: Page excerpt (renamed from snippet)
  • image: Main image URL (extracted from pagemap)
  • thumbnail: Thumbnail image URL (extracted from pagemap)

License

MIT

Discussion