Skip to main content
Glama

mcp-bocha_search

Search the web with time filters, domain inclusion/exclusion, and summarized results using Bocha AI's API. Ideal for retrieving targeted and relevant information efficiently.

Instructions

Search the web for information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
countNo
excludeNo
freshnessNo
includeNo
queryYes
summaryNo

Implementation Reference

  • The execute function that handles the tool logic by making a POST request to the Bocha AI web-search API, processes the response, and returns the web pages as content.
    execute: async (params) => { const response = await fetch("https://api.bochaai.com/v1/web-search", { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}`, }, body: JSON.stringify({ ...params, include: params.include?.join(","), exclude: params.exclude?.join(","), }), }); const { data: { webPages }, } = await response.json(); const result = [ ...webPages.value.map((page: any) => ({ type: "text", text: JSON.stringify(page), })), ]; return { content: result, }; },
  • Zod schema defining the input parameters for the mcp-bocha_search tool, including query, freshness, summary, include, exclude, and count.
    parameters: z.object({ query: z.string(), freshness: z .enum(["oneDay", "oneWeek", "oneMonth", "oneYear", "noLimit"]) .optional(), summary: z.boolean().optional(), include: z.array(z.string()).optional(), exclude: z.array(z.string()).optional(), count: z.number().optional(), }),
  • src/index.ts:13-55 (registration)
    Registration of the mcp-bocha_search tool using server.addTool, including name, description, parameters schema, and execute handler.
    server.addTool({ name: "mcp-bocha_search", description: "Search the web for information", parameters: z.object({ query: z.string(), freshness: z .enum(["oneDay", "oneWeek", "oneMonth", "oneYear", "noLimit"]) .optional(), summary: z.boolean().optional(), include: z.array(z.string()).optional(), exclude: z.array(z.string()).optional(), count: z.number().optional(), }), execute: async (params) => { const response = await fetch("https://api.bochaai.com/v1/web-search", { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}`, }, body: JSON.stringify({ ...params, include: params.include?.join(","), exclude: params.exclude?.join(","), }), }); const { data: { webPages }, } = await response.json(); const result = [ ...webPages.value.map((page: any) => ({ type: "text", text: JSON.stringify(page), })), ]; return { content: result, }; }, });

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/intounknown/mcp-bocha'

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