Skip to main content
Glama

Preview an action (simulate before executing)

preview_action
Read-only

Simulate a supply/borrow/withdraw/repay against a wallet's position WITHOUT executing, on v3 or v4 - or, v4 only, a quoted order that moves a position: a leverage, a position swap or a repay-with-supply. Always do this before a borrow, a withdraw or any of those orders. Send only the arguments that apply: v4 takes 'reserveId'; v3 takes 'market' + 'token' + 'chainId'; 'max' is for withdraw and repay; 'native' works on both; 'enableCollateral' is v4 only. A quoted order takes 'quoteId' and 'sender' and nothing else, since the quote already binds the wallet, the reserves and the amounts, and the action names the tool that minted it: 'leverage' for get_leverage_quote, 'supplySwap' or 'borrowSwap' for get_position_swap_quote with kind supply or borrow, 'repayWithSupply' for get_repay_with_supply_quote. Both versions answer with 'healthFactorBefore' and 'healthFactorAfter'; v4 also returns net APY, risk premium, net collateral, net balance, projected earnings and both borrowing-power figures, each as a matching Before/After pair, plus 'rewardsAcquired' / 'rewardsAbandoned' when the action changes rewards. v3 has the two health factors and nothing else. Either version also returns 'warnings' when the action would not actually succeed - an error level there means the prepare step will refuse it, so fix the inputs rather than building it. Simulate first even when you intend to build immediately: this is the cheapest way to find out that an action cannot succeed, and it commits nothing. It reports the position's own limits and not token allowances, so a clean simulation says the position allows this, not that no approval step remains.

Input Schema

