Skip to main content
Glama

Prepare: foreclose on a rescued position

bailout_foreclose
Read-onlyIdempotent

For the rescuer, after maturity: an unsigned transaction foreclosing on the rescued position of a version 2 trade account (never the owner's other positions). The account's idle money pays ahead of the close; then it closes no more of the position than covers what is owed plus 50 bps (percent: less, if asked), bounded at the feed within 50 bps at maturity, widening to the offer's own bound over 35 minutes of trading time; what it returns pays the rescuer ahead of Borro's cut and the rest stays the owner's. The market must be open and the feed fresh. Refused in words before maturity, while the market is shut or the feed stale, when nothing is owed, or from any wallet but the rescuer's. Send with a gas limit of 4,000,000. Simulated from the wallet.

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>",
      "account": "<account>"
    },
    "name": "bailout_foreclose"
  }
}

Input Schema

NameRequiredDescriptionDefault
walletYesThe wallet's address (0x...); the transactions are built for it to sign
accountYesThe version 2 trade account's address
percentNoThe most of the rescued position to close, more than 0 to 100 (default 100: what covers what is owed)

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?

Beyond the read-only/idempotent annotations, the description discloses detailed execution behavior: idle money pays ahead, the close amount is capped at owed plus 50 bps and bounded by the feed/offer over time, the rescuer is paid before Borro's cut, and the owner receives the remainder. It also states refusal conditions, gas limit, and simulation, which are valuable for an agent invoking a prepare transaction tool.

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 front-loaded with the key scope and contains no obvious filler, but it is a dense run-on paragraph with multiple semicolon-separated clauses. It is efficient but could be easier to scan with clearer structure.

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 complex prepare-transaction tool with no output schema, the description covers the output type, rescuer/owner payment behavior, maturity and market/feed preconditions, refusal cases, gas limit, and simulation. An agent has enough context to decide whether and how to call it.

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 already 100%, but the description adds meaning beyond the schema: wallet must be the rescuer's, account must be a version 2 trade account, and percent controls how much less than the owed amount is closed. This is useful added semantics, though not exhaustive parameter documentation.

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 states a specific verb and resource: an unsigned transaction foreclosing on the rescued position of a version 2 trade account. It also scopes the action to the rescuer after maturity and explicitly excludes the owner's other positions, so an agent can distinguish it from adjacent bailout tools.

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 clear usage context and exclusions: only for the rescuer, only after maturity, only when the market is open and the feed is fresh, and not when nothing is owed or from a non-rescuer wallet. It does not name sibling alternatives such as bailout_claim or bailout_repay, so it falls short of full alternative routing.

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