Skip to main content
Glama

Prepare a withdrawal

prepare_withdrawal
Read-only

Build the EIP-712 typed-data payload to sign for withdrawing from a specific pool, without signing anything. Looks up the exact withdrawRequest domain/types/value MetaLend expects from your current balances, fills in amount and a short-lived deadline, and returns it ready to sign with your own wallet. Pass the resulting signature to submit_withdrawal. Omit amount (or pass "MAX") to withdraw the pool's entire balance — this uses the maxUint256 convention rather than the exact current balance, which avoids stale-balance/rounding failures. chain is required: the same pool contract address can exist on multiple chains (e.g. Aave reuses one address across Polygon/Arbitrum/Avalanche/Optimism), so poolContract alone cannot disambiguate a wallet holding balance in that pool on more than one of those chains. Also refuses to build typedData when the pool's live liquidity (see list_pools' poolLiquidity) does not exceed the amount being withdrawn (this also applies to MAX, using the pool's own balance) — the backend would reject the signed request either way, so this catches it before a wallet signs. A fixed on-behalf gas fee (see fee in the response, also available standalone via get_transaction_costs) is deducted from the withdrawn amount before it reaches your wallet — the response's expectedReceivedAmountRaw is what will actually arrive, not the full amount being withdrawn from the pool. Rate limited to 5 calls/minute per caller, no more than one call every 12s.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chainYesChain name, e.g. BASE, ETHEREUM, POLYGON.
tokenYesToken symbol, e.g. USDC, USDT, MUSD, RLUSD, USDG, USDE, PYUSD. Required to disambiguate — some pool addresses serve multiple tokens.
amountNoRaw amount to withdraw. Omit or pass "MAX" for a full withdrawal (uses maxUint256).
poolContractYesPool contract address, from get_balances' perPool[].poolAddress. Combined with `chain` to identify the exact balance — the same address can exist on several chains.
walletAddressYesEVM wallet address (0x-prefixed, 40 hex chars). Any casing is accepted — it is normalized to its EIP-55 checksum before being forwarded upstream.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.7/5.0
Behavior5/5

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

With readOnlyHint=true already declared, the description still adds substantial behavioral detail: it does not sign anything, uses the maxUint256 convention, includes a liquidity guard that prevents useless signatures, deducts a fixed fee, and warns about rate limits. This goes well beyond the annotations and helps the agent understand side effects and failure modes.

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?

The description is long but every sentence carries decision-relevant information, and the primary purpose is front-loaded in the first sentence. It could be slightly more structured with a visible break between the core function and the caveats, but nothing is redundant and the density is appropriate for a multi-caveat tool.

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 tool with no output schema, the description covers the most important return fields (`fee`, `expectedReceivedAmountRaw`) and the key behavioral edge cases (MAX, chain ambiguity, liquidity refusal, fee deduction). It stops short of fully specifying the returned typed-data envelope, but an agent can still correctly invoke and interpret the result without missing critical information.

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 the baseline is 3, but the description adds real value beyond the schema: it explains the MAX/maxUint256 semantics for `amount`, why `chain` is required for shared addresses, and that `poolContract` should be sourced from get_balances. It doesn't add much for `token` or `walletAddress`, but the schema already covers those clearly.

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 first sentence states a specific verb ('Build') and resource ('EIP-712 typed-data payload to sign for withdrawing from a specific pool'), and adds 'without signing anything' to distinguish it from actual withdrawal execution. It also names submit_withdrawal as the follow-up, so an agent can immediately tell this tool prepares rather than submits.

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?

The description explicitly routes the agent to pass the resulting signature to submit_withdrawal, which is the correct next step. It gives concrete conditions for when to omit `amount` (full withdrawal), why `chain` is required despite the schema, and when the tool refuses to build typedData, giving clear 'do/don't' guidance beyond generic context.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.