Skip to main content
Glama
ac3xx

Kagi MCP server

by ac3xx

kagi_search

Execute web searches via Kagi’s API, enabling precise results retrieval using query parameters and customizable limits for efficient data access.

Instructions

Perform web search using Kagi

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
queryYes

Implementation Reference

  • The MCP tool handler for 'kagi_search' that validates arguments (query string required, limit 1-100 optional), constructs SearchParams, calls KagiAPI.search, and returns results or handles KagiError.
        if (request.params.name === "kagi_search") {
          if (!request.params.arguments || typeof request.params.arguments !== 'object') {
            throw new McpError(ErrorCode.InvalidParams, "Invalid arguments for kagi_search");
      }
    
          const { query, limit } = request.params.arguments as { query?: unknown; limit?: unknown };
    
          if (typeof query !== 'string') {
            throw new McpError(ErrorCode.InvalidParams, "Query must be a string");
          }
    
          const searchParams: SearchParams = {
            q: query,
          };
    
          if (limit !== undefined) {
            if (typeof limit !== 'number' || limit < 1 || limit > 100) {
              throw new McpError(ErrorCode.InvalidParams, "Limit must be a number between 1 and 100");
            }
            searchParams.limit = limit;
          }
    
      try {
            const results = await this.kagiApi.search(searchParams);
        return { toolResult: results };
      } catch (error) {
        if (error instanceof KagiError) {
              return {
                content: [{ type: "text", text: `Kagi API error: ${error.message}` }],
                isError: true,
              };
        }
        throw error;
      }
    }
  • Tool metadata and input schema definition for 'kagi_search', used in tool listing and validation.
    const searchTool = {
      name: "kagi_search",
      description: "Perform web search using Kagi",
      inputSchema: {
        type: "object",
        properties: {
          query: { type: "string" },
          limit: { 
            type: "number",
            default: 10,
            minimum: 1,
            maximum: 100
    }
        },
        required: ["query"]
      }
    };
  • src/index.ts:79-83 (registration)
    Registers the 'kagi_search' tool by returning it in the MCP ListToolsRequest handler.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [searchTool]
      };
    });
  • Core implementation of the search functionality in KagiAPI, making HTTP GET to Kagi's /search endpoint with query and limit parameters.
    async search(params: SearchParams): Promise<SearchResponse> {
        const response = await this.client.get<SearchResponse>('/search', {
            params: {
                q: params.q,
                limit: params.limit || 10
            }
        });
        return response.data;
    }
  • TypeScript interface defining the SearchParams used by the kagi_search tool and API.
    export interface SearchParams {
        /** Search query string */
        q: string;
        /** Maximum number of results to return */
        limit?: number;
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions 'Perform web search' which implies read-only behavior, but doesn't disclose any behavioral traits like rate limits, authentication needs, response format, or potential side effects. This leaves significant gaps for a tool with external dependencies.

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 extremely concise—a single sentence with zero waste. It's front-loaded with the core purpose and efficiently communicates the essential function without unnecessary details.

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

Completeness2/5

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

Given no annotations, no output schema, and low schema description coverage, the description is incomplete. It doesn't address behavioral aspects, parameter usage, or result expectations, making it inadequate for a tool that interacts with an external web search service.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate. It adds no meaning beyond the schema—doesn't explain what 'query' should contain, how 'limit' affects results, or any parameter nuances. The schema defines types and constraints, but the description offers no semantic context.

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

Purpose4/5

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

The description clearly states the action ('Perform web search') and the resource/service ('using Kagi'), which is specific and unambiguous. However, with no sibling tools mentioned, it cannot demonstrate differentiation from alternatives, so it doesn't reach the highest score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives, prerequisites, or any contextual limitations. It simply states what the tool does without offering usage instructions.

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

Related 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/ac3xx/mcp-servers-kagi'

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