Skip to main content
Glama

purchase_service

Purchase fixed-price services on the402.ai marketplace. Creates async jobs with payment from pre-funded balance, returning immediate results for data services or provider-fulfilled work for automated/human services.

Instructions

Purchase a fixed-price service on the402.ai. Creates an async job and conversation thread. Payment is deducted from your pre-funded balance. For data_api services, results are returned immediately. For automated/human services, the provider fulfills the work asynchronously. Requires API key.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
service_idYesThe service ID to purchase
briefYesDescription of what you need — must include all required fields defined in the service's input_schema

Implementation Reference

  • The registration and implementation handler for the 'purchase_service' tool.
    server.tool(
    	"purchase_service",
    	"Purchase a fixed-price service on the402.ai. Creates an async job and conversation thread. Payment is deducted from your pre-funded balance. For data_api services, results are returned immediately. For automated/human services, the provider fulfills the work asynchronously. Requires API key.",
    	{
    		service_id: z.string().describe("The service ID to purchase"),
    		brief: z
    			.string()
    			.describe(
    				"Description of what you need — must include all required fields defined in the service's input_schema"
    			),
    	},
    	async ({ service_id, brief }) => {
    		const result = await client.balancePost(
    			`/v1/services/${service_id}/purchase`,
    			{ brief }
    		);
    		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