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"],
      },
    },
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'comprehensive information' but does not specify what that entails (e.g., format, sources, pagination, rate limits, or permissions). This is a significant gap for a search tool with no structured safety or operational hints.

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 description is a single, efficient sentence that is front-loaded with the core purpose. However, it could be more structured by explicitly mentioning the parameters or usage context, but it avoids unnecessary verbosity.

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 complexity of a search tool with no annotations and no output schema, the description is incomplete. It does not explain what the tool returns (e.g., results format, limitations) or behavioral traits like error handling. This leaves critical gaps for an agent to use the tool effectively.

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?

Schema description coverage is 100%, so the schema already documents both parameters ('query' and 'detail_level') with descriptions and an enum. The description adds no additional meaning beyond what the schema provides, such as examples or context for the 'detail_level' options. Baseline 3 is appropriate when the schema does the heavy lifting.

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

Purpose3/5

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

The description states the tool 'perform[s] a general search query to get comprehensive information on any topic', which provides a clear verb ('perform') and resource ('search query'), but it is vague about what type of information or sources are searched. It does not distinguish from siblings like 'find_apis' or 'get_documentation', leaving ambiguity about scope.

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?

The description offers no guidance on when to use this tool versus alternatives such as 'chat_perplexity' or 'find_apis'. It implies a broad context ('any topic') but lacks explicit when/when-not instructions or prerequisites, leaving the agent to guess based on tool names alone.

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

Install Server

Other Tools

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/rileyedwards77/perplexity-mcp-server'

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