Skip to main content
Glama

purchase_product

Purchase digital products on the402.ai marketplace using pre-funded USDC balance. Complete transactions for AI services and access purchased items via download.

Instructions

Purchase a digital product on the402.ai. Payment is deducted from your pre-funded balance. After purchase, use list_purchases to find the product and download it. Requires API key.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
product_idYesThe product ID to purchase

Implementation Reference

  • The handler function for the "purchase_product" tool, which triggers a POST request to purchase a digital product.
    async ({ product_id }) => {
    	const result = await client.balancePost(
    		`/v1/products/${product_id}/purchase`
    	);
    	return {
    		content: [
    			{ type: "text" as const, text: JSON.stringify(result, null, 2) },
    		],
    	};
    }
  • Registration of the "purchase_product" tool within the MCP server.
    server.tool(
    	"purchase_product",
    	"Purchase a digital product on the402.ai. Payment is deducted from your pre-funded balance. After purchase, use list_purchases to find the product and download it. Requires API key.",
    	{
    		product_id: z.string().describe("The product ID to purchase"),
    	},
    	async ({ product_id }) => {
    		const result = await client.balancePost(
    			`/v1/products/${product_id}/purchase`
    		);
    		return {
    			content: [
    				{ type: "text" as const, text: JSON.stringify(result, null, 2) },
    			],
    		};
    	}
    );

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/the402ai/mcp-server'

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