search
Search the web using Brave Search API to retrieve structured results including titles, URLs, and descriptions without scraping pages directly.
Instructions
Search the web using Brave Search API — fast, reliable, no rate limits. Returns titles, URLs, and descriptions as structured JSON without scraping the pages.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| q | Yes | The search query | |
| count | No | Number of results (1-20, default 5) | |
| context | No | Optional: what you're trying to accomplish. Helps with result relevance. |
Implementation Reference
- mcp-server/src/index.ts:94-122 (handler)The registration and handler implementation for the "search" tool in the mcp-server. It calls a remote API endpoint and formats the response.
server.tool( "search", "Search Google and return structured results (title, URL, snippet). Does not scrape the pages.", { query: z.string().describe("Search query"), maxResults: z .number() .int() .min(1) .max(20) .optional() .describe("Max results to return (default: 5, max: 20)"), }, async ({ query, maxResults }) => { const data = await callApi("/search", { query, maxResults }); const results = data.results || []; const formatted = results .map((r, i) => `${i + 1}. **${r.title}**\n ${r.url}\n ${r.snippet}`) .join("\n\n"); return { content: [ { type: "text" as const, text: formatted || "No results found.", }, ], }; } );