tavily_search_qna
Get direct answers to specific questions using optimized web search. This tool searches the web to provide concise responses to user queries.
Instructions
Get a direct answer to a question using Tavily's Q&A optimized search. Returns a concise answer to specific questions.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | The question to answer | |
| search_depth | No | Search depth | basic |
Implementation Reference
- index.js:247-262 (handler)Handler for tavily_search_qna tool: calls Tavily search API with include_answer=true and returns the answer or full JSON result.case "tavily_search_qna": { const result = await tavilyClient.search({ query: args.query, search_depth: args.search_depth || "basic", include_answer: true, }); return { content: [ { type: "text", text: result.answer || JSON.stringify(result, null, 2), }, ], }; }
- index.js:153-173 (schema)Input schema and metadata for the tavily_search_qna tool, registered in listTools response.{ name: "tavily_search_qna", description: "Get a direct answer to a question using Tavily's Q&A optimized search. Returns a concise answer to specific questions.", inputSchema: { type: "object", properties: { query: { type: "string", description: "The question to answer", }, search_depth: { type: "string", enum: ["basic", "advanced"], description: "Search depth", default: "basic", }, }, required: ["query"], }, },
- index.js:17-34 (helper)TavilyClient.search method: performs the actual API call to Tavily search endpoint, used by tavily_search_qna with include_answer flag.async search(params) { const response = await fetch(`${this.baseUrl}/search`, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ api_key: this.apiKey, ...params, }), }); if (!response.ok) { throw new Error(`Tavily API error: ${response.statusText}`); } return await response.json(); }