Skip to main content
Glama
wlmwwx

Jina AI Remote MCP Server

by wlmwwx

search_images

Find visual content across the web using descriptive search terms. Locate photos, illustrations, diagrams, charts, logos, or other images to illustrate concepts or discover visual resources.

Instructions

Search for images across the web, similar to Google Images. Use this when you need to find photos, illustrations, diagrams, charts, logos, or any visual content. Perfect for finding images to illustrate concepts, locating specific pictures, or discovering visual resources. Images are returned by default as small base64-encoded JPEG images.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesImage search terms describing what you want to find (e.g., 'sunset over mountains', 'vintage car illustration', 'data visualization chart')
return_urlNoSet to true to return image URLs, title, shapes, and other metadata. By default, images are downloaded as base64 and returned as rendered images.
tbsNoTime-based search parameter, e.g., 'qdr:h' for past hour, can be qdr:h, qdr:d, qdr:w, qdr:m, qdr:y
locationNoLocation for search results, e.g., 'London', 'New York', 'Tokyo'
glNoCountry code, e.g., 'dz' for Algeria
hlNoLanguage code, e.g., 'zh-cn' for Simplified Chinese

Implementation Reference

  • Primary MCP tool handler for 'search_images'. Handles input validation (via schema), token check, executes core search, optionally downloads/resizes images from results, and formats MCP content blocks with images or metadata.
    async ({ query, return_url, tbs, location, gl, hl }: SearchImageArgs) => {
    	try {
    		const props = getProps();
    
    		const tokenError = checkBearerToken(props.bearerToken);
    		if (tokenError) {
    			return tokenError;
    		}
    
    		const searchResult = await executeImageSearch({ query, return_url, tbs, location, gl, hl }, props.bearerToken);
    
    		if ('error' in searchResult) {
    			return createErrorResponse(searchResult.error);
    		}
    
    		const data = { results: searchResult.results };
    
    		// Prepare response content - always return as list structure for consistency
    		const contentItems: Array<{ type: 'text'; text: string } | { type: 'image'; data: string; mimeType: string }> = [];
    
    		if (return_url) {
    			// Return each result as individual text items
    			if (data.results && Array.isArray(data.results)) {
    				for (const result of data.results) {
    					contentItems.push({
    						type: "text" as const,
    						text: yamlStringify(result),
    					});
    				}
    			}
    		} else {
    			// Extract image URLs from search results
    			const imageUrls: string[] = [];
    			if (data.results && Array.isArray(data.results)) {
    				for (const result of data.results) {
    					if (result.imageUrl) {
    						imageUrls.push(result.imageUrl);
    					}
    				}
    			}
    
    			if (imageUrls.length === 0) {
    				throw new Error("No image URLs found in search results");
    			}
    
    			// Download and process images (resize to max 800px, convert to JPEG)
    			// 15 second timeout - returns partial results if timeout occurs
    			const downloadResults = await downloadImages(imageUrls, 3, 15000);
    
    			// Add successful downloads as images
    			for (const result of downloadResults) {
    				if (result.success && result.data) {
    					contentItems.push({
    						type: "image" as const,
    						data: result.data,
    						mimeType: result.mimeType,
    					});
    				}
    			}
    
    
    		}
    
    		return {
    			content: contentItems,
    		};
    	} catch (error) {
    		return createErrorResponse(`Error: ${error instanceof Error ? error.message : String(error)}`);
    	}
  • Zod input schema for search_images tool, defining parameters like query, return_url, time/location filters.
    {
    	query: z.string().describe("Image search terms describing what you want to find (e.g., 'sunset over mountains', 'vintage car illustration', 'data visualization chart')"),
    	return_url: z.boolean().default(false).describe("Set to true to return image URLs, title, shapes, and other metadata. By default, images are downloaded as base64 and returned as rendered images."),
    	tbs: z.string().optional().describe("Time-based search parameter, e.g., 'qdr:h' for past hour, can be qdr:h, qdr:d, qdr:w, qdr:m, qdr:y"),
    	location: z.string().optional().describe("Location for search results, e.g., 'London', 'New York', 'Tokyo'"),
    	gl: z.string().optional().describe("Country code, e.g., 'dz' for Algeria"),
    	hl: z.string().optional().describe("Language code, e.g., 'zh-cn' for Simplified Chinese")
    },
  • MCP server registration of the 'search_images' tool via server.tool(), including name, description, schema reference, and handler function.
    // Search Images tool - search for images on the web using Jina Search API
    server.tool(
    	"search_images",
    	"Search for images across the web, similar to Google Images. Use this when you need to find photos, illustrations, diagrams, charts, logos, or any visual content. Perfect for finding images to illustrate concepts, locating specific pictures, or discovering visual resources. Images are returned by default as small base64-encoded JPEG images.",
  • Core helper function executing the Jina AI image search API call, handling request params, error cases, and returning raw search results.
    export async function executeImageSearch(
        searchArgs: SearchImageArgs,
        bearerToken: string
    ): Promise<SearchResultOrError> {
        try {
            const response = await fetch('https://svip.jina.ai/', {
                method: 'POST',
                headers: {
                    'Accept': 'application/json',
                    'Content-Type': 'application/json',
                    'Authorization': `Bearer ${bearerToken}`,
                },
                body: JSON.stringify({
                    q: searchArgs.query,
                    type: 'images',
                    ...(searchArgs.tbs && { tbs: searchArgs.tbs }),
                    ...(searchArgs.location && { location: searchArgs.location }),
                    ...(searchArgs.gl && { gl: searchArgs.gl }),
                    ...(searchArgs.hl && { hl: searchArgs.hl })
                }),
            });
    
            if (!response.ok) {
                return { error: `Image search failed for query "${searchArgs.query}": ${response.statusText}` };
            }
    
            const data = await response.json() as any;
            return { query: searchArgs.query, results: data.results || [] };
        } catch (error) {
            return { error: `Image search failed for query "${searchArgs.query}": ${error instanceof Error ? error.message : String(error)}` };
        }
    }
  • TypeScript interface defining input arguments for image search, used by handler and helpers.
    export interface SearchImageArgs {
        query: string;
        return_url?: boolean;
        tbs?: string;
        location?: string;
        gl?: string;
        hl?: string;
    }
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by disclosing key behavioral traits: it specifies the default return format ('small base64-encoded JPEG images') and the alternative behavior when return_url is true ('return image URLs, title, shapes, and other metadata'). It doesn't mention rate limits, authentication needs, or potential costs, but provides substantial operational context.

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 sentences that each serve distinct purposes: stating the core function, providing usage context, and describing output behavior. It's front-loaded with the most important information. While efficient, the third sentence could be slightly more concise by integrating the return_url behavior more directly.

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

Completeness4/5

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

Given the tool's moderate complexity (6 parameters, 1 required), no annotations, and no output schema, the description does well to cover the essential context: purpose, usage scenarios, and output format behavior. It doesn't explain error conditions, rate limits, or authentication requirements, but provides enough information for basic effective use of this search tool.

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?

The schema description coverage is 100%, so the baseline is 3. The description adds minimal parameter semantics beyond the schema - it mentions the default base64 encoding and that return_url changes the output format, but doesn't elaborate on other parameters like tbs, location, gl, or hl. The schema already documents these thoroughly, so the description adds limited extra value.

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

Purpose5/5

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

The description explicitly states the tool's purpose as 'Search for images across the web, similar to Google Images' with specific examples of what can be found (photos, illustrations, diagrams, charts, logos). It clearly distinguishes from sibling tools like search_web or search_arxiv by focusing exclusively on visual content, making the purpose highly specific and differentiated.

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool: 'when you need to find photos, illustrations, diagrams, charts, logos, or any visual content' and gives examples like 'illustrate concepts, locating specific pictures, or discovering visual resources.' However, it doesn't explicitly state when NOT to use it or name specific alternatives among siblings, which prevents a perfect score.

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/wlmwwx/jina-mcp'

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