brave_search
Search the Brave search engine to find relevant web links for research queries, enabling web data extraction through the LSD MCP Server.
Instructions
Search Brave for possibly relevant links to a query
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes |
Implementation Reference
- src/brave.ts:7-17 (handler)The inline handler function for the 'brave_search' tool. It takes a query, constructs an LSD scraping script for Brave search results, executes it via runLSD, and formats the extracted links into a text response.server.tool("brave_search", "Search Brave for possibly relevant links to a query", { query: z.string() }, async ({ query }) => { const result = await runLSD(`FROM https://search.brave.com?search?q=${encodeURIComponent(query)} |> G ROUP BY div.snippet |> SELECT a@href AS result_link`); return { content: [{ type: 'text', text: `Here are the results for searching on Brave for: ${query}\n\n${JSON.stringify(result)}` }] } })
- src/brave.ts:7-7 (schema)Zod input schema for the brave_search tool, requiring a 'query' string parameter.server.tool("brave_search", "Search Brave for possibly relevant links to a query", { query: z.string() }, async ({ query }) => {
- src/brave.ts:6-18 (registration)The applyBraveTool function that registers the brave_search tool, including its description, schema, and handler, onto the MCP server.export const applyBraveTool = (server: McpServer) => { server.tool("brave_search", "Search Brave for possibly relevant links to a query", { query: z.string() }, async ({ query }) => { const result = await runLSD(`FROM https://search.brave.com?search?q=${encodeURIComponent(query)} |> G ROUP BY div.snippet |> SELECT a@href AS result_link`); return { content: [{ type: 'text', text: `Here are the results for searching on Brave for: ${query}\n\n${JSON.stringify(result)}` }] } }) }
- src/index.ts:14-14 (registration)During server initialization, applyBraveTool is called to register the brave_search tool.applyBraveTool(server);
- src/lsd.ts:3-9 (helper)Helper function runLSD used by the brave_search handler to execute LSD (likely 'Liquid Scrape Data') code using the 'internetdata' library's drop.tab() for web scraping.export const runLSD = async ( code: string, ): Promise<Array<Record<string, any>>> => { const trip = await drop.tab(); const results = await trip.execute(code); return results; };