Skip to main content
Glama

prepare_morpho_withdraw_collateral

Remove collateral from a Morpho Blue market to return it to your wallet. Builds an unsigned transaction for Ledger signing after checking your position to avoid liquidation risks.

Instructions

Build an unsigned Morpho Blue withdrawCollateral transaction — removes collateral from a market to send back to the wallet. Only withdraws the exact amount specified; "max" is NOT supported because Morpho's isolated-market accounting doesn't expose a clean max-safe value without simulating against the market's oracle/LLTV (query get_morpho_positions first to know your deposited collateral). Will revert on-chain if the withdrawal would push the position below the liquidation threshold. No approval step needed. Returns a handle + preview for Ledger signing.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
walletYes0x-prefixed EVM wallet address (40 hex chars) that will execute this action.
chainNoEVM chain Morpho Blue is deployed on. Currently only ethereum is enabled.ethereum
marketIdYesMorpho Blue market id — 32-byte hex (0x + 64 hex chars). Identifies the market's (loanToken, collateralToken, oracle, irm, lltv) tuple. Discover via get_morpho_positions.
amountYesHuman-readable decimal amount, NOT raw wei/base units. Example: "10" for 10 USDC. Pass "max" for full-balance withdraw/repay.
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behavioral traits: the transaction is unsigned (returns a handle for Ledger signing), will revert if withdrawal pushes below liquidation threshold, no approval step needed, and returns a preview. It doesn't mention rate limits or error conditions, but covers the essential safety and operational aspects well.

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 efficiently structured with zero wasted words. Every sentence adds critical information: the core action, constraints ('max' not supported), prerequisites (query positions first), safety considerations (revert condition), operational details (no approval needed), and return value. It's front-loaded with the main purpose and appropriately sized.

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 transaction preparation tool with no annotations and no output schema, the description provides substantial context about behavior, constraints, and prerequisites. It explains what the tool does, when to use it, and key limitations. The main gap is the lack of information about the return format beyond 'handle + preview', but given the tool's complexity, the description is largely complete.

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 description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds some context about marketId ('Discover via get_morpho_positions') and clarifies that amount doesn't support 'max', but doesn't provide significant additional semantic value beyond what's in the schema. This meets the baseline for high schema coverage.

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 clearly states the specific action ('build an unsigned Morpho Blue withdrawCollateral transaction'), the resource ('collateral from a market'), and distinguishes it from siblings like prepare_morpho_withdraw (likely for loan tokens) by specifying it's for collateral withdrawal. The verb+resource+scope combination is precise and unambiguous.

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 provides explicit guidance on when to use this tool: 'query get_morpho_positions first to know your deposited collateral' and when not to use it: 'max is NOT supported'. It also mentions an alternative approach (simulating against oracle/LLTV) and prerequisites (checking positions first), giving comprehensive usage context.

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/szhygulin/vaultpilot-mcp'

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