Skip to main content
Glama

refund_credits

Refund or reverse credits. MOVES MONEY for purchases: with purchase_id or stripe_payment_intent_id it refunds the Stripe charge (prorated when partial; refund_payment: false skips the money) and claws the purchased credits back. With transaction_id (or reference_id = latest matching transaction) it reverses that ledger entry: an issue is clawed back, a deduct is returned to the user. Pass exactly one source. amount refunds part (default: all). idempotency_key is required here: retry with the same key to get the first result (idempotent_replay: true). Errors: 404 PURCHASE_NOT_FOUND / TRANSACTION_NOT_FOUND, 409 ALREADY_REFUNDED, 400 REFUND_EXCEEDS_ORIGINAL, 400 INSUFFICIENT_CREDITS (user already spent them), 400 NOT_REFUNDABLE (redeem/escrow entries), 402 STRIPE_REFUND_FAILED (no credits changed). Costs 1 CRD (platform credit) per call, charged even when the call is then rejected (a 429 RATE_LIMITED costs nothing). Error results include request_id; quote it to support.

Input Schema

NameRequiredDescriptionDefault
amountNoCredits to refund (default: the full original amount)
reasonNoReason, shown in the ledger
api_keyNoCred API key (optional if set via the x-api-key header)
metadataNoExtra metadata stored on the refund transaction
project_idNoCred project ID (optional; the API key already identifies the project)
purchase_idNoCred purchase ID (refunds the payment + credits)
reference_idNoReverse the latest non-refund transaction with this reference_id
x402_paymentNoBase64 x402 PaymentPayload, only when a previous call failed with an x402 PaymentRequired because the account is out of CRD
refund_paymentNoPurchases only: false reverses credits without refunding money (default true)
transaction_idNoLedger transaction ID to reverse
idempotency_keyYesUnique key for this refund (max 255 chars). Retrying with the same key and same arguments returns the first result instead of repeating it; reusing it for different arguments fails with 409 IDEMPOTENCY_KEY_REUSED. Generate a fresh key (e.g. a UUID) per intended operation and reuse it only to retry that operation.
stripe_payment_intent_idNoStripe pi_… of the purchase (alternative to purchase_id)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.8/5.0
Behavior5/5

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

With no annotations supplied, the description carries the full burden and does so: it flags money movement in caps, discloses the 1 CRD per-call cost that is charged even on rejection (but not on 429), explains idempotent_replay semantics on retry, and enumerates the failure modes with status codes and their side effects (e.g. 402 STRIPE_REFUND_FAILED = no credits changed). This is exactly the behavioral context an agent needs before invoking a destructive billing operation.

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?

It is front-loaded with the highest-stakes information ('MOVES MONEY') and organized by mode, cost, and errors. The error-code run is dense but each entry adds actionable signal rather than padding; a slightly tighter grouping of the 404/409/400 family would improve scanability.

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

Completeness5/5

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

For a 12-parameter, high-risk financial tool with no annotations and no output schema, the description covers purpose, source selection, cost, idempotency, and error recovery including quoting request_id to support. Nothing an agent needs to call this correctly or interpret a failure is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description adds meaning the schema cannot express: the mutual-exclusivity constraint on source parameters, the 'default: all' semantics of amount, and the clarification that reference_id targets the latest matching transaction. Minor gap: reason, metadata, project_id, api_key, and x402_payment are left entirely to their schema descriptions.

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 opening 'Refund or reverse credits' pairs a specific verb with the resource, and the following sentences enumerate the two distinct modes (purchase refund vs. ledger reversal) with the exact parameters that select each. An agent can distinguish this from sibling mutators like deduct_credits, issue_credits, and redeem_credits without opening any 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?

The description states the selection rule outright: 'Pass exactly one source,' then explains what each source does (purchase_id/stripe_payment_intent_id refunds the Stripe charge; transaction_id/reference_id reverses a ledger entry). It also specifies the exclusion behavior for reference_id ('latest matching transaction') and the partial-refund mode via amount, leaving no ambiguity about when to pick which path.

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