Skip to main content
Glama

Open Search MCP

by flyanima

search_ecosia

Perform eco-friendly searches using the Ecosia engine to plant trees, retrieve relevant results, and customize queries with country, safe search, and result limits.

Instructions

Search using Ecosia - the search engine that plants trees

Input Schema

NameRequiredDescriptionDefault
countryNoSearch country (e.g., "US", "DE", "FR")US
maxResultsNoMaximum number of results to return (1-20)
queryYesSearch query for Ecosia
safeSearchNoEnable safe search filtering

Input Schema (JSON Schema)

{ "properties": { "country": { "default": "US", "description": "Search country (e.g., \"US\", \"DE\", \"FR\")", "type": "string" }, "maxResults": { "default": 10, "description": "Maximum number of results to return (1-20)", "maximum": 20, "minimum": 1, "type": "number" }, "query": { "description": "Search query for Ecosia", "type": "string" }, "safeSearch": { "default": true, "description": "Enable safe search filtering", "type": "boolean" } }, "required": [ "query" ], "type": "object" }

Implementation Reference

  • The execute handler for the search_ecosia tool. Processes input arguments, calls the searchEcosia helper, calculates environmental impact, and returns formatted search results or error response.
    execute: async (args: any) => { try { const { query, maxResults = 10, country = 'US', safeSearch = true } = args; const startTime = Date.now(); const result = await client.searchEcosia(query, { maxResults, country, safeSearch }); const searchTime = Date.now() - startTime; // 计算环保影响 const treesPlanted = Math.floor(maxResults * 0.02); // 大约每50次搜索种一棵树 const co2Offset = Math.round(treesPlanted * 22); // 每棵树每年吸收约22kg CO2 return { success: true, data: { source: 'Ecosia', query, country, safeSearch, totalResults: result.results.length, results: result.results, searchTime, timestamp: Date.now(), environmental: result.environmental, features: result.features, impact: { treesPlanted, co2Offset: `${co2Offset}kg CO2/year`, renewableEnergy: '100%' }, searchMetadata: { engine: 'Ecosia', environmental: true, carbonNeutral: true, treePlanting: true } } }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : 'Ecosia search failed', data: { source: 'Ecosia', query: args.query, results: [], suggestions: [ 'Try eco-friendly search terms', 'Support environmental causes', 'Use sustainable search practices' ] } }; }
  • Full registration of the search_ecosia tool in the ToolRegistry, including name, description, input schema, and execute handler reference.
    registry.registerTool({ name: 'search_ecosia', description: 'Search using Ecosia - the search engine that plants trees', category: 'search', source: 'Ecosia', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query for Ecosia' }, maxResults: { type: 'number', description: 'Maximum number of results to return (1-20)', default: 10, minimum: 1, maximum: 20 }, country: { type: 'string', description: 'Search country (e.g., "US", "DE", "FR")', default: 'US' }, safeSearch: { type: 'boolean', description: 'Enable safe search filtering', default: true } }, required: ['query'] }, execute: async (args: any) => { try { const { query, maxResults = 10, country = 'US', safeSearch = true } = args; const startTime = Date.now(); const result = await client.searchEcosia(query, { maxResults, country, safeSearch }); const searchTime = Date.now() - startTime; // 计算环保影响 const treesPlanted = Math.floor(maxResults * 0.02); // 大约每50次搜索种一棵树 const co2Offset = Math.round(treesPlanted * 22); // 每棵树每年吸收约22kg CO2 return { success: true, data: { source: 'Ecosia', query, country, safeSearch, totalResults: result.results.length, results: result.results, searchTime, timestamp: Date.now(), environmental: result.environmental, features: result.features, impact: { treesPlanted, co2Offset: `${co2Offset}kg CO2/year`, renewableEnergy: '100%' }, searchMetadata: { engine: 'Ecosia', environmental: true, carbonNeutral: true, treePlanting: true } } }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : 'Ecosia search failed', data: { source: 'Ecosia', query: args.query, results: [], suggestions: [ 'Try eco-friendly search terms', 'Support environmental causes', 'Use sustainable search practices' ] } }; } } });
  • Helper method searchEcosia in AlternativeSearchClient that generates simulated Ecosia search results using generateSearchResults.
    async searchEcosia(query: string, options: any = {}) { try { // Ecosia是环保搜索引擎,我们使用模拟数据 const results = this.generateSearchResults(query, 'Ecosia', options.maxResults || 10); return { success: true, results, source: 'Ecosia', environmental: 'Plants trees with search revenue', features: ['Carbon neutral', 'Tree planting', 'Renewable energy'] }; } catch (error) { throw new Error(`Ecosia search failed: ${error instanceof Error ? error.message : String(error)}`); } }
  • src/index.ts:241-241 (registration)
    Invocation of registerAlternativeSearchEngines in the main server initialization, which registers the search_ecosia tool among others.
    registerAlternativeSearchEngines(this.toolRegistry); // 3 tools: search_startpage, search_brave, search_ecosia
  • Additional input validation schema mapping for search_ecosia in the global InputValidator, referencing basicSearch schema.
    'search_ecosia': ToolSchemas.basicSearch,

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