kagi_summarizer_process
Summarize content from URLs, including pages, videos, and podcasts, to quickly grasp key details. Supports multiple URLs and customizable extraction depth for tailored results.
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
| Name | Required | Description | Default |
|---|---|---|---|
| extract_depth | No | The depth of the extraction process. "advanced" retrieves more data but costs more credits. | basic |
| url | Yes |
Implementation Reference
- Core handler implementation: KagiSummarizerProvider class with process_content method that calls Kagi API to summarize URL content.export class KagiSummarizerProvider implements ProcessingProvider { name = 'kagi_summarizer'; description = '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.'; 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); } }
- src/server/tools.ts:390-439 (registration)Tool registration loop that creates the 'kagi_summarizer_process' tool (via `${provider.name}_process`) and defines its generic handler calling provider.process_content.// Register remaining processing providers (kagi_summarizer, tavily_extract) 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, ); return { content: [ { type: 'text' as const, text: JSON.stringify(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, }; } }, ); });
- src/providers/index.ts:107-114 (registration)Registration of the KagiSummarizerProvider instance if API key is valid.if ( is_api_key_valid( config.processing.kagi_summarizer.api_key, 'kagi_summarizer', ) ) { register_processing_provider(new KagiSummarizerProvider()); }
- Type schema for the Kagi summarizer API response.interface KagiSummarizerResponse { meta: { id: string; node: string; ms: number; api_balance: number; }; data: { output: string; tokens: number; }; }
- src/server/tools.ts:396-407 (schema)Input schema for the processing tools, including kagi_summarizer_process.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'), ), ), }),