Skip to main content
Glama

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
NameRequiredDescriptionDefault
qYesImage 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 }))
    );
  • 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 }))
  • Input schema definition for 'images' tool using Zod - validates that 'q' parameter is a string
    { q: z.string().describe("Image search query") },
  • 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);
      }
    }
  • 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) }] };
    }

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/CSteenkamp/searchclaw-mcp'

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