Skip to main content
Glama

search

Perform web searches to find relevant information using SearchClaw's API. This tool retrieves organic search results for any query to support research and data gathering tasks.

Instructions

Search the web using SearchClaw. Returns organic web results. Costs 1 credit.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
qYesSearch query

Implementation Reference

  • The 'search' tool handler that takes a query parameter 'q' and returns organic web search results from the SearchClaw API via GET request to /search endpoint
    server.tool(
      "search",
      "Search the web using SearchClaw. Returns organic web results. Costs 1 credit.",
      { q: z.string().describe("Search query") },
      async ({ q }) => jsonResult(await apiGet("/search", { q }))
    );
  • Input schema for the 'search' tool - accepts a single string parameter 'q' representing the search query
    { q: z.string().describe("Search query") },
  • src/index.ts:72-77 (registration)
    Registration of the 'search' tool with the MCP server using server.tool() method
    server.tool(
      "search",
      "Search the web using SearchClaw. Returns organic web results. Costs 1 credit.",
      { q: z.string().describe("Search query") },
      async ({ q }) => jsonResult(await apiGet("/search", { q }))
    );
  • Helper function for making GET requests to the SearchClaw API with query parameters, timeout handling, and error management
    async function apiGet(path: string, params?: Record<string, string>) {
      const url = new URL(`${API_BASE}${path}`);
      if (params) {
        for (const [key, value] of Object.entries(params)) {
          url.searchParams.set(key, value);
        }
      }
      const controller = new AbortController();
      const timeout = setTimeout(() => controller.abort(), 30000);
      try {
        const response = await fetch(url.toString(), { headers, 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 to format API response data as MCP tool result with JSON formatting
    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