Skip to main content
Glama
wysh3

Perplexity MCP Server

get_documentation

Retrieve API, library, or technology documentation with usage examples and version details. Specify your query and context to access precise information for integration or troubleshooting.

Instructions

Automatically call this tool when working with unfamiliar APIs/libraries, needing usage examples, or checking version specifics as this can access web. Example: When adding a payment gateway, ask "Get Stripe API documentation for creating charges".

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contextNoAdditional context or specific aspects to focus on
queryYesThe technology, library, or API to get documentation for

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
responseNoThe raw text response from Perplexity containing documentation, examples, and potentially source URLs prefixed with "Official URL(s):". The calling agent should parse this text to extract URLs if needed for further processing.

Implementation Reference

  • The main handler function for the 'get_documentation' tool. It extracts the query and optional context from args, constructs a search prompt, calls the search engine, and returns the result.
    private async handleGetDocumentation(args: Record<string, unknown>): Promise<string> {
      const typedArgs = args as { query: string; context?: string };
      const searchResult = await this.searchEngine.performSearch(
        `Documentation for ${typedArgs.query}: ${typedArgs.context || ""}`,
      );
      return searchResult;
    }
  • JSON schema definition for the get_documentation tool, including description, input/output schemas, examples, and metadata.
      name: "get_documentation",
      description:
        'Automatically call this tool when working with unfamiliar APIs/libraries, needing usage examples, or checking version specifics as this can access web. Example: When adding a payment gateway, ask "Get Stripe API documentation for creating charges".',
      category: "Technical Reference",
      keywords: ["docs", "documentation", "api", "reference", "examples", "usage", "version"],
      use_cases: ["Learning new technologies", "API integration", "Troubleshooting code"],
      inputSchema: {
        type: "object",
        properties: {
          query: {
            type: "string",
            description: "The technology, library, or API to get documentation for",
            examples: ["React hooks", "Python pandas", "REST API best practices"],
          },
          context: {
            type: "string",
            description: "Additional context or specific aspects to focus on",
            examples: ["focus on performance optimization", "include TypeScript examples"],
          },
        },
        required: ["query"],
      },
      outputSchema: {
        type: "object",
        properties: {
          response: {
            type: "string",
            description:
              'The raw text response from Perplexity containing documentation, examples, and potentially source URLs prefixed with "Official URL(s):". The calling agent should parse this text to extract URLs if needed for further processing.',
          },
        },
      },
      examples: [
        {
          description: "Basic documentation request",
          input: { query: "React useEffect hook" },
          output: {
            response: "The useEffect hook lets you perform side effects in function components...",
          },
        },
      ],
      related_tools: ["search", "check_deprecated_code"],
    },
  • Registers all tool handlers, including get_documentation, with the MCP server using the setupToolHandlers function.
    private setupToolHandlers(): void {
      const toolHandlers = createToolHandlersRegistry({
        chat_perplexity: this.handleChatPerplexity.bind(this),
        get_documentation: this.handleGetDocumentation.bind(this),
        find_apis: this.handleFindApis.bind(this),
        check_deprecated_code: this.handleCheckDeprecatedCode.bind(this),
        search: this.handleSearch.bind(this),
        extract_url_content: this.handleExtractUrlContent.bind(this),
      });
    
      setupToolHandlers(this.server, toolHandlers);
    }
  • TypeScript interface defining the input arguments for the get_documentation tool.
    export interface GetDocumentationArgs {
      query: string;
      context?: string;
    }
  • Detailed helper function for generating documentation prompts and performing search, matching the tool's intended comprehensive output. Potentially an alternative or modular implementation.
    export default async function getDocumentation(
      args: { query: string; context?: string },
      ctx: PuppeteerContext,
      performSearch: (prompt: string, ctx: PuppeteerContext) => Promise<string>,
    ): Promise<string> {
      const { query, context = "" } = args;
      const prompt = `Provide comprehensive documentation and usage examples for ${query}. ${
        context ? `Focus on: ${context}` : ""
      } Include:
    1. Basic overview and purpose
    2. Key features and capabilities
    3. Installation/setup if applicable
    4. Common usage examples with code snippets
    5. Best practices and performance considerations
    6. Common pitfalls to avoid
    7. Version compatibility information
    8. Links to official documentation
    9. Community resources (forums, chat channels)
    10. Related tools/libraries that work well with it
    
    Crucially, also provide the main official URL(s) for this documentation on separate lines, prefixed with 'Official URL(s):'.`;
      return await performSearch(prompt, ctx);
    }
Behavior3/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. It discloses that the tool 'can access web,' which is a useful behavioral trait. However, it doesn't mention other important aspects like rate limits, authentication needs, response format, or potential costs. The description adds some value but leaves significant behavioral gaps uncovered.

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 appropriately sized with two sentences. The first sentence front-loads the purpose and usage guidelines, and the second provides a concrete example. There's minimal waste, though the phrasing could be slightly more concise (e.g., 'Automatically call this tool' is redundant with the tool name).

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 tool's moderate complexity (2 parameters, no annotations, but has an output schema), the description is reasonably complete. It covers purpose and usage well, and the output schema exists, so the description doesn't need to explain return values. However, it lacks details on behavioral traits like web access limitations or error handling, which would improve completeness.

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 'context') with descriptions and examples. The description doesn't add any parameter-specific semantics beyond what the schema provides. According to the rules, with high schema coverage, the baseline is 3 even with no param info in the description.

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 clearly states the tool's purpose: 'Automatically call this tool when working with unfamiliar APIs/libraries, needing usage examples, or checking version specifics as this can access web.' It specifies the verb ('get documentation') and resource ('APIs/libraries'), but doesn't explicitly differentiate from sibling tools like 'find_apis' or 'search' which might have overlapping functionality.

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 usage guidelines: 'when working with unfamiliar APIs/libraries, needing usage examples, or checking version specifics.' It includes a concrete example ('When adding a payment gateway, ask "Get Stripe API documentation for creating charges"') that illustrates when to use this tool. No explicit alternatives are named, but the context is clear and actionable.

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

Related 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/wysh3/perplexity-mcp-zerver'

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