Skip to main content
Glama
rileyedwards77

Perplexity AI MCP Server

search

Perform general search queries to obtain comprehensive information on any topic, with adjustable detail levels for tailored results.

Instructions

Perform a general search query to get comprehensive information on any topic

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesThe search query or question
detail_levelNoOptional: Desired level of detail (brief, normal, detailed)

Implementation Reference

  • Handler implementation for the 'search' tool. Performs a GET request to Perplexity's /search endpoint with the query and detail_level, returns the JSON response as text content.
    case "search": {
        const { query, detail_level = "normal" } = request.params.arguments;
        const response = yield this.axiosInstance.get(`/search?q=${query}&details=${detail_level}`);
        return {
            content: [
                {
                    type: "text",
                    text: JSON.stringify(response.data, null, 2),
                },
            ],
        };
    }
  • Schema definition for the 'search' tool, including name, description, and input schema with required 'query' and optional 'detail_level'.
    {
        name: "search",
        description: "Perform a general search query to get comprehensive information on any topic",
        inputSchema: {
            type: "object",
            properties: {
                query: {
                    type: "string",
                    description: "The search query or question",
                },
                detail_level: {
                    type: "string",
                    description: "Optional: Desired level of detail (brief, normal, detailed)",
                    enum: ["brief", "normal", "detailed"],
                },
            },
            required: ["query"],
        },
    },
  • Advanced handler for the 'search' tool using Perplexity's /chat/completions endpoint. Selects model based on detail_level, uses custom system prompt optimized for AI assistants, logs request/response.
    case "search": {
      const { query, detail_level = "normal" } =
        request.params.arguments as {
          query: string;
          detail_level?: string;
        };
    
      // Map detail level to model
      const model = detail_level === "detailed" ? "sonar-reasoning-pro" :  // Most expensive, best reasoning
                  detail_level === "brief" ? "sonar" :                     // Basic, cheapest at $1/$1
                  "sonar-reasoning";                                       // Middle ground at $1/$5
      
      // System prompt optimized for Claude
      const systemPrompt = `You are providing search results to Claude, an AI assistant.
      Skip unnecessary explanations - Claude can interpret and explain the data itself.`;
      
      // Call Perplexity API
      // Note: max_tokens could be increased for detailed responses, but consider cost implications
      // sonar-reasoning-pro can use >1000 tokens and does multiple searches
      console.error('Sending request:', JSON.stringify({
        model,
        messages: [
          { role: "system", content: systemPrompt },
          { role: "user", content: query }
        ],
        max_tokens: 1000,
        temperature: 0.2,
        top_p: 0.9
      }, null, 2));
      const response = await this.axiosInstance.post('/chat/completions', {
        model,
        messages: [
          { role: "system", content: systemPrompt },
          { role: "user", content: query }
        ],
        max_tokens: 1000,
        temperature: 0.2,
        top_p: 0.9
      });
      console.error('Got response:', response.data);
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(response.data, null, 2),
          },
        ],
      };
    }
  • Schema definition for the 'search' tool, matching the JS version, defining input parameters for query and optional detail_level.
    {
      name: "search",
      description:
        "Perform a general search query to get comprehensive information on any topic",
      inputSchema: {
        type: "object",
        properties: {
          query: {
            type: "string",
            description: "The search query or question",
          },
          detail_level: {
            type: "string",
            description:
              "Optional: Desired level of detail (brief, normal, detailed)",
            enum: ["brief", "normal", "detailed"],
          },
        },
        required: ["query"],
      },
    },

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of disclosing behavioral traits. It only promises 'comprehensive information' without noting whether the tool is read-only, what data source it accesses, whether it has rate limits, or what the response format looks like.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The one-sentence description is efficient and front-loaded with the verb and resource. It contains no filler, though its brevity limits the amount of actionable guidance.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simple schema and lack of an output schema, the description still leaves important gaps: it does not explain what kind of results are returned, when this tool should be preferred over sibling tools, or how the optional detail_level affects behavior.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema already documents both parameters with descriptions, giving 100% coverage. The description adds only generic context ('any topic') and does not enrich the meaning of the parameters beyond what the schema provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a clear action ('Perform a general search query') and resource ('search') to gather information. However, it does not differentiate this from sibling tools like get_documentation or find_apis, so it stops short of full clarity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to choose this tool over alternatives. The phrase 'any topic' is extremely broad and gives no context or exclusions, leaving the agent without direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.