kagi_summarizer
Summarize content from a URL, including web pages, videos, and audio. Choose between paragraph prose or bulleted key points.
Instructions
Summarize content from a URL using the Kagi Summarizer.
The Summarizer can summarize any document type (text webpage, video, audio, etc.)
Note: This tool uses Kagi's internal summarizer endpoint accessed via session token. This is experimental and may break if Kagi changes their internal API.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | A URL to a document to summarize. | |
| summary_type | No | Type of summary to produce. Options are 'summary' for paragraph prose and 'takeaway' for a bulleted list of key points. | summary |
| target_language | No | Desired output language using language codes (e.g., 'EN' for English). If not specified, the document's original language influences the output. | |
| engine | No | Summarizer engine to use. 'cecil' is the default. Note: This is an experimental feature — the summarizer endpoint may change without notice. | cecil |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/kagi_session_mcp/server.py:120-173 (handler)The main handler function for the kagi_summarizer tool. Registered via @mcp.tool() decorator. Accepts url, summary_type, target_language, and engine parameters. Validates inputs using helper functions, calls client.summarize(), and formats the result.
@mcp.tool() async def kagi_summarizer( url: str = Field(description="A URL to a document to summarize."), summary_type: Literal["summary", "takeaway"] = Field( 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: str | None = Field( default=None, description=( "Desired output language using language codes " "(e.g., 'EN' for English). If not specified, the document's " "original language influences the output." ), ), engine: Literal["cecil", "agnes", "daphne", "muriel"] = Field( default="cecil", description=( "Summarizer engine to use. 'cecil' is the default. " "Note: This is an experimental feature — the summarizer " "endpoint may change without notice." ), ), ) -> str: """Summarize content from a URL using the Kagi Summarizer. The Summarizer can summarize any document type (text webpage, video, audio, etc.) Note: This tool uses Kagi's internal summarizer endpoint accessed via session token. This is experimental and may break if Kagi changes their internal API. """ if not url: raise ValueError("Summarizer called with no URL.") if client is None: raise RuntimeError("Server not initialized. Session client is missing.") # Validate parameters engine = validate_engine(engine) summary_type = validate_summary_type(summary_type) result = await client.summarize( url=url, engine=engine, summary_type=summary_type, target_language=target_language, ) return format_summarizer_result(result) - src/kagi_session_mcp/server.py:120-121 (registration)Registration of kagi_summarizer as an MCP tool using the @mcp.tool() decorator on the async function definition at line 120.
@mcp.tool() async def kagi_summarizer( - Schema/type definitions for the kagi_summarizer tool parameters: url (str), summary_type (Literal['summary','takeaway']), target_language (str|None), engine (Literal['cecil','agnes','daphne','muriel']) defined via Pydantic Field descriptors.
async def kagi_summarizer( url: str = Field(description="A URL to a document to summarize."), summary_type: Literal["summary", "takeaway"] = Field( 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: str | None = Field( default=None, description=( "Desired output language using language codes " "(e.g., 'EN' for English). If not specified, the document's " "original language influences the output." ), ), engine: Literal["cecil", "agnes", "daphne", "muriel"] = Field( default="cecil", description=( "Summarizer engine to use. 'cecil' is the default. " "Note: This is an experimental feature — the summarizer " "endpoint may change without notice." ), ), - Validation helper functions used by kagi_summarizer: validate_engine() and validate_summary_type() that check engine/summary_type against allowed values.
def validate_engine(engine: str) -> str: """Validate and return the summarizer engine name. Args: engine: Engine name to validate Returns: Validated engine name Raises: ValueError: If engine is not valid """ if engine not in VALID_ENGINES: raise ValueError( f"Invalid summarizer engine: '{engine}'. " f"Valid engines: {', '.join(sorted(VALID_ENGINES))}" ) return engine - The client.summarize() method called by the kagi_summarizer handler. Makes the actual HTTP request to Kagi's internal /mother/summary_labs endpoint with session token authentication.
async def summarize(