search_images
Find web images for concepts, illustrations, or specific pictures using search terms. Returns images as base64-encoded JPEGs by default or provides URLs and metadata when specified.
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 |
|---|---|---|---|
| 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 rendered 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 | |
| location | No | Location for search results, e.g., 'London', 'New York', 'Tokyo' | |
| gl | No | Country code, e.g., 'dz' for Algeria | |
| hl | No | Language code, e.g., 'zh-cn' for Simplified Chinese |
Implementation Reference
- src/tools/jina-tools.ts:401-448 (handler)Handler for the 'search_image' tool (note: queried tool is 'search_images' but implementation is 'search_image'). Performs API call to Jina image search endpoint with query, handles authentication and errors, returns YAML serialized results.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:398-400 (schema)Input schema for search_image tool using Zod: requires a 'query' string parameter.query: z.string().describe("Image search terms describing what you want to find (e.g., 'sunset over mountains', 'vintage car illustration', 'data visualization chart')") }, async ({ query }: { query: string }) => {
- src/tools/jina-tools.ts:395-449 (registration)Registration of the search_image tool within registerJinaTools function."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.", { query: z.string().describe("Image search terms describing what you want to find (e.g., 'sunset over mountains', 'vintage car illustration', 'data visualization chart')") }, 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/index.ts:21-22 (registration)Top-level registration call in MyMCP.init() that registers all Jina tools including search_image.registerJinaTools(this.server, () => this.props); }