Skip to main content
Glama

write_account_deleverage

Idempotent

Multi-step flash-action: sells account collateral to the debt token and repays in one atomic transaction: no wallet tokens needed. To repay from wallet tokens instead, use write_account_repay. NOTE: If you are closing a position (remove LP + swap + repay + withdraw), prefer write_account_close which batches everything atomically. Only use this tool for standalone repayment while keeping the position active. The returned calldata is time-sensitive: sign and broadcast within 30 seconds. If the transaction reverts due to price movement, rebuild and sign again immediately (retry at least once before giving up). Response includes tenderly_sim_url and tenderly_sim_status for pre-broadcast validation: if tenderly_sim_status is 'false', do NOT broadcast the transaction.

Input Schema

NameRequiredDescriptionDefault
chain_idNoChain ID: 8453 (Base), 130 (Unichain), 10 (Optimism), or 4663 (Robinhood)
creditorYesLending pool address
slippageNoBasis points, 100 = 1%
amount_inYesCollateral amount to sell (raw units)
numeraireYesDebt token address
asset_fromYesCollateral token to sell
account_addressYesArcadia account address

Output Schema

NameRequiredDescriptionDefault
afterNo
beforeNo
descriptionNo
transactionYes
price_checksNo
tenderly_sim_urlNo
tenderly_sim_statusNo
expected_value_changeNo
expected_value_change_unavailableNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedOutput schema / properties / expected_value_change_unavailable
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / price_checks
      Added value: +{
      +  "items": {
      +    "additionalProperties": {},
      +    "properties": {
      +      "pool": {
      +        "type": "string"
      +      },
      +      "status": {
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "pool",
      +      "status"
      +    ],
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
  2. Changed5 schema fields changed
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • removedInput schema / additionalProperties
      Removed value: -false
    • changedOutput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • changedOutput schema / properties / after / additionalProperties
      Previous value: -trueNew value: +{}
    • changedOutput schema / properties / before / additionalProperties
      Previous value: -trueNew value: +{}
  3. Changed1 schema field changed
    • changedInput schema / properties / chain_id / description
      Previous value: -"Chain ID: 8453 (Base), 130 (Unichain), or 10 (Optimism)"New value: +"Chain ID: 8453 (Base), 130 (Unichain), 10 (Optimism), or 4663 (Robinhood)"
  4. Changed1 schema field changed
    • changedOutput schema / properties / tenderly_sim_status / enum
      Previous value: -[
      -  "true",
      -  "false",
      -  "unavailable"
      -]New value: +[
      +  "success",
      +  "failure",
      +  "unavailable"
      +]
  5. Changed1 schema field changed
    • changedInput schema / properties / chain_id / description
      Previous value: -"Chain ID: 8453 (Base) or 130 (Unichain)"New value: +"Chain ID: 8453 (Base), 130 (Unichain), or 10 (Optimism)"
  6. Added

TDQS

A4.2/5.0
Behavior3/5

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

The description adds real behavioral context beyond annotations: no wallet tokens required, calldata expires in ~30 seconds, retry at least once on price-movement reverts, and a tenderly_sim_status gate that forbids broadcast on failure. However, the annotations already declare non-read-only, idempotent, non-destructive, open-world behavior, and the description does not discuss approval requirements, gas, or what happens to residual collateral. Strong on operational warnings, but not a complete behavioral picture.

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 core action and the two sibling alternatives are front-loaded, followed by time-sensitivity and simulation-gate warnings in a logical order. It is slightly verbose with layered NOTEs and parentheses, but nearly every sentence carries actionable constraints.

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?

An output schema exists, and the description still flags the essential return fields (tenderly_sim_url, tenderly_sim_status) and their pre-broadcast semantics, plus retry behavior. For a multi-step flash-action builder with subtle timing constraints, this is sufficient for an agent to call it safely.

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 all seven parameters (chain_id, creditor, slippage, amount_in, numeraire, asset_from, account_address) are already documented in the schema. The description mentions the conceptual flow (collateral sold, debt token repaid) but adds no syntax, units, or default guidance beyond what the schema provides. Baseline 3 applies.

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: sells account collateral to the debt token and repays atomically. It explicitly distinguishes itself from write_account_repay (wallet-funded repayment) and write_account_close (position-closing batch), so an agent can select it without opening any schema.

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?

Explicit routing rules: use write_account_repay to pay from wallet tokens, use write_account_close when closing a position, and use this tool only for standalone repayment while keeping the position open. Both alternatives and the exclusion condition are named.

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.