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

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states it 'gets' documentation, implying a read-only operation, but doesn't specify if this requires authentication, returns structured data or raw text, or has any rate limits. The description is minimal and lacks crucial operational details.

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, clear sentence with no wasted words. It's appropriately sized for a simple tool and front-loads the core purpose effectively.

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. It doesn't explain what the tool returns (e.g., documentation text, links, or structured data), nor does it address authentication needs or error handling. For a tool with one parameter but unknown behavioral traits, this leaves significant gaps.

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 parameter 'topic' fully documented in the schema including its enum values. The description adds no additional parameter semantics beyond what the schema provides, such as explaining the topic categories or usage examples. Baseline 3 is appropriate given 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 verb 'Get' and resource 'PaymanAI documentation on a specific topic', making the purpose understandable. However, it doesn't distinguish this tool from sibling tools like 'search-documentation' or 'get-code-examples', which likely serve related but different purposes.

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 like 'search-documentation' or 'get-code-examples'. It mentions retrieving documentation on a 'specific topic', but doesn't clarify if this is for known topics only (as indicated by the enum) versus broader searches.

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

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