Skip to main content
Glama
sumitchatterjee13

Tavily Cursor MCP Server

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
NameRequiredDescriptionDefault
queryYesThe question to answer
search_depthNoSearch depthbasic

Implementation Reference

  • 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),
          },
        ],
      };
    }
  • 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"],
      },
    },
  • 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();
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sumitchatterjee13/tavily-cursor-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server