Skip to main content
Glama
Jercik

Perplexity Agent MCP

by Jercik

answer

Research complex technical questions, compare options, and provide evidence-based recommendations with implementation steps for architecture decisions, migrations, and debugging.

Instructions

Research a question, compare options, and recommend a path (backed by sources). Use for library choices, architecture trade-offs, migrations, complex debugging, and performance decisions. Returns a concise recommendation, a brief why, and short how-to steps.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
questionYesThe decision or problem to answer

Implementation Reference

  • The handler function for the 'answer' tool. It takes a question, performs a chat completion using Perplexity's sonar-reasoning-pro model with the ANSWER_SYSTEM_PROMPT, and returns the result as text content.
    async ({ question }) => {
      const result = await performChatCompletion(
        [{ role: "user", content: question }],
        {
          model: "sonar-reasoning-pro",
          system: ANSWER_SYSTEM_PROMPT,
          searchContextSize: "high",
        },
      );
      return { content: [{ type: "text", text: result }] };
    },
  • Tool schema definition including description and inputSchema with 'question' parameter using Zod validation.
        {
          description: `
    Researches a question, compares options, and recommends a path (backed by sources).
    Use for library choices, architecture trade-offs, migrations, complex debugging, and performance decisions.
    Returns a concise recommendation, a brief why, and short how-to steps.
    Examples: "Should I use Zod or Valibot?", "How to optimize React bundle size?", "Best auth approach for Node.js microservices?"
    One question per call—split combined requests into separate queries.
    `.trim(),
          inputSchema: {
            question: z.string().describe("The decision or problem to answer"),
          },
        },
  • The server.registerTool call within registerAnswerTool that performs the actual MCP tool registration for 'answer'.
      server.registerTool(
        "answer",
        {
          description: `
    Researches a question, compares options, and recommends a path (backed by sources).
    Use for library choices, architecture trade-offs, migrations, complex debugging, and performance decisions.
    Returns a concise recommendation, a brief why, and short how-to steps.
    Examples: "Should I use Zod or Valibot?", "How to optimize React bundle size?", "Best auth approach for Node.js microservices?"
    One question per call—split combined requests into separate queries.
    `.trim(),
          inputSchema: {
            question: z.string().describe("The decision or problem to answer"),
          },
        },
        async ({ question }) => {
          const result = await performChatCompletion(
            [{ role: "user", content: question }],
            {
              model: "sonar-reasoning-pro",
              system: ANSWER_SYSTEM_PROMPT,
              searchContextSize: "high",
            },
          );
          return { content: [{ type: "text", text: result }] };
        },
      );
  • src/server.ts:17-18 (registration)
    Invocation of registerAnswerTool during MCP server creation to register the 'answer' tool.
    registerLookupTool(server);
    registerAnswerTool(server);
  • The system prompt used in the 'answer' tool handler for guiding the AI in technical decision making.
    export const ANSWER_SYSTEM_PROMPT = `
    # Role: Technical Decision & Analysis Agent
    Research complex questions, compare approaches, and provide actionable recommendations. Optimized for:
    - Architecture decisions and design patterns
    - Library/framework selection and migration paths
    - Performance optimization strategies
    - Debugging complex issues across systems
    - Best practices and trade-off analysis
    
    # Instructions
    - Start with a brief analysis plan (3-5 conceptual steps) to structure your research
    - Search multiple sources to compare different approaches
    - Analyze real-world usage patterns in popular repositories
    - Weigh trade-offs based on the user's specific constraints
    - Provide a decisive recommendation with clear justification
    
    # Output Structure
    - **Recommendation:** Your advised approach in 1-2 sentences
    - **Why:** Key reasons with evidence from source code or benchmarks
    - **Implementation:** Practical steps with working code example
    - **Trade-offs:** What you gain vs what you sacrifice
    - **Alternatives:** Other viable options if constraints change
    
    ${AUTHORITATIVE_SOURCES}
    
    # Guidance
    - Use modern ESM and TypeScript for examples by default, but adapt language and examples as appropriate to the question.
    - Be decisive in your conclusions, but transparent about any uncertainty.
    - Present only your final conclusions and justification—avoid extraneous commentary or process narration.
    `.trim();
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