tm_prepare_transfer
Prepare cryptocurrency transfers to external wallets by specifying destination address, token, amount, and blockchain. Generates transfer details and ID for subsequent execution.
Instructions
Prepare a transfer to an external wallet address. Returns transfer details and a transfer_id for execution with tm_execute_transfer.
Args:
to (string): Destination wallet address
token (string): Token symbol or contract address
amount (string): Quantity as decimal string
chain ("solana" | "base"): Chain (default: solana)
qty_unit ("base" | "quote"): Amount unit (default: base)
Returns: { transfer_id, to, token, amount, chain }
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | Destination wallet address | |
| token | Yes | Token symbol or address | |
| amount | Yes | Amount to transfer | |
| chain | No | solana | |
| qty_unit | No | base |
Implementation Reference
- src/tools/trade.ts:264-305 (handler)Handler implementation for tm_prepare_transfer which resolves assets and calls the API to prepare a transfer.
async ({ to, token, amount, chain, qty_unit }) => { let asset = token; let resolvedChain = chain; if (isSymbol(token)) { const assets = await api.getAssets(); const match = assets.find( (a) => a.symbol?.toLowerCase() === token.toLowerCase() ); if (!match?.address) { return { isError: true, content: [{ type: "text", text: `Could not resolve symbol "${token}".` }], }; } asset = match.address; if (match.chain) resolvedChain = match.chain.toLowerCase() as "solana" | "base"; } const resp = await api.prepareTransfer({ chain: resolvedChain, asset, to, qty: amount, qty_unit, }); const output = { transfer_id: resp.transfer_id ?? null, to, token: token.toUpperCase(), amount, chain: resolvedChain, has_payloads: !!(resp.payloads && resp.payloads.length > 0), }; return { content: [{ type: "text", text: JSON.stringify(output, null, 2) }], structuredContent: output, }; } ); - src/tools/trade.ts:235-263 (registration)Registration of the tm_prepare_transfer tool, including its input schema and description.
server.registerTool( "tm_prepare_transfer", { title: "Prepare a token transfer", description: `Prepare a transfer to an external wallet address. Returns transfer details and a transfer_id for execution with tm_execute_transfer. Args: - to (string): Destination wallet address - token (string): Token symbol or contract address - amount (string): Quantity as decimal string - chain ("solana" | "base"): Chain (default: solana) - qty_unit ("base" | "quote"): Amount unit (default: base) Returns: { transfer_id, to, token, amount, chain }`, inputSchema: { to: z.string().describe("Destination wallet address"), token: z.string().describe("Token symbol or address"), amount: z.string().describe("Amount to transfer"), chain: z.enum(["solana", "base"]).default("solana"), qty_unit: z.enum(["base", "quote"]).default("base"), }, annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: false, openWorldHint: true, }, },