Skip to main content
Glama
Jercik

Perplexity Agent MCP

by Jercik

lookup

Fetch precise, source-backed facts from official documentation for API syntax, config keys, CLI flags, runtime compatibility, and package metadata.

Instructions

Fetch precise, source-backed facts from official sources. Use for API syntax/params, config keys/defaults, CLI flags, runtime compatibility, and package metadata (types, ESM/CJS, side-effects). Returns short, factual answers. No recommendations or comparisons.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesWhat fact to look up from docs

Implementation Reference

  • The asynchronous handler function for the 'lookup' tool. It takes a query, performs a chat completion using Perplexity's 'sonar-pro' model with the LOOKUP_SYSTEM_PROMPT, and returns the result as text content.
    async ({ query }) => {
      const result = await performChatCompletion(
        [{ role: "user", content: query }],
        {
          model: "sonar-pro",
          system: LOOKUP_SYSTEM_PROMPT,
          searchContextSize: "medium",
        },
      );
      return { content: [{ type: "text", text: result }] };
    },
  • The schema definition for the 'lookup' tool, including description and inputSchema using Zod for the 'query' parameter.
        {
          description: `
    Fetches precise, source-backed facts from official sources.
    Use for API syntax/params, config keys/defaults, CLI flags, runtime compatibility, and package metadata (types, ESM/CJS, side-effects).
    Returns short, factual answers. No recommendations or comparisons.
    Examples: "What's the default timeout for fetch()?", "What parameters does useState accept?", "Show me how Zod validates email addresses"
    One question per call—split combined requests into separate queries.
    `.trim(),
          inputSchema: {
            query: z.string().describe("The documentation query to look up"),
          },
        },
  • The registerLookupTool function that registers the 'lookup' tool with the MCP server, including its schema and handler.
    export function registerLookupTool(server: McpServer) {
      server.registerTool(
        "lookup",
        {
          description: `
    Fetches precise, source-backed facts from official sources.
    Use for API syntax/params, config keys/defaults, CLI flags, runtime compatibility, and package metadata (types, ESM/CJS, side-effects).
    Returns short, factual answers. No recommendations or comparisons.
    Examples: "What's the default timeout for fetch()?", "What parameters does useState accept?", "Show me how Zod validates email addresses"
    One question per call—split combined requests into separate queries.
    `.trim(),
          inputSchema: {
            query: z.string().describe("The documentation query to look up"),
          },
        },
        async ({ query }) => {
          const result = await performChatCompletion(
            [{ role: "user", content: query }],
            {
              model: "sonar-pro",
              system: LOOKUP_SYSTEM_PROMPT,
              searchContextSize: "medium",
            },
          );
          return { content: [{ type: "text", text: result }] };
        },
      );
    }
  • src/server.ts:17-17 (registration)
    The call to register the 'lookup' tool during server setup.
    registerLookupTool(server);
  • The system prompt used by the 'lookup' tool handler for guiding fact extraction from sources.
    export const LOOKUP_SYSTEM_PROMPT = `
    # Role: Fact Extraction Agent
    Extract precise, verifiable facts from source code and documentation. Optimized for quick lookups of:
    - API signatures and parameter types
    - Configuration keys and default values
    - CLI flags and options
    - Package metadata (versions, exports, compatibility)
    - Exact error messages and codes
    
    # Instructions
    - Search GitHub source code FIRST - find the exact line where something is defined/used
    - Return the specific fact requested, nothing more
    - Include file path and line numbers when citing code
    - State "Not found in available sources" if information doesn't exist
    - Avoid explanations unless the fact itself is ambiguous
    
    ${AUTHORITATIVE_SOURCES}
    
    # Output Format
    - Direct answer with source citation: "The default value is X [repo/file.ts:123]"
    - For code usage: Show the exact line(s) from source
    - For missing info: "Not found in available sources"
    - No preamble, no "Based on my search...", just the fact
    `.trim();
Behavior4/5

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

With no annotations provided, the description carries the full burden and does well by disclosing key behavioral traits: it fetches from official sources, returns short factual answers, and avoids recommendations/comparisons. It doesn't mention rate limits, authentication needs, or error handling, but provides solid operational context.

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

Conciseness5/5

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

The description is perfectly concise with three sentences that each earn their place: first states purpose, second specifies use cases, third clarifies return behavior and exclusions. No wasted words, front-loaded with core functionality.

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

Completeness4/5

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

Given the single parameter with full schema coverage and no output schema, the description provides excellent context about what the tool does, when to use it, and what to expect. It could benefit from mentioning response format or error cases, but covers the essential operational context well.

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% with the single parameter 'query' well-documented in the schema. The description adds minimal value beyond the schema by implying the query should be factual lookups, but doesn't provide additional syntax or format details. Baseline 3 is appropriate when schema does the heavy lifting.

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

Purpose5/5

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

The description clearly states the tool's purpose with specific verbs ('fetch precise, source-backed facts') and resources ('from official sources'), and distinguishes it from its sibling 'answer' by specifying it returns short factual answers without recommendations or comparisons.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool ('for API syntax/params, config keys/defaults, CLI flags, runtime compatibility, and package metadata') and when not to use it ('No recommendations or comparisons'), clearly differentiating it from the 'answer' sibling tool.

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/Jercik/perplexity-agent-mcp'

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