Skip to main content
Glama

write_account_add_liquidity

Idempotent

Multi-step flash-action: atomically combines [deposit from wallet] + [use account collateral] + [swap to optimal ratio] + [mint LP] + [borrow if leveraged] in ONE transaction. Do NOT call write_account_deposit separately. Capital sources: wallet tokens (deposits array), existing account collateral (use_account_assets=true), or both. Check allowances first (read_wallet_allowances), then approve if needed (write_wallet_approve). Supports depositing multiple tokens and minting multiple LP positions in one tx. Works with both margin accounts (can leverage) and spot accounts (no leverage). For workflows, call read_guides('strategies'). 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), passing only the accept_price_checks the user already confirmed. Response includes tenderly_sim_url and tenderly_sim_status for pre-broadcast validation. expected_value_change is in raw units of the account's numeraire token (6 decimals for USDC, 18 for WETH). Negative = cost to open, positive = value gained. Compare before.total_account_value and after.total_account_value for the full picture. If a pool's price is off market or one of its tokens has no price, the tool returns the price warnings, an accept_price_checks list and NO transaction. Show the warnings to the user and call again with that accept_price_checks list only after the user explicitly confirms they accept them. If a later call returns new warnings, even on a rebuild, show them and get a new confirmation before passing their list. The acknowledgement never bypasses a backend refusal.

Input Schema

NameRequiredDescriptionDefault
chain_idNoChain ID: 8453 (Base), 130 (Unichain), 10 (Optimism), or 4663 (Robinhood)
depositsNoWallet tokens to deposit. Approve each token first (write_wallet_approve). Omit to use only account collateral.
leverageNo0 = no borrow, 2 = 2x leverage. Margin accounts only.
slippageNoBasis points, 100 = 1%
positionsYesLP positions to mint. For a single position, pass one entry.
wallet_addressYesWallet address of the account owner
account_addressYesArcadia account address
use_account_assetsNoIf true, use ALL existing account collateral for LP minting. Fetched automatically.
accept_price_checksNoThe accept_price_checks list returned with the price warnings of a previous call, passed unchanged and only after the user has explicitly confirmed those warnings. Never set it on the first call.

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. Changed3 schema fields changed
    • addedInput schema / properties / accept_price_checks
      Added value: +{
      +  "description": "The accept_price_checks list returned with the price warnings of a previous call, passed unchanged and only after the user has explicitly confirmed those warnings. Never set it on the first call.",
      +  "items": {
      +    "oneOf": [
      +      {
      +        "properties": {
      +          "deviation_bps": {
      +            "type": "number"
      +          },
      +          "pool": {
      +            "type": "string"
      +          },
      +          "status": {
      +            "const": "off_market",
      +            "type": "string"
      +          },
      +          "unpriced_token": {
      +            "type": "null"
      +          }
      +        },
      +        "required": [
      +          "pool",
      +          "status",
      +          "deviation_bps",
      +          "unpriced_token"
      +        ],
      +        "type": "object"
      +      },
      +      {
      +        "properties": {
      +          "deviation_bps": {
      +            "type": "null"
      +          },
      +          "pool": {
      +            "type": "string"
      +          },
      +          "status": {
      +            "const": "unpriced",
      +            "type": "string"
      +          },
      +          "unpriced_token": {
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "pool",
      +          "status",
      +          "deviation_bps",
      +          "unpriced_token"
      +        ],
      +        "type": "object"
      +      }
      +    ]
      +  },
      +  "type": "array"
      +}
    • 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. Changed9 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
    • changedInput schema / properties / deposits / description
      Previous value: -"Wallet tokens to deposit. Approve each token first (write.wallet.approve). Omit to use only account collateral."New value: +"Wallet tokens to deposit. Approve each token first (write_wallet_approve). Omit to use only account collateral."
    • removedInput schema / properties / deposits / items / additionalProperties
      Removed value: -false
    • removedInput schema / properties / positions / items / additionalProperties
      Removed value: -false
    • changedInput schema / properties / positions / items / properties / strategy_id / description
      Previous value: -"From read.strategy.list (or read.strategy.info for full range detail)"New value: +"From read_strategy_list (or read_strategy_info for full range detail)"
    • 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.6/5.0
Behavior4/5

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

Annotations only give generic hints (non-read-only, idempotent, open-world); the description adds substantial behavior: 30-second calldata validity, retry-at-least-once on price-move reverts, price-warning/accept_price_checks gating with no transaction returned, and expected_value_change units. Annotation contradiction is absent — building a tx with idempotentHint=true is consistent. Minor gap: it doesn't say whether a build has side effects or gas implications beyond the approval step.

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-loaded with the core multi-step summary and sibling exclusion, then layered detail. It's dense and nearly every sentence carries operational value, but the price-warning paragraph is long and repeats the confirmation rule in slightly different forms.

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 9-param, multi-step, open-world mutation tool, the description covers preconditions (allowances), postconditions (tenderly sim fields, expected_value_change), failure modes, and retry policy. With an output schema present, return-value explanation is a bonus rather than a need.

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 baseline is 3; the description still adds value by explaining how parameters interact (deposits array vs use_account_assets, multiple positions in one tx) and clarifies the accept_price_checks lifecycle. That's meaningful semantics beyond the per-field 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?

States a specific verb+resource ('build add liquidity transaction') and characterizes it as an atomic multi-step flash-action with enumerated components. It explicitly distinguishes itself from the closest sibling by saying 'Do NOT call write_account_deposit separately.'

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?

Gives explicit sequencing (check allowances with read_wallet_allowances, then write_wallet_approve), capital-source selection (wallet deposits vs use_account_assets vs both), account-type applicability (margin vs spot), and points to read_guides('strategies') for workflows. It also specifies retry behavior and the multi-step price-warning confirmation flow.

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.