images
Search for images using web queries to find URLs and metadata for visual content discovery.
Instructions
Search for images using SearchClaw. Returns image URLs and metadata. Costs 1 credit.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| q | Yes | Image search query |
Implementation Reference
- src/index.ts:93-98 (registration)Registration of the 'images' tool using server.tool() with name, description, input schema, and handler function
server.tool( "images", "Search for images using SearchClaw. Returns image URLs and metadata. Costs 1 credit.", { q: z.string().describe("Image search query") }, async ({ q }) => jsonResult(await apiPost("/search/images", { q })) ); - src/index.ts:97-97 (handler)Handler function for 'images' tool - takes query parameter 'q' and calls SearchClaw API POST /search/images endpoint
async ({ q }) => jsonResult(await apiPost("/search/images", { q })) - src/index.ts:96-96 (schema)Input schema definition for 'images' tool using Zod - validates that 'q' parameter is a string
{ q: z.string().describe("Image search query") }, - src/index.ts:41-59 (helper)Helper function that performs POST requests to the SearchClaw API with timeout handling and error management
async function apiPost(path: string, body: Record<string, unknown>) { const controller = new AbortController(); const timeout = setTimeout(() => controller.abort(), 30000); try { const response = await fetch(`${API_BASE}${path}`, { method: "POST", headers: { ...headers, "Content-Type": "application/json" }, body: JSON.stringify(body), signal: controller.signal, }); if (!response.ok) { const text = await response.text(); throw new Error(`SearchClaw API error ${response.status}: ${text}`); } return response.json(); } finally { clearTimeout(timeout); } } - src/index.ts:61-63 (helper)Helper function that formats API response data into MCP tool result format with JSON stringification
function jsonResult(data: unknown) { return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; }