brave_search
Search Brave for relevant links by entering a query, enabling quick access to web data through the LSD MCP Server integration.
Instructions
Search Brave for possibly relevant links to a query
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"query": {
"type": "string"
}
},
"required": [
"query"
],
"type": "object"
}
Implementation Reference
- src/brave.ts:6-18 (registration)Registers the 'brave_search' tool on the MCP server, including input schema { query: z.string() } and the handler function.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/brave.ts:7-17 (handler)The handler function for brave_search that scrapes Brave search using LSD and returns formatted results.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/lsd.ts:3-9 (helper)Helper function runLSD used by brave_search handler to execute LSD scraping code.export const runLSD = async ( code: string, ): Promise<Array<Record<string, any>>> => { const trip = await drop.tab(); const results = await trip.execute(code); return results; };
- src/index.ts:14-14 (registration)Top-level call to register the brave_search tool by invoking applyBraveTool on the MCP server.applyBraveTool(server);