Skip to main content
Glama

search_ai

Perform web searches to retrieve structured, source-cited data optimized for AI agents and RAG applications.

Instructions

RAG-ready web search with context and sources. Primary tool for AI agents — returns structured context optimized for LLM consumption. Costs 2 credits.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
qYesSearch query

Implementation Reference

  • src/index.ts:79-84 (registration)
    Registration of the 'search_ai' tool using server.tool() with name, description, schema, and handler
    server.tool(
      "search_ai",
      "RAG-ready web search with context and sources. Primary tool for AI agents — returns structured context optimized for LLM consumption. Costs 2 credits.",
      { q: z.string().describe("Search query") },
      async ({ q }) => jsonResult(await apiGet("/search/ai", { q }))
    );
  • Input schema definition for 'search_ai' tool: requires a 'q' string parameter for the search query
    { q: z.string().describe("Search query") },
  • Handler function for 'search_ai' tool: calls apiGet('/search/ai', { q }) and wraps result with jsonResult
    async ({ q }) => jsonResult(await apiGet("/search/ai", { q }))
  • apiGet helper function that makes HTTP GET requests to the SearchClaw API with timeout and error handling
    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);
      }
    }
  • jsonResult helper function that formats API responses as MCP content with JSON text
    function jsonResult(data: unknown) {
      return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively adds context beyond the input schema by stating the tool 'returns structured context optimized for LLM consumption' and disclosing a cost ('Costs 2 credits'), which are critical behavioral traits not inferable from the schema alone. However, it doesn't cover other potential behaviors like rate limits, error handling, or authentication needs.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is highly concise and front-loaded, with every sentence earning its place. The first sentence establishes the core functionality, the second positions it as the primary tool, and the third adds critical cost information—all without wasted words, making it efficient and easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (a search tool with cost implications) and the lack of annotations and output schema, the description does a good job of covering key aspects like purpose, optimization for AI, and cost. However, it doesn't explain the return values or structure in detail, which would be helpful since there's no output schema, leaving some gaps in completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with the single parameter 'q' fully documented in the schema as 'Search query'. The description doesn't add any meaning beyond this, such as query formatting tips or examples. Since the schema does the heavy lifting, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('RAG-ready web search') and resources ('with context and sources'), distinguishing it from generic search tools. It explicitly positions itself as the 'Primary tool for AI agents' and specifies the output format ('structured context optimized for LLM consumption'), making its role distinct from sibling tools like 'search' or 'browse'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use this tool ('Primary tool for AI agents' and 'RAG-ready web search'), implying it's optimized for AI workflows rather than general browsing. However, it doesn't explicitly state when not to use it or name specific alternatives among the sibling tools, such as when to choose 'search' instead.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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