Skip to main content
Glama

search_google_images

Perform a Google image search with a query, API key, and optional filters like date range or sort order. Retrieve results with titles, thumbnails, and source links for precise image discovery.

Instructions

Performs a Google image search using SearchAPI.site. Requires a search query and your SearchAPI.site API key. Returns formatted image search results including titles, thumbnails, and source links.

Input Schema

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

Implementation Reference

  • MCP tool handler that delegates to the search API controller and formats the response.
    async function handleGoogleImageSearch(args: GoogleImageSearchToolArgsType) { const methodLogger = Logger.forContext( 'tools/searchapi.tool.ts', 'handleGoogleImageSearch', ); methodLogger.debug( `Performing Google image 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.googleImageSearch(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 image search for query: ${args.query}`, error, ); return formatErrorForMcpTool(error); }
  • Zod schema defining the input arguments for the search_google_images tool.
    export const GoogleImageSearchToolArgs = z.object({ query: z.string().describe('The image 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)'), }); /** * Type for Google image search tool arguments */ export type GoogleImageSearchToolArgsType = z.infer< typeof GoogleImageSearchToolArgs >;
  • Registration of the search_google_images tool with the MCP server, linking schema and handler.
    server.tool( 'search_google_images', `Performs a Google image search using SearchAPI.site. Requires a search query and your SearchAPI.site API key. Returns formatted image search results including titles, thumbnails, and source links. `, GoogleImageSearchToolArgs.shape, handleGoogleImageSearch, );

Other Tools

Related Tools

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