Skip to main content
Glama

prepare_morpho_withdraw_collateral

DestructiveIdempotent

Remove collateral from a Morpho Blue market and return it to your wallet. Specify exact amount; transaction reverts if withdrawal would cause liquidation.

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.
Behavior5/5

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

Annotations (destructiveHint=true, idempotentHint=true) are consistent, and the description adds critical behavioral context: returns handle+preview for Ledger, reverts if below liquidation threshold, and isolates exact amount logic. No contradictions with annotations.

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 five sentences, front-loaded with the core action, and each sentence adds essential information without redundancy. Perfectly sized.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Even without an output schema, the description covers prerequisites, error conditions, operational details (no approval), and return format (handle+preview). Complete for a transaction preparation tool.

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% with descriptions, but the tool description corrects the schema's misleading allowance of 'max' in the amount parameter. It adds meaningful nuance (human-readable decimal, no 'max'), and explains marketId discovery. Slight deduction for schema contradiction.

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 it builds an unsigned Morpho Blue withdrawCollateral transaction to remove collateral. It explicitly distinguishes from siblings like prepare_morpho_withdraw by specifying 'collateral' and adding nuances like 'max not supported'.

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 advises querying get_morpho_positions first to know deposited collateral, explains why 'max' is unsupported, warns about liquidation threshold revert, and notes no approval needed. This provides complete usage guidance.

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