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"],
    	},
    };

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

C2.9/5.0
Behavior2/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 of behavioral disclosure. It states what the tool does but lacks critical details: it doesn't specify if this is a read-only operation, what format the documentation is returned in (e.g., text, HTML, markdown), whether there are rate limits, or if authentication is required. For a tool with no annotation coverage, this is a significant gap in transparency.

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 a single, efficient sentence that front-loads the core purpose without any wasted words. It's appropriately sized for a simple tool with one parameter, making it easy to parse and understand quickly.

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

Completeness2/5

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

Given no annotations and no output schema, the description is incomplete for a documentation retrieval tool. It doesn't explain what is returned (e.g., content format, structure, or errors), lacks behavioral context like read-only nature or authentication needs, and doesn't differentiate from siblings. For a tool with 100% schema coverage but missing output and annotation context, it should provide more usage and behavioral details.

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 'topic' fully documented in the schema including an enum list. The description adds no additional parameter semantics beyond implying retrieval based on a topic, which is already covered by the schema. This meets the baseline of 3 when the schema does the heavy lifting.

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 action ('Get') and resource ('PaymanAI documentation on a specific topic'), making the purpose immediately understandable. It distinguishes from siblings like 'search-documentation' by specifying retrieval of documentation rather than searching, though it doesn't explicitly contrast with 'get-code-examples' or 'get-sdk-help' which might overlap in retrieving documentation-related content.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'search-documentation' and 'get-code-examples', it's unclear if this tool is for structured topic retrieval while others handle queries or examples. No exclusions or prerequisites are mentioned, leaving usage context ambiguous.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.