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) },
    			],
    		};
    	}
    );
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 of behavioral disclosure and does this well. It explains the async job creation, conversation thread creation, payment deduction from pre-funded balance, immediate vs asynchronous result delivery based on service type, and authentication requirement ('Requires API key'). It doesn't mention rate limits or error conditions, but covers most key behavioral aspects.

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 efficiently structured with four sentences that each earn their place: states the core action, explains the process flow, describes different service type behaviors, and notes authentication requirement. It's front-loaded with the main purpose and contains zero wasted words.

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?

Given the complexity of a purchase tool with no annotations and no output schema, the description does a good job covering key aspects: purpose, process flow, payment mechanism, service type variations, and authentication. It could benefit from mentioning what the tool returns (e.g., job ID, thread ID) or error conditions, but it's reasonably complete for the context.

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 baseline is 3. The description doesn't add significant meaning beyond what the schema already provides for the two parameters. It mentions that the brief 'must include all required fields defined in the service's input_schema' which slightly elaborates on the schema's description, but this is minimal additional value.

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 fixed-price service') and resource ('on the402.ai'), distinguishing it from sibling tools like purchase_product (which likely purchases products rather than services) or create_service (which creates rather than purchases services). The description provides concrete details about what the tool does beyond just the name.

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 ('Purchase a fixed-price service') and mentions different service types (data_api vs automated/human services) with their respective behaviors. However, it doesn't explicitly state when NOT to use this tool or name specific alternatives among the many sibling tools, though the distinction from purchase_product is implied.

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