Skip to main content
Glama

kagi_summarizer_process

Summarize web pages, videos, and podcasts from URLs to extract key information quickly. Supports both basic and advanced extraction for efficient content comprehension.

Instructions

Instantly summarizes content of any type and length from URLs. Supports pages, videos, and podcasts with transcripts. Best for quick comprehension of long-form content and multimedia resources.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL(s)
extract_depthNoExtraction depth

Implementation Reference

  • The process_content method implements the core logic of the kagi_summarizer_process tool by sending a POST request to Kagi's summarization API with the provided URL and returning the summarized content.
    async process_content(url: string): Promise<ProcessingResult> { const api_key = validate_api_key( config.processing.kagi_summarizer.api_key, this.name, ); const summarize_request = async () => { try { const data = await http_json< KagiSummarizerResponse & { message?: string } >(this.name, config.processing.kagi_summarizer.base_url, { method: 'POST', headers: { 'Content-Type': 'application/json', Authorization: `Bot ${api_key}`, }, body: JSON.stringify({ url }), signal: AbortSignal.timeout( config.processing.kagi_summarizer.timeout, ), }); if (!data?.data?.output) { const error_message = (data as any)?.message || 'Empty output'; throw new ProviderError( ErrorType.API_ERROR, `Unexpected error: ${error_message}`, this.name, ); } return { content: data.data.output, metadata: { word_count: data.data.tokens, }, source_provider: this.name, }; } catch (error) { handle_provider_error(error, this.name, 'fetch summary'); } }; return retry_with_backoff(summarize_request); }
  • Registers the KagiSummarizerProvider if the API key is valid, making it available for tool registration.
    is_api_key_valid( config.processing.kagi_summarizer.api_key, 'kagi_summarizer', ) ) { register_processing_provider(new KagiSummarizerProvider()); }
  • Dynamically registers the 'kagi_summarizer_process' tool by iterating over processing providers, setting the tool name to `${provider.name}_process`, defining the input schema, and handling the execution via provider.process_content.
    this.processing_providers.forEach((provider) => { server.tool( { name: `${provider.name}_process`, description: provider.description, schema: v.object({ url: v.pipe( v.union([v.string(), v.array(v.string())]), v.description('URL(s)'), ), extract_depth: v.optional( v.pipe( v.union([v.literal('basic'), v.literal('advanced')]), v.description('Extraction depth'), ), ), }), }, async ({ url, extract_depth }) => { try { const result = await provider.process_content( url, extract_depth, ); const safe_result = handle_large_result( result, provider.name, ); return { content: [ { type: 'text' as const, text: JSON.stringify(safe_result, null, 2), }, ], }; } catch (error) { const error_response = create_error_response( error as Error, ); return { content: [ { type: 'text' as const, text: error_response.error, }, ], isError: true, }; } }, ); });
  • Defines the input schema for the kagi_summarizer_process tool, accepting URL(s) and optional extract_depth.
    schema: v.object({ url: v.pipe( v.union([v.string(), v.array(v.string())]), v.description('URL(s)'), ), extract_depth: v.optional( v.pipe( v.union([v.literal('basic'), v.literal('advanced')]), v.description('Extraction depth'), ), ), }),

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/spences10/mcp-omnisearch'

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