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. Always do this before a borrow or a withdraw. 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. 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

TableJSON Schema
NameRequiredDescriptionDefault
maxNoWithdraw/repay only: use the entire balance/debt.
tokenNov3 only: underlying token address.
actionYesAction to simulate.
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.
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).
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. 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."
  2. 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."
  3. First observed

TDQS

A5/5.0
Behavior5/5

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

Annotations already mark this as read-only and non-destructive, but the description adds substantial behavior beyond that: it commits nothing, reports the position's own limits rather than token allowances, and warns that a clean simulation does not mean no approval step remains. It also precisely defines the meaning of 'warnings' and its consequence for the prepare step.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is long, but justifiably so for an 11-parameter tool with two protocol versions and no output schema. It is front-loaded with the core purpose and usage rule, then organized into parameter routing, return-shape differences, and edge-case caveats. Every sentence carries operational information; there is no filler.

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?

With no output schema, the description fully documents return values for both versions: healthFactorBefore/After, v4-only metrics, rewards fields, and warnings semantics. It also covers prerequisite data sourcing (fetch reserveId/market before first call), amount unit conventions, and sender requirements, so an agent has everything needed to call this tool 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?

Schema coverage is already 100%, but the description meaningfully enriches the parameters: amount must be in MAIN units with an explicit base-unit conversion example, reserveId must be copied verbatim from session data and cannot be constructed, spokeId is explicitly rejected, market cannot be recalled from memory, sender must be the user-named wallet, and native's failure mode is explained. This is far beyond the schema text.

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 ('Simulate'), the concrete action set (supply/borrow/withdraw/repay), the evaluated resource (a wallet's position), and the key constraint (WITHOUT executing, on v3 or v4). The title and first sentence also make it immediately distinguishable from prepare_action and other sibling tools.

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 rule: 'Always do this before a borrow or a withdraw' and 'Simulate first even when you intend to build immediately.' It also tells the agent what to do when simulation fails ('fix the inputs rather than building it'), which is an implicit when-not for proceeding to prepare/execute.

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