NameRequiredDescriptionDefault
maxNoWithdraw/repay only: use the entire balance/debt.
tokenNov3 only: underlying token address.
actionYesAction to simulate. 'leverage', 'supplySwap', 'borrowSwap' and 'repayWithSupply' simulate a quoted order and take 'quoteId' and 'sender', nothing else.
amountNoAmount in MAIN units (e.g. '10.5'), never base units: 100000 base units of a 6-decimal token is '0.1', not '100'. Convert before sending if the user stated base units. Omit only if max=true or the action is a quoted order.
marketNov3 only: market pool address, from a get_markets row in this session. It cannot be recalled: an Aave pool address you already recognise belongs to another deployment (v2, or another chain) and is rejected.
nativeNoUse the chain's native gas token instead of an ERC-20, on either version. Pass it whenever the action is in the native token, or the balance check below reads the wrapped ERC-20 balance and can refuse a supply that would work.
senderYesSender wallet address (0x, 40 hex): the wallet that will sign, as the user named it in this session. If no wallet has been named, ask for it; never substitute a placeholder, which is rejected.
chainIdNov3 only: chain id (positive integer).
quoteIdNoQuoted orders only: the quoteId from the quote tool the action names, in this session. The quote binds everything else, wallet included, so 'sender' is the 'user' it was quoted for and no other selector or amount applies.
versionNoOptional: inferred from the reserve selector ('reserveId' is v4, 'market'+'token'+'chainId' is v3). Send it to be explicit, or if you somehow set both.
reserveIdNov4 only: the opaque reserveId, copied verbatim from a get_markets row or a get_position_items item in this session (e.g. 'MTo6MHg5NGU3...Ojo1') - it cannot be constructed or recalled, so fetch one before the first call rather than after a refusal. For a withdraw or a repay take it from get_position_items for the position being acted on, not from get_markets: the same asset exists on several spokes, and the one this wallet supplied is the only one it can exit. The 'spokeId' from get_user_positions is NOT this: it is the same encoding one segment short, names the spoke rather than a reserve inside it, and is rejected. A token symbol such as 'USDC' is rejected too.
enableCollateralNov4 supply only: also enable as collateral.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • changedInput schema / properties / action / description
      Previous value: -"Action to simulate."New value: +"Action to simulate. 'leverage', 'supplySwap', 'borrowSwap' and 'repayWithSupply' simulate a quoted order and take 'quoteId' and 'sender', nothing else."
    • changedInput schema / properties / action / enum
      Previous value: -[
      -  "supply",
      -  "borrow",
      -  "withdraw",
      -  "repay"
      -]New value: +[
      +  "supply",
      +  "borrow",
      +  "withdraw",
      +  "repay",
      +  "leverage",
      +  "supplySwap",
      +  "borrowSwap",
      +  "repayWithSupply"
      +]
    • changedInput schema / properties / amount / description
      Previous value: -"Amount in MAIN units (e.g. '10.5'), never base units: 100000 base units of a 6-decimal token is '0.1', not '100'. Convert before sending if the user stated base units. Omit only if max=true."New value: +"Amount in MAIN units (e.g. '10.5'), never base units: 100000 base units of a 6-decimal token is '0.1', not '100'. Convert before sending if the user stated base units. Omit only if max=true or the action is a quoted order."
    • addedInput schema / properties / quoteId
      Added value: +{
      +  "description": "Quoted orders only: the quoteId from the quote tool the action names, in this session. The quote binds everything else, wallet included, so 'sender' is the 'user' it was quoted for and no other selector or amount applies.",
      +  "type": "string"
      +}
  2. Changed3 schema fields changed
    • changedInput schema / properties / reserveId / description
      Previous value: -"v4 only: the opaque reserveId, copied verbatim from a get_markets row or a get_position_items item in this session (e.g. 'MTo6MHg5NGU3...Ojo1') - it cannot be constructed or recalled, so fetch one before the first call rather than after a refusal. The 'spokeId' from get_user_positions is NOT this: it is the same encoding one segment short, names the spoke rather than a reserve inside it, and is rejected. A token symbol such as 'USDC' is rejected too."New value: +"v4 only: the opaque reserveId, copied verbatim from a get_markets row or a get_position_items item in this session (e.g. 'MTo6MHg5NGU3...Ojo1') - it cannot be constructed or recalled, so fetch one before the first call rather than after a refusal. For a withdraw or a repay take it from get_position_items for the position being acted on, not from get_markets: the same asset exists on several spokes, and the one this wallet supplied is the only one it can exit. The 'spokeId' from get_user_positions is NOT this: it is the same encoding one segment short, names the spoke rather than a reserve inside it, and is rejected. A token symbol such as 'USDC' is rejected too."
    • changedInput schema / properties / sender / description
      Previous value: -"Sender wallet address, 0x-prefixed (40 hex chars)."New value: +"Sender wallet address (0x, 40 hex): the wallet that will sign, as the user named it in this session. If no wallet has been named, ask for it; never substitute a placeholder, which is rejected."
    • changedInput schema / properties / version / description
      Previous value: -"Optional: inferred from the reserve selector ('reserveId' means v3 is not being used, 'market'+'token'+'chainId' means v4 is not). Send it to be explicit, or if you somehow set both."New value: +"Optional: inferred from the reserve selector ('reserveId' is v4, 'market'+'token'+'chainId' is v3). Send it to be explicit, or if you somehow set both."
  3. Changed3 schema fields changed
    • removedInput schema / properties / reserve
      Removed value: -{
      -  "description": "v4 only: the opaque reserveId, copied verbatim from a get_markets row or a get_position_items item in this session (e.g. 'MTo6MHg5NGU3...Ojo1') - it cannot be constructed or recalled, so fetch one before the first call rather than after a refusal. The 'spokeId' from get_user_positions is NOT this: it is the same encoding one segment short, names the spoke rather than a reserve inside it, and is rejected. A token symbol such as 'USDC' is rejected too.",
      -  "type": "string"
      -}
    • addedInput schema / properties / reserveId
      Added value: +{
      +  "description": "v4 only: the opaque reserveId, copied verbatim from a get_markets row or a get_position_items item in this session (e.g. 'MTo6MHg5NGU3...Ojo1') - it cannot be constructed or recalled, so fetch one before the first call rather than after a refusal. The 'spokeId' from get_user_positions is NOT this: it is the same encoding one segment short, names the spoke rather than a reserve inside it, and is rejected. A token symbol such as 'USDC' is rejected too.",
      +  "type": "string"
      +}
    • changedInput schema / properties / version / description
      Previous value: -"Optional: inferred from the reserve selector ('reserve' means v3 is not being used, 'market'+'token'+'chainId' means v4 is not). Send it to be explicit, or if you somehow set both."New value: +"Optional: inferred from the reserve selector ('reserveId' means v3 is not being used, 'market'+'token'+'chainId' means v4 is not). Send it to be explicit, or if you somehow set both."
  4. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Beyond the readOnly/non-destructive annotations, it discloses that the call commits nothing, that 'warnings' with error level predicts a prepare-step refusal, and — a genuinely valuable caveat — that it checks position limits rather than token allowances, so a clean simulation does not mean no approval is needed. It also spells out version-specific return payloads (health factors only on v3; APY, risk premium, net collateral/balance, borrowing power, rewards on v4).

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?

Purpose and the imperative to simulate first are front-loaded, and almost every clause carries information an agent needs for a 12-parameter conditional tool. It is, however, a dense run-on chain, and the 'cheapest way to find out... commits nothing' sentence partially restates the earlier 'WITHOUT executing'/'Always do this' framing.

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 no-output-schema tool with 12 parameters and two protocol versions, the description covers the return shape of both versions, warning semantics, selector sourcing, and the allowance blind spot. Nothing an agent needs in order to call it correctly or interpret the result appears to be missing.

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 baseline is 3; the description earns an extra point by adding cross-field routing the schema does not state as such — which argument set each version and each action type takes, and which quote tool each quoted-order action name corresponds to. Most individual parameter meaning (reserveId opacity, max, native, sender) is duplicated from the schema rather than extended.

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 — simulate a supply/borrow/withdraw/repay or quoted order against a wallet position WITHOUT executing — and enumerates the exact action set. It also separates itself from the build path by naming 'the prepare step' that will refuse a failed simulation, so an agent can tell it apart from prepare_action and the quote tools without opening a 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?

Gives an explicit directive: 'Always do this before a borrow, a withdraw or any of those orders,' reinforced by 'Simulate first even when you intend to build immediately.' It also routes each quoted-order action to the sibling that minted its quote (get_leverage_quote, get_position_swap_quote, get_repay_with_supply_quote), leaving little to inference.

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