Skip to main content
Glama
trhonpavel
by trhonpavel

Refund payment

refund_payment
Destructive

Refund money to a customer through the payment provider for an order. Confirm the amount first; this action is irreversible and uses a captured payment when no payment ID is given.

Instructions

REFUNDS money to the customer through the payment provider. Irreversible – confirm the amount with the user before calling. Without 'payment_id' uses the only captured payment that can cover the amount. Refund reasons are listed by get_store_info.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
noteNo
orderYesOrder ID or order number
amountYesMajor units, e.g. 249.50
payment_idNo
refund_reason_idNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.3.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already flag destructiveHint=true and idempotentHint=false, so the safety profile is covered; the description reinforces this with 'Irreversible' and adds genuine context beyond the annotations: the automatic payment-selection behavior when payment_id is absent. It does not disclose what the call returns or whether partial refunds against a payment are constrained.

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 short sentences, each earning its place: the destructive/confirmation warning is front-loaded, followed by the default-resolution rule and the value-source pointer. Zero filler.

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 destructive mutation with no output schema, the description covers irreversibility, a user-confirmation requirement, parameter defaulting, and reason-code lookup. Only the response shape and any refund-eligibility constraints are left implicit.

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 only 40%, so the description must compensate, and it does for the two undocumented functional params: payment_id's defaulting behavior and where refund_reason_id values come from (get_store_info). The 'note' param remains unexplained in both schema and description.

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 (refunds), the resource (money/customer payment) and the mechanism (through the payment provider). It is unambiguously distinct from siblings like capture_payment, cancel_order, or create_return, with no overlap.

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?

Gives concrete pre-call guidance ('confirm the amount with the user') and an explicit fallback rule for when payment_id is omitted. It also routes the agent to get_store_info for valid refund reasons. It stops short of naming alternative tools for adjacent scenarios (e.g., when a refund is not possible and a return/cancel is appropriate).

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