Skip to main content
Glama

withdraw_htlc

Claim your side of a cross-chain swap by revealing the 32-byte secret preimage. Unlocks both legs of the atomic HTLC simultaneously without an intermediary.

Instructions

Atomic claim — reveals the 32-byte preimage to unlock both legs of the swap simultaneously. Trustless cross-chain finality: no intermediary holds funds at any point.

USE WHEN: counterparty has confirmed their lock on-chain and the user wants to claim their side of the swap. DO NOT USE WHEN: counterparty lock is not yet confirmed on-chain, OR the timelock has already expired — use refund_htlc instead.

PARAM NOTES: preimage must be 0x-prefixed 32-byte hex. Revealing the preimage is what makes the swap atomic — it simultaneously unlocks the counterparty leg. Set chainType to "bitcoin" or "sui" for non-EVM legs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tradeIdYesTrade ID
txHashYesOn-chain claim transaction hash (0x-prefixed)
preimageYesThe 32-byte secret preimage (0x-prefixed hex)
chainTypeNoChain type: evm, bitcoin, or sui
client_request_idNoIdempotency key. Retrying the SAME write with the SAME id within this MCP session returns the first result instead of triggering a second on-chain/backend side effect. Best-effort: not durable across MCP restarts.
Behavior4/5

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

Reveals that revealing the preimage makes the swap atomic and simultaneously unlocks the counterparty leg. Lacks mention of irrevocability or on-chain txHash requirement, but sufficient for the operation.

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?

Compact description with clear structure: one-line summary, use/don't-use section, and param notes. Every sentence provides necessary information.

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?

Covers purpose, usage, and key parameters adequately. No output schema, but for a claim operation, missing return value info is acceptable given the straightforward nature.

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 baseline is 3. Adds value by specifying preimage format (0x-prefixed 32-byte hex) and chainType for non-EVM legs beyond 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?

Clearly describes the tool as an atomic claim that reveals the preimage to unlock both legs. Distinguishes from sibling 'refund_htlc' by mentioning timelock expiry.

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?

Explicitly states when to use and when not to use, including a specific alternative tool (refund_htlc) for expired timelocks.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Hashlock-Tech/hashlock-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server