Skip to main content
Glama
flyanima

Open Search MCP

by flyanima

search_brave

Search the web using Brave Search, a privacy-focused search engine that returns results based on your query, with options to filter by region and safe search settings.

Instructions

Search using Brave Search - independent, privacy-focused search engine

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query for Brave Search
maxResultsNoMaximum number of results to return (1-20)
safeSearchNoSafe search setting: strict, moderate, offmoderate
regionNoSearch region (e.g., "us", "uk", "de")us

Implementation Reference

  • Main execution handler for the search_brave tool. Processes input arguments, calls the searchBrave helper, formats results with metadata, and handles errors gracefully.
    execute: async (args: any) => {
      try {
        const { query, maxResults = 10, safeSearch = 'moderate', region = 'us' } = args;
        
        const startTime = Date.now();
        const result = await client.searchBrave(query, { maxResults, safeSearch, region });
        const searchTime = Date.now() - startTime;
    
        return {
          success: true,
          data: {
            source: 'Brave Search',
            query,
            safeSearch,
            region,
            totalResults: result.results.length,
            results: result.results,
            searchTime,
            timestamp: Date.now(),
            privacy: result.privacy,
            features: result.features,
            searchMetadata: {
              engine: 'Brave Search',
              independent: true,
              tracking: false,
              ads: false
            }
          }
        };
      } catch (error) {
        return {
          success: false,
          error: error instanceof Error ? error.message : 'Brave search failed',
          data: {
            source: 'Brave Search',
            query: args.query,
            results: [],
            suggestions: [
              'Try simpler search terms',
              'Check your internet connection',
              'Use alternative search engines'
            ]
          }
        };
      }
  • Input schema defining parameters for the search_brave tool: query (required), maxResults, safeSearch, and region.
    inputSchema: {
      type: 'object',
      properties: {
        query: {
          type: 'string',
          description: 'Search query for Brave Search'
        },
        maxResults: {
          type: 'number',
          description: 'Maximum number of results to return (1-20)',
          default: 10,
          minimum: 1,
          maximum: 20
        },
        safeSearch: {
          type: 'string',
          description: 'Safe search setting: strict, moderate, off',
          default: 'moderate',
          enum: ['strict', 'moderate', 'off']
        },
        region: {
          type: 'string',
          description: 'Search region (e.g., "us", "uk", "de")',
          default: 'us'
        }
      },
      required: ['query']
    },
  • Registers the search_brave tool in the ToolRegistry, including name, description, schema, and execute handler.
    registry.registerTool({
      name: 'search_brave',
      description: 'Search using Brave Search - independent, privacy-focused search engine',
      category: 'search',
      source: 'Brave Search',
      inputSchema: {
        type: 'object',
        properties: {
          query: {
            type: 'string',
            description: 'Search query for Brave Search'
          },
          maxResults: {
            type: 'number',
            description: 'Maximum number of results to return (1-20)',
            default: 10,
            minimum: 1,
            maximum: 20
          },
          safeSearch: {
            type: 'string',
            description: 'Safe search setting: strict, moderate, off',
            default: 'moderate',
            enum: ['strict', 'moderate', 'off']
          },
          region: {
            type: 'string',
            description: 'Search region (e.g., "us", "uk", "de")',
            default: 'us'
          }
        },
        required: ['query']
      },
      execute: async (args: any) => {
        try {
          const { query, maxResults = 10, safeSearch = 'moderate', region = 'us' } = args;
          
          const startTime = Date.now();
          const result = await client.searchBrave(query, { maxResults, safeSearch, region });
          const searchTime = Date.now() - startTime;
    
          return {
            success: true,
            data: {
              source: 'Brave Search',
              query,
              safeSearch,
              region,
              totalResults: result.results.length,
              results: result.results,
              searchTime,
              timestamp: Date.now(),
              privacy: result.privacy,
              features: result.features,
              searchMetadata: {
                engine: 'Brave Search',
                independent: true,
                tracking: false,
                ads: false
              }
            }
          };
        } catch (error) {
          return {
            success: false,
            error: error instanceof Error ? error.message : 'Brave search failed',
            data: {
              source: 'Brave Search',
              query: args.query,
              results: [],
              suggestions: [
                'Try simpler search terms',
                'Check your internet connection',
                'Use alternative search engines'
              ]
            }
          };
        }
      }
    });
  • Helper function in AlternativeSearchClient that simulates Brave Search results using generateSearchResults.
    async searchBrave(query: string, options: any = {}) {
      try {
        // 由于Brave Search API需要特殊权限,我们使用模拟数据
        const results = this.generateSearchResults(query, 'Brave Search', options.maxResults || 10);
        return {
          success: true,
          results,
          source: 'Brave Search',
          privacy: 'High privacy protection',
          features: ['No tracking', 'Independent index', 'Ad-free results']
        };
      } catch (error) {
        throw new Error(`Brave search failed: ${error instanceof Error ? error.message : String(error)}`);
      }
  • src/index.ts:241-241 (registration)
    Top-level call in server initialization that registers the alternative search engines including search_brave.
    registerAlternativeSearchEngines(this.toolRegistry); // 3 tools: search_startpage, search_brave, search_ecosia
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. While it mentions Brave Search is 'independent, privacy-focused,' it doesn't describe rate limits, authentication requirements, response format, pagination, or error behavior. For a search tool with no annotation coverage, this leaves significant gaps in understanding how the tool behaves operationally.

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

Conciseness5/5

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

The description is a single, efficient sentence that conveys the core purpose and key differentiator (privacy-focused) without any fluff. It's appropriately sized and front-loaded with essential information, making every word earn its place.

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

Completeness3/5

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

Given the tool's moderate complexity (search operation with 4 parameters) and no annotations or output schema, the description is minimally adequate. It identifies the search engine and its privacy focus but doesn't address behavioral aspects, usage context among siblings, or expected results. For a tool with no output schema, additional guidance on return format would be helpful but isn't required for a baseline score.

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?

Schema description coverage is 100%, so the schema fully documents all 4 parameters (query, maxResults, safeSearch, region) with descriptions, defaults, and constraints. The description adds no parameter-specific information beyond what's in the schema. According to scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no param info in the description.

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: 'Search using Brave Search' specifies the verb and resource. It adds context about being 'independent, privacy-focused' which distinguishes it from generic search tools, though it doesn't explicitly differentiate from sibling search tools like search_ecosia or search_startpage. The purpose is clear but lacks sibling-specific differentiation.

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. With multiple sibling search tools (search_arxiv, search_ecosia, search_ieee, search_pubmed, etc.), there's no indication of Brave Search's specific use cases, strengths, or limitations compared to other search engines. The agent must infer usage from the tool name alone.

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

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/flyanima/open-search-mcp'

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