Skip to main content
Glama
yuki-yano

Kagi MCP

by yuki-yano

kagi_summarizer

Generate concise summaries or bullet-point takeaways from any document, video, or audio by providing a URL. Supports multiple languages and integrates with Kagi's API for efficient content extraction.

Instructions

Summarize content from a URL using the Kagi Summarizer API. The Summarizer can summarize any document type (text webpage, video, audio, etc.)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
summary_typeNoType of summary to produce. Options are 'summary' for paragraph prose and 'takeaway' for a bulleted list of key points.summary
target_languageNoDesired output language using language codes (e.g., 'EN' for English). If not specified, the document's original language influences the output.
urlYesA URL to a document to summarize.

Implementation Reference

  • Handler for the 'kagi_summarizer' tool. Validates parameters, determines the summarization engine, calls the KagiClient's summarize method, and formats the response.
    if (name === 'kagi_summarizer') {
      const url = args?.url as string | undefined;
      
      if (!url) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Summarizer called with no URL.'
        );
      }
      
      const summaryType = args?.summary_type as 'summary' | 'takeaway' | undefined;
      const targetLanguage = args?.target_language as string | undefined;
      
      const engine = process.env.KAGI_SUMMARIZER_ENGINE || 'cecil';
      const validEngines = ['cecil', 'agnes', 'daphne', 'muriel'];
      
      if (!validEngines.includes(engine)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          `Summarizer configured incorrectly, invalid summarization engine set: ${engine}. Must be one of the following: ${validEngines.join(', ')}`
        );
      }
      
      try {
        const summary = await kagiClient.summarize({
          url,
          engine: engine as 'cecil' | 'agnes' | 'daphne' | 'muriel',
          summary_type: summaryType,
          target_language: targetLanguage,
        });
        
        return {
          content: [
            {
              type: 'text',
              text: summary.data.output,
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error: ${error instanceof Error ? error.message : String(error)}`,
            },
          ],
        };
      }
    }
  • Tool schema definition including name, description, and input schema for the kagi_summarizer tool.
    const SUMMARIZER_TOOL: Tool = {
      name: 'kagi_summarizer',
      description: 'Summarize content from a URL using the Kagi Summarizer API. The Summarizer can summarize any document type (text webpage, video, audio, etc.)',
      inputSchema: {
        type: 'object',
        properties: {
          url: {
            type: 'string',
            description: 'A URL to a document to summarize.',
          },
          summary_type: {
            type: 'string',
            enum: ['summary', 'takeaway'],
            default: 'summary',
            description: 'Type of summary to produce. Options are \'summary\' for paragraph prose and \'takeaway\' for a bulleted list of key points.',
          },
          target_language: {
            type: 'string',
            description: 'Desired output language using language codes (e.g., \'EN\' for English). If not specified, the document\'s original language influences the output.',
          },
        },
        required: ['url'],
      },
    };
  • src/index.ts:69-73 (registration)
    Registration of the kagi_summarizer tool by including it in the list returned by ListToolsRequestSchema handler.
    server.setRequestHandler(ListToolsRequestSchema, async (): Promise<ListToolsResult> => {
      return {
        tools: [SEARCH_TOOL, SUMMARIZER_TOOL],
      };
    });
  • The KagiClient.summarize method that makes the API call to Kagi's /summarize endpoint and handles the response and errors.
    async summarize(options: SummarizerOptions): Promise<SummarizerResponse> {
      try {
        const response = await this.axios.post('/summarize', {
          url: options.url,
          engine: options.engine || 'cecil',
          summary_type: options.summary_type,
          target_language: options.target_language,
        });
        return response.data;
      } catch (error) {
        if (axios.isAxiosError(error)) {
          let errorMessage = 'Unknown error';
          if (error.response?.data) {
            if (typeof error.response.data === 'string') {
              errorMessage = error.response.data;
            } else if (error.response.data.error) {
              // Kagi API returns error as an array
              if (Array.isArray(error.response.data.error)) {
                errorMessage = error.response.data.error.map((e: any) => e.msg).join('; ');
              } else {
                errorMessage = error.response.data.error;
              }
            } else if (error.response.data.message) {
              errorMessage = error.response.data.message;
            } else {
              errorMessage = JSON.stringify(error.response.data);
            }
          } else {
            errorMessage = error.response?.statusText || error.message;
          }
          
          const statusCode = error.response?.status;
          throw new Error(`Kagi summarizer error (${statusCode}): ${errorMessage}`);
        }
        throw error;
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the API and document type support, but fails to disclose critical behavioral traits such as rate limits, authentication requirements, error handling, or what the output looks like (e.g., format, length). For a tool with no annotations, this leaves significant gaps in understanding its operation.

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 appropriately sized and front-loaded: two concise sentences that directly state the tool's function and capabilities without unnecessary details. Every sentence earns its place by providing essential information about the tool's purpose and scope.

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 the complexity of a summarization tool with no annotations and no output schema, the description is incomplete. It lacks information on output format, error conditions, performance characteristics, and integration details. The description does not compensate for the absence of structured data, leaving the agent with insufficient context for reliable use.

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?

Schema description coverage is 100%, so the schema already documents all three parameters thoroughly. The description adds no additional parameter semantics beyond what the schema provides (e.g., no examples, edge cases, or usage tips). According to the rules, with high schema coverage, the baseline is 3 even with no param info in the description.

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 tool's purpose: 'Summarize content from a URL using the Kagi Summarizer API' with a specific verb ('summarize') and resource ('content from a URL'). It distinguishes from the sibling tool 'kagi_search_fetch' by focusing on summarization rather than search/fetch operations. However, it doesn't explicitly differentiate the API from other summarization tools beyond mentioning Kagi.

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

Usage Guidelines3/5

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

The description provides some implied usage context by stating it can 'summarize any document type (text webpage, video, audio, etc.)', which suggests when to use it (for diverse content types). However, it lacks explicit guidance on when to use this tool versus alternatives, prerequisites, or exclusions. No comparison with the sibling tool 'kagi_search_fetch' is provided.

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/yuki-yano/kagi-mcp'

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