Skip to main content
Glama
amotivv

cloudflare-browser-rendering-mcp

summarize_content

Extract concise summaries of web content to optimize context for large language models, enabling efficient content processing directly from Cloudflare Browser Rendering.

Instructions

Summarizes web content for more concise LLM context

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
maxLengthNoMaximum length of the summary
urlYesURL to summarize

Implementation Reference

  • Main handler function that executes the summarize_content tool logic. Validates input, provides mock summary (intended to fetch, process, and summarize real content in production).
    private async handleSummarizeContent(args: any) { // Validate arguments if (typeof args !== 'object' || args === null || typeof args.url !== 'string') { throw new McpError(ErrorCode.InvalidParams, 'Invalid arguments for summarize_content'); } const { url, maxLength = 500 } = args; try { // In a real implementation, you would: // 1. Fetch the page content using Cloudflare Browser Rendering // 2. Process the content for LLM // 3. Call an LLM API to summarize the content // For this simulation, we'll return a mock summary const mockSummary = ` # Browser Rendering API Summary Cloudflare Browser Rendering is a serverless headless browser service for Cloudflare Workers that enables: 1. Rendering JavaScript-heavy websites 2. Taking screenshots and generating PDFs 3. Extracting structured data 4. Automating browser interactions It offers two main interfaces: - **REST API**: Simple endpoints for common tasks - **Workers Binding API**: Advanced integration with Puppeteer The service runs within Cloudflare's network, providing low-latency access to browser capabilities without managing infrastructure. `.trim(); // Truncate if necessary const truncatedSummary = mockSummary.length > maxLength ? mockSummary.substring(0, maxLength) + '...' : mockSummary; return { content: [ { type: 'text', text: truncatedSummary, }, ], }; } catch (error) { console.error('[Error] Error summarizing content:', error); return { content: [ { type: 'text', text: `Error summarizing content: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } }
  • Input schema definition for the summarize_content tool, registered in the ListTools handler.
    name: 'summarize_content', description: 'Summarizes web content for more concise LLM context', inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'URL to summarize', }, maxLength: { type: 'number', description: 'Maximum length of the summary', }, }, required: ['url'], }, },
  • src/server.ts:192-194 (registration)
    Registration of the tool handler in the CallToolRequestSchema switch statement.
    case 'summarize_content': console.error(`[API] Summarizing content from: ${args?.url}`); return await this.handleSummarizeContent(args);
  • Supporting summarizeContent method in ContentProcessor class (mock implementation, not directly used by the tool handler but imported).
    summarizeContent(content: string, maxLength: number = 500): string { // In a real implementation, you would call an LLM API here console.error('[API] Simulating content summarization...'); // For this simulation, we'll return a mock summary const mockSummary = ` # Browser Rendering API Summary Cloudflare Browser Rendering is a serverless headless browser service for Cloudflare Workers that enables: 1. Rendering JavaScript-heavy websites 2. Taking screenshots and generating PDFs 3. Extracting structured data 4. Automating browser interactions It offers two main interfaces: - **REST API**: Simple endpoints for common tasks - **Workers Binding API**: Advanced integration with Puppeteer The service runs within Cloudflare's network, providing low-latency access to browser capabilities without managing infrastructure. `.trim(); // Truncate if necessary return mockSummary.length > maxLength ? mockSummary.substring(0, maxLength) + '...' : mockSummary; }

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/amotivv/cloudflare-browser-rendering-mcp'

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