Skip to main content
Glama

reason

Analyzes complex queries using reasoning models to provide detailed explanations, comparisons, and step-by-step problem-solving solutions.

Instructions

Handles complex, multi-step tasks using Perplexity's Sonar Reasoning Pro model. Best for explanations, comparisons, and problem-solving.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesThe complex query or task to reason about. IMPORTANT: Be extremely specific and include all relevant details: - Include exact error messages, logs, and stack traces if applicable - Provide exact terminology, function names, API names, version numbers - Include relevant code snippets showing the problem or context - Specify platform, OS, framework versions, and environment details - Mention any attempted solutions or workarounds - Provide context about what you're trying to achieve - Include relevant data structures, configurations, or inputs The more specific details you include, the more accurate and helpful the answer will be. If you don't have enough specific information, prompt the user to provide it before using this tool.
force_modelNoOptional: Force using this model even if query seems simple/research-oriented

Implementation Reference

  • Handler logic for the 'reason' tool: sets the Perplexity model to 'sonar-reasoning-pro' and constructs a detailed multi-step reasoning prompt based on the input query.
    case "reason": { model = "sonar-reasoning-pro"; prompt = `You are answering a query that contains specific details like error messages, logs, code snippets, exact terminology, version numbers, and context. Carefully analyze all provided details to give the most accurate and helpful answer. Query: ${query} Provide a detailed explanation and analysis that: 1. Addresses the specific details provided (errors, logs, code, versions, etc.) 2. Includes step-by-step reasoning based on the actual context 3. Identifies key considerations relevant to the specific situation 4. Provides relevant examples matching the described scenario 5. Offers practical implications based on the exact details provided 6. Suggests potential alternatives or solutions tailored to the specific context`; break;
  • Input schema for the 'reason' tool, defining the 'query' parameter as required string and optional 'force_model' boolean.
    inputSchema: { type: "object", properties: { query: { type: "string", description: "The complex query or task to reason about. IMPORTANT: Be extremely specific and include all relevant details:\n- Include exact error messages, logs, and stack traces if applicable\n- Provide exact terminology, function names, API names, version numbers\n- Include relevant code snippets showing the problem or context\n- Specify platform, OS, framework versions, and environment details\n- Mention any attempted solutions or workarounds\n- Provide context about what you're trying to achieve\n- Include relevant data structures, configurations, or inputs\n\nThe more specific details you include, the more accurate and helpful the answer will be.\nIf you don't have enough specific information, prompt the user to provide it before using this tool." }, force_model: { type: "boolean", description: "Optional: Force using this model even if query seems simple/research-oriented", default: false } }, required: ["query"] }
  • src/index.ts:282-300 (registration)
    Registration of the 'reason' tool in the MCP server's listTools response, including name, description, and input schema.
    { name: "reason", description: "Handles complex, multi-step tasks using Perplexity's Sonar Reasoning Pro model. Best for explanations, comparisons, and problem-solving.", inputSchema: { type: "object", properties: { query: { type: "string", description: "The complex query or task to reason about. IMPORTANT: Be extremely specific and include all relevant details:\n- Include exact error messages, logs, and stack traces if applicable\n- Provide exact terminology, function names, API names, version numbers\n- Include relevant code snippets showing the problem or context\n- Specify platform, OS, framework versions, and environment details\n- Mention any attempted solutions or workarounds\n- Provide context about what you're trying to achieve\n- Include relevant data structures, configurations, or inputs\n\nThe more specific details you include, the more accurate and helpful the answer will be.\nIf you don't have enough specific information, prompt the user to provide it before using this tool." }, force_model: { type: "boolean", description: "Optional: Force using this model even if query seems simple/research-oriented", default: false } }, required: ["query"] } },

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

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