Skip to main content
Glama
Vanshika-Rana

Payman AI Documentation MCP Server

get-documentation

Retrieve PaymanAI documentation on specific topics like API reference, setup, payments, and error handling to support developer integrations.

Instructions

Get PaymanAI documentation on a specific topic

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
topicYesThe documentation topic to retrieve

Implementation Reference

  • The handler function fetches the documentation content for the specified topic using a mapped path, caches it, appends related topics suggestions, and returns it as markdown text content.
    async ({ topic }) => { const path = pathMap[topic]; log(`Getting doc for topic: ${topic}, path: ${path}`); const docContent = await fetchDocMarkdown(path); const relatedTopics = topicMetadata[topic].relatedTopics; const relatedTopicsText = relatedTopics.length > 0 ? `\n\n## Related Topics\n\n${relatedTopics .map( (t) => `- ${topicMetadata[t].title} (use get-documentation with topic "${t}")` ) .join("\n")}` : ""; return { content: [ { type: "text", text: docContent + relatedTopicsText, }, ], }; }
  • Zod schema for input parameters, validating 'topic' against the predefined enum of documentation topics.
    { topic: z .enum(docTopics) .describe("The documentation topic to retrieve"), },
  • src/index.ts:136-169 (registration)
    Registers the 'get-documentation' tool with the MCP server using server.tool(), including name, description, input schema, and handler function.
    server.tool( "get-documentation", "Get PaymanAI documentation on a specific topic", { topic: z .enum(docTopics) .describe("The documentation topic to retrieve"), }, async ({ topic }) => { const path = pathMap[topic]; log(`Getting doc for topic: ${topic}, path: ${path}`); const docContent = await fetchDocMarkdown(path); const relatedTopics = topicMetadata[topic].relatedTopics; const relatedTopicsText = relatedTopics.length > 0 ? `\n\n## Related Topics\n\n${relatedTopics .map( (t) => `- ${topicMetadata[t].title} (use get-documentation with topic "${t}")` ) .join("\n")}` : ""; return { content: [ { type: "text", text: docContent + relatedTopicsText, }, ], }; } );
  • Helper function to fetch and cache documentation markdown from the PaymanAI docs site via HTTP, with 1-hour TTL caching.
    async function fetchDocMarkdown(path: string): Promise<string> { const now = Date.now(); const cachedDoc = documentCache.get(path); if (cachedDoc && now - cachedDoc.timestamp < CACHE_TTL) { log(`Using cached content for: ${path}`); return cachedDoc.content; } try { const url = `https://docs.paymanai.com${path}.md`; log(`Fetching: ${url}`); const response = await fetch(url); if (!response.ok) { throw new Error(`Failed to fetch: ${response.status}`); } const content = await response.text(); documentCache.set(path, { content, timestamp: now }); return content; } catch (error) { log(`Error fetching documentation: ${error}`); return `Documentation content not available for path: ${path}.md\nError: ${ error instanceof Error ? error.message : String(error) }`; } }
  • Metadata map providing titles and related topics for each documentation topic, used to generate suggestions in the handler.
    const topicMetadata: Record< string, { title: string; relatedTopics: string[]; } > = { quickstart: { title: "Quickstart Guide", relatedTopics: ["setup-and-installation", "api-keys"], }, playground: { title: "API Playground", relatedTopics: ["api-reference", "api-keys"], }, "setup-and-installation": { title: "Setup and Installation", relatedTopics: ["api-keys", "quickstart"], }, "create-payees": { title: "Create Payees", relatedTopics: ["create-payee", "search-payees"], }, "send-payments": { title: "Send Payments", relatedTopics: ["check-balances", "create-payees"], }, "create-payee": { title: "Create Payee", relatedTopics: ["create-payees", "search-payees"], }, "search-payees": { title: "Search Payees", relatedTopics: ["create-payee", "create-payees"], }, "check-balances": { title: "Check Balances", relatedTopics: ["send-payments"], }, "bill-payment-agent": { title: "Bill Payment Agent", relatedTopics: ["send-payments"], }, "api-reference": { title: "API Reference", relatedTopics: ["error-handling", "api-keys"], }, "api-keys": { title: "API Keys", relatedTopics: ["api-reference", "setup-and-installation"], }, "error-handling": { title: "Error Handling", relatedTopics: ["api-reference"], }, };

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/Vanshika-Rana/payman-mcp-server'

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