Skip to main content
Glama

Prepare a liquidation

prepare_liquidation
Read-only

Build an unsigned transaction to liquidate an unhealthy position: repay part of someone else's debt and receive their collateral plus the liquidation bonus. Only viable while that position's health factor is below 1 (check get_user_summary for the target). v4 takes collateral and debt as reserveIds; v3 takes collateralToken and debtToken addresses plus chainId. Non-custodial: the liquidator signs and submits.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
maxNoCover the maximum the protocol allows.
debtNov4 only: reserveId of the debt to repay.
userYesThe wallet being liquidated (0x, 40 hex).
amountNoDebt to cover, in main units. Omit only if max=true.
marketNov3 only: market pool address (from get_markets).
chainIdNov3 only: chain id (positive integer).
versionYesProtocol version (v3 or v4; required, no 'all' for actions).
debtTokenNov3 only: debt token address.
collateralNov4 only: reserveId of the collateral to seize.
liquidatorNov4 only: the wallet performing the liquidation (0x, 40 hex). On v3 the liquidator is whoever signs the returned transaction.
collateralTokenNov3 only: collateral token address.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already mark this as read-only and non-destructive; the description adds that this is non-custodial and that the liquidator signs and submits the transaction. It also discloses the version-specific input model, which goes beyond what the annotations provide.

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 compact and front-loaded: purpose, viability condition, version differences, and custody model are each covered in a few efficient sentences. No filler or redundant restatement of the schema.

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?

Given the tool's 11 parameters, two protocol versions, and no output schema, the description covers the essential decision points well. It does not describe the exact shape of the returned unsigned transaction, but for a transaction builder the purpose and version-specific inputs are the critical context, so this is a minor gap.

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. The description adds cross-parameter meaning by mapping v4 to reserveIds and v3 to token addresses plus chainId, and clarifying that the liquidator is implicit in v3 but explicit in v4. This adds value beyond individual 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?

The description uses a specific verb and resource: 'Build an unsigned transaction to liquidate an unhealthy position.' It explains the economic flow (repay debt, receive collateral plus bonus) and clearly distinguishes this from sibling prepare_* tools like prepare_order or prepare_claim_rewards.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives an explicit viability condition ('health factor is below 1') and points the agent to get_user_summary to verify it. It also provides version-specific routing guidance, though it does not name a when-not-to-use alternative.

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.

Resources