Skip to main content
Glama
mrgoonie

SearchAPI MCP Server

search_google_images

Search Google Images through the SearchAPI MCP Server to find relevant pictures with titles, thumbnails, and source links using a query.

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
queryYesThe image 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

  • The main handler function for the 'search_google_images' MCP tool. It processes input arguments, calls the searchApiController.googleImageSearch, and returns formatted content or error for the MCP protocol.
    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, used in the MCP tool registration.
    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)'),
    });
  • MCP server registration of the 'search_google_images' tool, specifying name, description, input schema, and handler function.
    	// Register Google image search tool
    	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,
    	);
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the API key requirement (authentication need) and describes the return format ('formatted image search results including titles, thumbnails, and source links'), which adds value beyond the input schema. However, it doesn't mention rate limits, error conditions, or other behavioral traits like whether results are cached or real-time.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized with three concise sentences that each add value: what it does, what it requires, and what it returns. It's front-loaded with the core purpose. There's minimal waste, though it could be slightly more structured with bullet points for the three key pieces of information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 6 parameters, 100% schema coverage, but no annotations and no output schema, the description provides adequate but incomplete context. It covers the purpose, authentication requirement, and return format, but doesn't address error handling, rate limits, or provide examples. The absence of an output schema means the description's mention of return format is helpful but could be more detailed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 6 parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema - it mentions 'search query' and 'API key' but doesn't explain parameter interactions, defaults, or usage examples. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool 'performs a Google image search using SearchAPI.site' which is a specific verb+resource combination. It distinguishes itself from sibling tools like 'search_google' and 'search_youtube' by specifying it's for images, though it doesn't explicitly contrast with them in the description text itself.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description mentions the requirement for a SearchAPI.site API key, which provides some usage context. However, it offers no guidance on when to use this tool versus the sibling tools (search_google, search_youtube) or any alternatives. There's no explicit 'when' or 'when not' guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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