search_images
Find photos, illustrations, diagrams, or charts by entering search terms. Returns images as base64-encoded JPEGs or URLs with metadata. Ideal for locating visual content to enhance projects or discover 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
| Name | Required | Description | Default |
|---|---|---|---|
| gl | No | Country code, e.g., 'dz' for Algeria | |
| hl | No | Language code, e.g., 'zh-cn' for Simplified Chinese | |
| location | No | Location for search results, e.g., 'London', 'New York', 'Tokyo' | |
| query | Yes | Image search terms describing what you want to find (e.g., 'sunset over mountains', 'vintage car illustration', 'data visualization chart') | |
| return_url | No | Set to true to return image URLs, title, shapes, and other metadata. By default, images are downloaded as base64 and returned as renderd images. | |
| tbs | No | Time-based search parameter, e.g., 'qdr:h' for past hour, can be qdr:h, qdr:d, qdr:w, qdr:m, qdr:y |
Implementation Reference
- src/tools/jina-tools.ts:400-447 (handler)The handler function that implements the core logic of the 'search_image' tool. It authenticates with the Jina API using a bearer token, sends a POST request to the image search endpoint with the query, handles errors, and returns the search results as YAML-formatted text.async ({ query }: { query: string }) => { try { const props = getProps(); const tokenError = checkBearerToken(props.bearerToken); if (tokenError) { return tokenError; } const response = await fetch('https://svip.jina.ai/', { method: 'POST', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', 'Authorization': `Bearer ${props.bearerToken}`, }, body: JSON.stringify({ q: query, type: 'images', }), }); if (!response.ok) { return handleApiError(response, "Image search"); } const data = await response.json() as any; return { content: [ { type: "text" as const, text: yamlStringify(data.results), }, ], }; } catch (error) { return { content: [ { type: "text" as const, text: `Error: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } },
- src/tools/jina-tools.ts:397-399 (schema)Zod schema defining the input parameter 'query' for the search_image tool.{ query: z.string().describe("Image search terms describing what you want to find (e.g., 'sunset over mountains', 'vintage car illustration', 'data visualization chart')") },
- src/tools/jina-tools.ts:394-396 (registration)Registration of the 'search_image' tool on the MCP server, specifying the tool name and description.server.tool( "search_image", "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. Returns image search results with URLs, titles, descriptions, and image metadata.",
- src/index.ts:20-22 (registration)Invocation of registerJinaTools function which registers the search_image tool among others on the MCP server.// Register all Jina AI tools registerJinaTools(this.server, () => this.props); }