Skip to main content
Glama

fund_leg

Fund your side of an agreed cross-chain swap on-chain with the agent's own key by approving and locking tokens in the HTLC, paying P2WSH, or signing the escrow transaction.

Instructions

AUTONOMOUS SETTLEMENT: fund YOUR side of an agreed swap on-chain, signing with the agent's own key (HASHLOCK_EVM_KEY / TRON / BTC / SOLANA for that leg's chain). Funds the leg you give — approves the token (EVM/TRON) and locks it in the HTLC, pays the P2WSH (BTC), or signs the escrow transaction the server builds (Solana). Prerequisites: the deal is agreed and BOTH parties have set their settlement addresses (set_settlement_address). Returns the on-chain tx id. Fund your long leg first if you are the initiator.

Input Schema

NameRequiredDescriptionDefault
swap_idYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.10.0

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations, the description carries the full load and does well: it discloses that the agent signs with its own per-chain key, enumerates the exact on-chain action per chain, states the return value (on-chain tx id), and lists prerequisites including a cross-party dependency. It omits irreversibility/failure handling and what happens if only one side is funded.

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 and the per-chain mechanics packed efficiently into one paragraph; the trailing initiator-ordering hint is well placed. It is dense but nearly every clause carries operational information, with only the 'AUTONOMOUS SETTLEMENT' label adding little.

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-chain, key-signing mutation with no annotations and no output schema, the description covers signing keys, per-chain behavior, prerequisites, ordering, and the return value. Remaining gaps (failure modes, irreversibility, gas/fee handling) are real but secondary for correct invocation.

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 coverage is 0% on a single required swap_id, and the description never explains that parameter — it only indirectly implies it via 'the deal is agreed'. Worse, 'Funds the leg you give' and 'that leg's chain' suggest a leg selector that does not exist in the schema, which could mislead an agent about what it must supply.

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 and resource ('fund YOUR side of an agreed swap on-chain') plus the exact per-chain mechanism (approve+HTLC lock on EVM/TRON, P2WSH payment on BTC, escrow signing on Solana). It is clearly distinguishable from the sibling settlement verbs refund_leg and claim_leg, which act on the counterparty/recovery side.

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 explicit preconditions (deal agreed, both parties have called set_settlement_address) and an ordering rule ('fund your long leg first if you are the initiator'). It does not explicitly say when to prefer claim_leg/refund_leg instead, but the sequencing and prerequisite context is strong enough that an agent knows when this tool applies.

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