Skip to main content
Glama
amotivv

cloudflare-browser-rendering-mcp

search_documentation

Search Cloudflare documentation to retrieve relevant content based on your query, with options to specify the maximum number of results returned.

Instructions

Searches Cloudflare documentation and returns relevant content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
maxResultsNoMaximum number of results to return
queryYesSearch query

Implementation Reference

  • Implementation of the search_documentation tool handler. Validates input arguments, simulates a search of Cloudflare documentation using mock data, formats the results as markdown, and returns them as text content. Includes error handling.
    /**
     * Handle the search_documentation tool
     */
    private async handleSearchDocumentation(args: any) {
      // Validate arguments
      if (typeof args !== 'object' || args === null || typeof args.query !== 'string') {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid arguments for search_documentation');
      }
    
      const { query, maxResults = 3 } = args;
    
      try {
        // In a real implementation, you would:
        // 1. Use Cloudflare Browser Rendering to navigate to the docs
        // 2. Use the search functionality on the docs site
        // 3. Extract the search results
        
        // For this simulation, we'll return mock results
        const mockResults = [
          {
            title: 'Browser Rendering API Overview',
            url: 'https://developers.cloudflare.com/browser-rendering/',
            snippet: 'Cloudflare Browser Rendering is a serverless headless browser service that allows execution of browser actions within Cloudflare Workers.',
          },
          {
            title: 'REST API Reference',
            url: 'https://developers.cloudflare.com/browser-rendering/rest-api/',
            snippet: 'The REST API provides simple endpoints for common browser tasks like fetching content, taking screenshots, and generating PDFs.',
          },
          {
            title: 'Workers Binding API Reference',
            url: 'https://developers.cloudflare.com/browser-rendering/workers-binding/',
            snippet: 'For more advanced use cases, you can use the Workers Binding API with Puppeteer to automate browser interactions.',
          },
        ].slice(0, maxResults);
        
        // Format the results
        const formattedResults = mockResults.map(result => 
          `## [${result.title}](${result.url})\n${result.snippet}\n`
        ).join('\n');
        
        return {
          content: [
            {
              type: 'text',
              text: `# Search Results for "${query}"\n\n${formattedResults}`,
            },
          ],
        };
      } catch (error) {
        console.error('[Error] Error searching documentation:', error);
        return {
          content: [
            {
              type: 'text',
              text: `Error searching documentation: ${error instanceof Error ? error.message : String(error)}`,
            },
          ],
          isError: true,
        };
      }
    }
  • src/server.ts:91-107 (registration)
    Registration of the search_documentation tool in the listTools response, including name, description, and input schema definition.
      name: 'search_documentation',
      description: 'Searches Cloudflare documentation and returns relevant content',
      inputSchema: {
        type: 'object',
        properties: {
          query: {
            type: 'string',
            description: 'Search query',
          },
          maxResults: {
            type: 'number',
            description: 'Maximum number of results to return',
          },
        },
        required: ['query'],
      },
    },
  • Dispatch logic in the CallToolRequestSchema handler that routes calls to the search_documentation tool to its handler function.
    case 'search_documentation':
      console.error(`[API] Searching documentation for: ${args?.query}`);
      return await this.handleSearchDocumentation(args);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool searches and returns content, but doesn't describe important behaviors like whether it performs web searches, accesses a local database, requires authentication, has rate limits, or what format the returned content takes (e.g., text snippets, links, full documents).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that gets straight to the point without unnecessary words. It's appropriately sized for a simple search tool, though it could potentially be more structured with additional context.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a search tool with no annotations and no output schema, the description is incomplete. It doesn't explain what kind of content is returned (snippets, full pages, metadata), how results are ranked, whether authentication is needed, or any limitations. Given the lack of structured fields, the description should provide more operational context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, clearly documenting both parameters ('query' and 'maxResults'). The description doesn't add any meaningful parameter semantics beyond what the schema already provides, such as search syntax examples or result format details.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Searches') and resource ('Cloudflare documentation'), making it immediately understandable. However, it doesn't distinguish this tool from its sibling tools like 'fetch_page' or 'extract_structured_content', which might also retrieve documentation content in different ways.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any prerequisites, constraints, or compare it to sibling tools like 'fetch_page' (which might retrieve a specific page) or 'summarize_content' (which might process content).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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