Skip to main content
Glama
czottmann

kagi-kan-mcp

by czottmann

Kagi Summarizer

kagi_summarizer

Summarize web content from any URL into concise prose or key points using Kagi's API, supporting various document types including text, video, and audio.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesA URL to a document to summarize.
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.

Implementation Reference

  • Core handler function that executes the kagi_summarizer tool: validates inputs, calls kagi-ken summarize, handles response formatting and errors.
    export async function kagiSummarizer(
      { url, summary_type = "summary", target_language },
    ) {
      try {
        if (!url) {
          throw new Error("Summarizer called with no URL.");
        }
    
        const { token, engine } = getEnvironmentConfig();
    
        // Validate summary type
        if (!["summary", "takeaway"].includes(summary_type)) {
          throw new Error(
            `Invalid summary_type: ${summary_type}. Must be 'summary' or 'takeaway'.`,
          );
        }
    
        // Set default language if not provided
        const language = target_language || "EN";
    
        // Validate language if provided
        if (
          target_language && SUPPORTED_LANGUAGES &&
          !SUPPORTED_LANGUAGES.includes(language)
        ) {
          console.warn(
            `Warning: Language '${language}' may not be supported. Supported languages: ${
              SUPPORTED_LANGUAGES.join(", ")
            }`,
          );
        }
    
        // Note about engine compatibility
        if (engine && engine !== "default") {
          console.warn(
            `Note: Engine selection (${engine}) from KAGI_SUMMARIZER_ENGINE may not be supported by kagi-ken. Using default behavior.`,
          );
        }
    
        // Prepare options for kagi-ken
        const options = {
          type: summary_type,
          language: language,
          isUrl: true,
        };
    
        // Call kagi-ken summarize function
        const result = await summarize(url, token, options);
    
        // Extract the summary text from the result
        // The structure may vary, so we'll try different possible response formats
        let summaryText;
        if (typeof result === "string") {
          summaryText = result;
        } else if (result && result.summary) {
          summaryText = result.summary;
        } else if (result && result.data && result.data.output) {
          summaryText = result.data.output;
        } else if (result && result.output) {
          summaryText = result.output;
        } else {
          // Fallback: stringify the result if it's not in expected format
          summaryText = JSON.stringify(result, null, 2);
        }
    
        return {
          content: [
            {
              type: "text",
              text: summaryText,
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: formatError(error),
            },
          ],
        };
      }
    }
  • Input schema for the kagi_summarizer tool using Zod for validation of url, summary_type, and target_language parameters.
    export const summarizerInputSchema = {
      url: z.string().url().describe("A URL to a document to summarize."),
      summary_type: z.enum(["summary", "takeaway"]).default("summary").describe(
        "Type of summary to produce. Options are 'summary' for paragraph prose and 'takeaway' for a bulleted list of key points.",
      ),
      target_language: z.string().optional().describe(
        "Desired output language using language codes (e.g., 'EN' for English). If not specified, the document's original language influences the output.",
      ),
    };
  • src/index.js:38-47 (registration)
    MCP server registration of the kagi_summarizer tool, specifying name, title, description, inputSchema, and the handler function.
    // Register summarizer tool
    this.server.registerTool(
      summarizerToolConfig.name,
      {
        title: "Kagi Summarizer",
        description: summarizerToolConfig.description,
        inputSchema: summarizerToolConfig.inputSchema,
      },
      async (args) => await kagiSummarizer(args),
    );
  • Tool configuration object including name, description, and reference to inputSchema, used during server registration.
    export const summarizerToolConfig = {
      name: "kagi_summarizer",
      description: `
        Summarize content from a URL using the Kagi.com Summarizer API. The Summarizer can summarize any
        document type (text webpage, video, audio, etc.)
        `.replace(/\s+/gs, " ").trim(),
      inputSchema: summarizerInputSchema,
    };
  • Helper utility to retrieve Kagi API token and summarizer engine configuration from environment variables, used in the handler.
    export function getEnvironmentConfig() {
      const token = resolveToken();
    
      // Note: kagi-ken might not support engine selection like the official API
      // We'll keep this for compatibility but may not use it
      const engine = process.env.KAGI_SUMMARIZER_ENGINE || "default";
    
      return { token, engine };
    }
Behavior2/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. While it mentions the API source and content types, it doesn't disclose important behavioral traits like authentication requirements, rate limits, error handling, or what the output looks like. For a tool that interacts with an external API and produces summaries, this represents significant gaps in behavioral transparency.

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 perfectly concise with two sentences that each earn their place. The first sentence establishes the core functionality, and the second sentence adds valuable context about document type flexibility. There's zero wasted language, and the information is front-loaded appropriately.

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 tool's complexity (external API integration, multiple parameter options, no output schema, and no annotations), the description is insufficiently complete. It doesn't explain what the summarization output looks like, doesn't mention authentication or rate limiting considerations, and provides minimal guidance on when to use different summary types. For a tool with this level of complexity, more contextual information is needed.

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?

With 100% schema description coverage, the input schema already documents all three parameters thoroughly. The description doesn't add any meaningful parameter semantics beyond what's in the schema - it mentions URL summarization generally but doesn't provide additional context about parameter usage, constraints, or interactions. The baseline of 3 is appropriate when the schema does the heavy lifting.

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 specific action ('summarize content from a URL') and resource ('using the Kagi.com Summarizer API'), distinguishing it from the sibling tool 'kagi_search_fetch' which likely performs search operations rather than summarization. The description explicitly mentions what types of content can be summarized (text webpage, video, audio, etc.), providing clear differentiation.

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 implies usage context by stating it can 'summarize any document type', suggesting it's appropriate for various content formats. However, it doesn't explicitly state when to use this tool versus alternatives or provide any exclusion criteria. The presence of a sibling tool suggests some guidance would be helpful but isn't 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

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/czottmann/kagi-ken-mcp'

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