Skip to main content
Glama
PaymanAI

Payman Documentation MCP Server

Official
by PaymanAI

get-documentation

Retrieve PaymanAI documentation on specific topics like API reference, setup, or error handling to streamline developer integrations and workflows.

Instructions

Get PaymanAI documentation on a specific topic

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
topicYesThe documentation topic to retrieve

Implementation Reference

  • Handler function that retrieves documentation for the specified topic by fetching Markdown content from a mapped path, caching it, and appending related topics information.
    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,
    			},
    		],
    	};
    }
  • Input schema for the tool, defining the 'topic' parameter as a Zod enum based on predefined docTopics.
    {
    	topic: z
    		.enum(docTopics)
    		.describe("The documentation topic to retrieve"),
    },
  • src/index.ts:136-169 (registration)
    Registration of the 'get-documentation' tool on the MCP server, 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 Markdown documentation from PaymanAI docs site.
    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)
    		}`;
    	}
    }
  • Mapping of topics to their corresponding documentation path suffixes used in the handler.
    const pathMap: Record<string, string> = {
    	quickstart: "/overview/quickstart",
    	playground: "/overview/playground",
    	"setup-and-installation": "/sdks/setup-and-installation",
    	"create-payees": "/sdks/create-payees",
    	"send-payments": "/sdks/send-payments",
    	"create-payee": "/sdks/create-payee",
    	"search-payees": "/sdks/search-payees",
    	"check-balances": "/sdks/check-balances",
    	"bill-payment-agent": "/guides/bill-payment-agent",
    	"api-reference": "/api-reference/introduction",
    	"api-keys": "/api-reference/get-api-key",
    	"error-handling": "/api-reference/error-handling",
    };

Tool Definition Quality

Score is being calculated. Check back soon.

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/PaymanAI/payman-doc-mcp-server'

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