Skip to main content
Glama

kagi_summarizer

Summarize text, video, or audio content from a URL into concise paragraph prose or key bullet points using Kagi.com's Summarizer API. Supports multiple languages for enhanced accessibility and clarity.

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
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

  • The kagiSummarizer function implements the core logic of the tool, handling input validation, calling the kagi-ken summarize function, processing the response, and returning MCP-formatted content.
    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), }, ], }; } }
  • Zod schema defining the input parameters for the kagi_summarizer tool: url (required), summary_type (summary or takeaway), target_language (optional).
    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)
    Registers the kagi_summarizer tool with the MCP server using the imported config and 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 the name 'kagi_summarizer', description, and reference to the input schema, used for 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, };

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

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