Skip to main content
Glama

refund_leg

Reclaim your funded swap leg once its timelock expires and the counterparty has not claimed it, signing with your own key. Returns the on-chain transaction ID.

Instructions

AUTONOMOUS SETTLEMENT: take back YOUR funded leg after its timelock has passed and the counterparty never claimed it, signing with the agent's own key. Works on every rail — EVM and TRON call the escrow, Solana and Bitcoin sign a transaction the server builds. On Bitcoin a node also rejects it until the chain's MEDIAN TIME PAST has passed the timelock, which trails real time by roughly an hour. Each rail sends the money where it was agreed it would go: the leg's refund address on Bitcoin and Solana, and on EVM and TRON the wallet that funded the escrow — the agent's own key. Returns the on-chain tx id.

Input Schema

NameRequiredDescriptionDefault
swap_idYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.10.0

TDQS

A4.3/5.0
Behavior5/5

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

With no annotations, the description carries the full behavioral burden and does so well: it explains signing with the agent's own key, rail-specific mechanics for EVM, TRON, Solana, and Bitcoin, the Bitcoin MTP delay, payout destinations per rail, and that it returns the on-chain tx id.

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 dense but front-loaded, starting with the operation and conditions, then adding rail-specific behavior and return value. Every sentence adds useful operational detail without repetition.

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 complex cross-rail settlement tool with no annotations and no output schema, the description is strong on behavior, timing, signing, destination, and return value. The main remaining gap is that it does not document the swap_id parameter.

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

Parameters2/5

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

The schema has only swap_id with 0% description coverage, and the description never explains what swap_id represents or how to obtain it. The parameter name is fairly self-evident, but the description does not compensate for the schema coverage gap.

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 states a specific verb and resource: take back a funded leg after its timelock has passed when the counterparty never claimed it. It clearly distinguishes refunding from claiming and gives enough detail to identify the operation without opening the schema.

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?

It clearly states the triggering conditions: timelock passed and counterparty never claimed. It does not explicitly name sibling alternatives like claim_leg or state when not to use it, but the context is clear enough for correct selection.

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