Skip to main content
Glama

search_google

Perform Google searches to find web information, returning results with titles, snippets, and links for research or data gathering.

Instructions

Performs a Google search using SearchAPI.site. Requires a search "query" string, can be able to search multiple keywords that separated by commas. Returns formatted search results including titles, snippets, and links.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesThe search query to perform
limitNoMaximum number of results to return (1-100)
offsetNoOffset for pagination
sortNoSort order (e.g., "date:d" for newest first)
from_dateNoStart date for filtering results (format: YYYY-MM-DD)
to_dateNoEnd date for filtering results (format: YYYY-MM-DD)

Implementation Reference

  • MCP handler function that executes the search_google tool logic by calling the controller and formatting the response.
    async function handleGoogleSearch(args: GoogleSearchToolArgsType) { const methodLogger = Logger.forContext( 'tools/searchapi.tool.ts', 'handleGoogleSearch', ); methodLogger.debug(`Performing Google search for query: ${args.query}`); try { // Map tool arguments to controller options const controllerOptions = { query: args.query, }; // Call the controller with the mapped options const result = await searchApiController.googleSearch(controllerOptions); methodLogger.debug(`Got the response from the controller`, result); // Format the response for the MCP tool return { content: [ { type: 'text' as const, text: result.content, }, ], }; } catch (error) { methodLogger.error( `Error performing Google search for query: ${args.query}`, error, ); return formatErrorForMcpTool(error); } }
  • Registers the search_google tool with the MCP server, associating name, description, input schema, and handler function.
    server.tool( 'search_google', `Performs a Google search using SearchAPI.site. Requires a search "query" string, can be able to search multiple keywords that separated by commas. Returns formatted search results including titles, snippets, and links. `, GoogleSearchToolArgs.shape, handleGoogleSearch, );
  • Zod schema defining the input arguments for the search_google tool, including query and optional parameters like limit, offset, etc.
    export const GoogleSearchToolArgs = z.object({ query: z.string().describe('The search query to perform'), // apiKey: z.string().optional().describe('Your SearchAPI.site API key'), limit: z .number() .min(1) .max(100) .optional() .describe('Maximum number of results to return (1-100)'), offset: z.number().min(0).optional().describe('Offset for pagination'), sort: z .string() .optional() .describe('Sort order (e.g., "date:d" for newest first)'), from_date: z .string() .optional() .describe('Start date for filtering results (format: YYYY-MM-DD)'), to_date: z .string() .optional() .describe('End date for filtering results (format: YYYY-MM-DD)'), });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mrgoonie/searchapi-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server