Skip to main content
Glama

Prepare: liquidate a position

liquidate
Read-onlyIdempotent

Unsigned transaction liquidating a position past its limit, through the market's own liquidator (anyone may call it, and it pays the caller): no money of the wallet's, Morpho hands over the collateral, it is sold, the debt repaid, and the rest goes to the wallet. market: a stock's symbol with side short or usdg, an agent credit market's symbol (as credit_markets lists them), or a market id (0x and 64 hex) for a coin short or a coin loan (a coin's address with side works too; keeper_jobs gives the arguments). Reads the position fresh from the chain, sizes it as Borro's keeper does, simulates it from the wallet, and sets minProfit to 90% of the simulated profit unless min_profit_usdg is given: under it the transaction reverts and costs the gas alone. Refused in words when the position is healthy, the profit is under min_profit_usdg, the stock vault has lent its stock out (CannotRedeem), or the market is not Borro's.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "wallet": "<wallet>",
      "market": "<market>",
      "borrower": "<borrower>"
    },
    "name": "liquidate"
  }
}

Input Schema

NameRequiredDescriptionDefault
kindNoOptional, as /jobs.json's prepare gives it: checked against the market
sideNoFor a stock or a coin given by its address: short (it is borrowed) or usdg (USDG borrowed against it)
marketYesA stock's symbol (like "NVDA", with side), an agent credit market's symbol, a market id (0x and 64 hex), or a coin's address (with side)
walletYesThe wallet that sends it and is paid
borrowerYesThe position's owner on Morpho (for a stock short, the shorter's wallet or its BorroShort account)
min_profit_usdgNoThe least USDG the wallet will take; less and it reverts (default 90% of the simulated profit)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.6/5.0
Behavior5/5

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

Annotations only declare readOnlyHint/idempotent (consistent with a prepare-only tool), but the description adds substantial context beyond them: no wallet funds are used, the caller is paid, the position is read fresh and simulated, minProfit defaults to 90% of simulated profit, and a below-threshold tx reverts costing only gas. This is exactly the behavioral detail an agent needs.

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?

Front-loads the core action and then packs scope, mechanics, and refusal conditions efficiently into one dense block. It is information-rich and mostly earns its length for a complex DeFi operation, though the run-on density slightly hurts scanability.

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?

For a 6-parameter, no-output-schema prepare tool, the description covers the return (an unsigned transaction), the simulation and profit mechanics, the min_profit default, and every refusal path. An agent has enough to call it correctly and interpret failures.

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 schema already documents all six parameters, but the description adds value by enumerating the market identifier formats (symbol+side, credit market symbol, 0x market id, coin address) and pointing to keeper_jobs for argument construction, plus restating the min_profit revert consequence. Slightly above baseline for the navigational aid.

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?

States a specific verb and resource: prepare an unsigned transaction that liquidates an underwater position via the market's own permissionless liquidator. This is precisely distinguishable from siblings like close_short, buy_cover, and repay, which are self-directed position actions rather than third-party liquidation.

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?

Gives clear conditions for use (position past its limit, permissionless, pays the caller) and enumerates when it refuses: healthy position, profit below min_profit_usdg, stock lent out (CannotRedeem), or a non-Borro market. It stops short of naming alternative siblings for the cases it declines, so not a full 5.

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