brave_answers
Get AI-generated answers grounded in current web search results using Brave Search for accurate, up-to-date information.
Instructions
Returns direct AI answers grounded in Brave Search using Brave AI Grounding. Uses an OpenAI-compatible chat completions endpoint and is best for concise answer generation with live web grounding.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Question or prompt to answer | |
| model | No | Model name for Brave AI Grounding (default: brave) | brave |
Implementation Reference
- src/tools/handlers.ts:204-216 (handler)The handler function that processes the 'brave_answers' tool, validates its arguments, and performs the search.
export async function braveAnswersHandler(args: unknown) { if (!isBraveAnswersArgs(args)) { throw new Error("Invalid arguments for brave_answers"); } const { query, model = "brave" } = args; const answer = await performBraveAnswers(query, model); return { content: [{ type: "text", text: answer }], isError: false, }; } - src/tools/definitions.ts:221-241 (schema)The definition of the 'brave_answers' tool including its schema and description.
export const BRAVE_ANSWERS_TOOL: Tool = { name: "brave_answers", description: "Returns direct AI answers grounded in Brave Search using Brave AI Grounding. " + "Uses an OpenAI-compatible chat completions endpoint and is best for concise answer generation with live web grounding.", inputSchema: { type: "object", properties: { query: { type: "string", description: "Question or prompt to answer", }, model: { type: "string", description: "Model name for Brave AI Grounding (default: brave)", default: "brave", }, }, required: ["query"], }, }; - src/tools/definitions.ts:308-317 (helper)The type guard function used to validate the input arguments for the 'brave_answers' tool.
export function isBraveAnswersArgs( args: unknown ): args is { query: string; model?: string } { return ( typeof args === "object" && args !== null && "query" in args && typeof (args as { query: string }).query === "string" ); }