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) },
    			],
    		};
    	}
    );
Behavior4/5

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

With no annotations provided, the description carries the full burden and does well by disclosing key behavioral traits: payment method (deducted from pre-funded balance), post-purchase workflow (use list_purchases to find/download), and authentication requirement (requires API key). It doesn't mention rate limits or error conditions, but covers essential operational context.

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?

Three tightly focused sentences with zero waste: first states the core action, second explains payment mechanics, third provides post-purchase guidance and authentication requirement. Every sentence earns its place by adding distinct value.

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

Completeness4/5

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

For a single-parameter mutation tool with no annotations and no output schema, the description provides good coverage of the operation's purpose, payment mechanism, and workflow. It could be more complete by mentioning potential error cases or return values, but covers the essential context well given the tool's complexity.

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?

With 100% schema description coverage, the schema already fully documents the single 'product_id' parameter. The description doesn't add any additional parameter semantics beyond what's in the schema, so it meets the baseline expectation for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Purchase a digital product') and resource ('on the402.ai'), distinguishing it from siblings like 'purchase_service' or 'browse_products'. It specifies the exact nature of the transaction (digital product purchase with pre-funded balance).

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

Usage Guidelines4/5

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

The description provides clear context about when to use this tool (for purchasing digital products) and mentions a related tool ('list_purchases') for post-purchase actions. However, it doesn't explicitly contrast when to use this versus alternatives like 'purchase_service' or 'subscribe_to_plan'.

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

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