brave_web_search_code_mode
Search the web with Brave and extract specific data by running custom JavaScript code on the raw API response in a secure sandbox, minimizing context usage.
Instructions
Performs a web search using the Brave Search API, and then runs a custom JavaScript code string against the RAW API RESPONSE in a secure QuickJS sandbox. This drastically reduces context window usage by only returning the output of your script. Use this for broad information gathering, recent events, or when you need diverse web sources and only need specific parts of the result. Your script should read the 'DATA' global variable (a JSON string of the API response), process it, and use console.log() to print the desired output.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | JavaScript code to execute against the 'DATA' variable. E.g. `const r = JSON.parse(DATA); console.log(r.web.results.map(x => x.title).join(', '));` | |
| count | No | Number of results (1-20, default 10) | |
| query | Yes | Search query (max 400 chars, 50 words) | |
| offset | No | Pagination offset (max 9, default 0) | |
| language | No | Language of the code. Only 'javascript' is supported. | javascript |