Skip to main content
Glama

write_account_close

Idempotent

Atomic flash-action that closes an Arcadia account position in ONE transaction. Combines up to 3 steps atomically: [burn LP position] + [swap all tokens to a single target asset] + [repay debt]. Tokens remain in the account after closing — use write_account_withdraw to send them to your wallet.

ALWAYS try this tool first when closing/exiting a position. Only fall back to individual tools (write_account_remove_liquidity, write_account_swap, write_account_deleverage, write_account_withdraw) if this tool fails.

Supports two modes:

  • close_lp_only=true: Burns LP and leaves underlying tokens in the account. Use as step 1 if the full close fails, then call again with close_lp_only=false to swap+repay the remaining tokens.

  • close_lp_only=false (default): Full atomic close — burns LP, swaps everything to receive_assets, repays debt. Remaining tokens stay in the account. Follow up with write_account_withdraw to send to wallet. Supports multiple receive assets with custom distribution.

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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
assetsYesAssets to close/sell from the account. IMPORTANT: For LP positions (NFTs), always use amount='1' and decimals=1 — do NOT pass the liquidity amount. asset_address = position manager, asset_id = NFT token ID. For ERC20 tokens: asset_id = 0, amount = full balance in raw units, decimals = real token decimals. Get all values from read.account.info.
chain_idNoChain ID: 8453 (Base), 130 (Unichain), 10 (Optimism), or 4663 (Robinhood)
slippageNoBasis points, 100 = 1%
close_lp_onlyNotrue = only burn LP positions, leave underlying tokens in account. false = full close (burn + swap + repay).
receive_assetsNoTarget assets to receive after closing. For a single target, pass one entry. Required when close_lp_only=false. Omit for close_lp_only=true.
account_addressYesArcadia account address

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
afterNo
beforeNo
descriptionNo
transactionYes
tenderly_sim_urlNo
tenderly_sim_statusNo
expected_value_changeNo

TDQS

A4.9/5.0
Behavior5/5

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

The description adds significant behavioral context beyond annotations: the action is atomic, returned calldata is time-sensitive within 30 seconds, reverts should be retried by rebuilding, and tenderly_sim_url/tenderly_sim_status are provided for pre-broadcast validation. This goes well beyond the basic readOnly/destructive hints.

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 well-structured with clear mode bullets and front-loaded atomicity, but it does include some redundancy, such as repeating that tokens remain in the account after closing. Still, every major detail serves a practical purpose and the organization aids comprehension.

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?

Given the tool's complexity, the description covers the action, the two modes, parameter nuances, failure recovery, time sensitivity, and follow-up withdraw guidance. The presence of an output schema makes further return-value explanation unnecessary, so nothing essential is missing for an agent to call this correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Although the schema already covers parameters at 100%, the description adds crucial semantics: LP positions must use amount='1' and decimals=1, asset_address refers to the position manager, ERC20 amounts use raw units, receive_assets is conditional on close_lp_only, and values should come from read.account.info. This materially improves correct invocation.

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 what the tool does: atomically closes an Arcadia account position by burning LP, swapping tokens, and repaying debt in one transaction. It also distinguishes itself from related write_account_* tools and explicitly names write_account_withdraw for transferring tokens out afterward.

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?

Usage guidance is explicit and actionable: 'ALWAYS try this tool first when closing/exiting a position' and only fall back to individual tools if it fails. It also explains the two close_lp_only modes and when receive_assets is required, leaving no ambiguity about when this tool should be selected.

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.

TDQS

A4.2/5.0
Disambiguation5/5

Each tool targets a distinct resource and action, with clear read/write separation and detailed descriptions that specify exact use cases. Overlapping tools like write_account_deposit vs write_account_add_liquidity explicitly cross-reference to avoid misuse, and the asset-manager variants are clearly differentiated by staking/compounding/CowSwap behaviors.

Naming Consistency5/5

All tools follow a consistent read_* / write_* prefix with snake_case resource and action naming. Subgroup patterns are uniform (e.g., write_account_*, write_asset_manager_*), and the only outlier, dev_send, is intentionally marked as a dev-only exception.

Tool Count2/5

Forty tools is a very large surface, well above the typical 3-15 range for a well-scoped server. The seven separate write_asset_manager_* intent tools are highly granular and could likely be consolidated into a single parameterized automation tool, reducing cognitive load.

Completeness5/5

The tool set covers the full Arcadia lifecycle: account creation, collateral deposit/withdrawal, borrowing/repayment, LP add/remove/close, staking, automations, lending pool deposits/redeems, and comprehensive read operations. No obvious workflow dead ends exist, and all necessary supporting reads (prices, allowances, balances) are present.