Skip to main content
Glama

Purchase tool credits

commerce.purchase_credits

Verify an x402 payment and add per-use tool credits to the agent. MCP-native: call without payment for x402 requirements, then retry with _meta['x402/payment']. Legacy: PAYMENT-SIGNATURE + PAYMENT-REQUIRED after commerce.credits_requirements.

Input Schema

NameRequiredDescriptionDefault
creditsNoCredit pack size that was purchased. Must match the requirements call.
agent_idNoAgent identity to credit.
payment_requiredNoLegacy PAYMENT-REQUIRED from commerce.credits_requirements.
payment_signatureNoLegacy PAYMENT-SIGNATURE. Omit for MCP x402/payment transport.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changed
    • addedInput schema / properties / payment_required / default
      Added value: +null
    • changedInput schema / properties / payment_required / description
      Previous value: -"PAYMENT-REQUIRED JSON returned by commerce.credits_requirements."New value: +"Legacy PAYMENT-REQUIRED from commerce.credits_requirements."
    • addedInput schema / properties / payment_signature / default
      Added value: +null
    • changedInput schema / properties / payment_signature / description
      Previous value: -"PAYMENT-SIGNATURE from the credits USDC payment."New value: +"Legacy PAYMENT-SIGNATURE. Omit for MCP x402/payment transport."
    • removedInput schema / required
      Removed value: -[
      -  "payment_signature",
      -  "payment_required"
      -]
  2. Added

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnly=false, openWorld=true, idempotent=false, destructive=false, so the safety profile is covered. The description adds genuine behavioral context beyond that: the two-phase verify-then-retry payment flow and the transport-specific payment handoff. It does not discuss failure handling, reversibility, or what happens to credits on a failed verify.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core action in sentence one, followed by compact mode-specific routing. The second sentence is dense and jargon-heavy but every clause (MCP vs Legacy, ordering) carries operational meaning, so little is wasted.

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?

With an output schema present, return values need not be explained, and annotations carry the safety profile. The description covers the workflow and prerequisites adequately. It stops short of stating what a failed verification does to the agent's state, which for a purchase tool would be the remaining gap.

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?

Schema description coverage is 100%, so each of the four parameters is already documented in the schema (including 'Omit for MCP x402/payment transport'). The description references _meta['x402/payment'] and the legacy headers, loosely mapping to payment_signature/payment_required, but adds no syntax or format detail beyond the schema. Baseline 3 applies.

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?

States a specific verb+resource: 'Verify an x402 payment and add per-use tool credits to the agent.' It also names the sibling it depends on (commerce.credits_requirements), so an agent can separate the purchase step from the requirements step without opening either schema.

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

Usage Guidelines5/5

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

Gives explicit when-to-use guidance for two distinct modes: MCP-native ('call without payment for x402 requirements, then retry with _meta[x402/payment]') and Legacy ('PAYMENT-SIGNATURE + PAYMENT-REQUIRED after commerce.credits_requirements'). The prerequisite and sequencing are spelled out, not left to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources