Skip to main content
Glama

approve_token

Approve a spender contract to transfer ERC-20 tokens on your behalf. Required before interacting with any DeFi protocol (DEXs, lending, etc.). Use amount "max" for unlimited approval, or specify an exact amount.

Instructions

Approve a spender contract to transfer ERC-20 tokens on your behalf. Required before interacting with any DeFi protocol (DEXs, lending, etc.). Use amount "max" for unlimited approval, or specify an exact amount. Under a spend policy an approval is a spend: it counts against the budgets, the spender is checked as a recipient, and "max" is refused.

Input Schema

NameRequiredDescriptionDefault
tokenYesERC-20 token contract address
amountYesAmount to approve in human-readable format (e.g. "1000"), or "max" for unlimited
spenderYesContract address to approve as spender
chain_idYesChain ID
decimalsNoToken decimals. Resolved from the registry or the token contract when omitted; if given, it must match
wallet_idYesWallet ID

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv1.14.2
    • removedInput schema / properties / decimals / default
      Removed value: -18
    • changedInput schema / properties / decimals / description
      Previous value: -"Token decimals (6 for USDC, 18 for most tokens)"New value: +"Token decimals. Resolved from the registry or the token contract when omitted; if given, it must match"
    • addedInput schema / properties / decimals / maximum
      Added value: +36
    • addedInput schema / properties / decimals / minimum
      Added value: +0
  2. First observedv1.7.3

TDQS

A3.9/5.0
Behavior4/5

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

No annotations, so the description carries the full burden and does well: it discloses that an approval counts as a spend against budgets, that the spender is checked as a recipient, and that 'max' is refused under a spend policy. These are non-obvious behavioral constraints beyond the schema. It omits that this is an irreversible on-chain transaction requiring gas, so not a 5.

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?

Four sentences, front-loaded with the core action, then usage context, then the amount convention, then policy behavior. Every sentence carries information and there is no filler, though it could be trimmed slightly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 6-parameter mutation with no annotations and no output schema, the description covers purpose, usage trigger, and policy behavior well. It leaves gas/on-chain irreversibility and the absence of a meaningful return value unstated, which are minor gaps for an agent.

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 the schema already documents every parameter including the 'max' convention for amount. The description's mention of 'max' and 'spender contract' largely restates the schema, adding only the spend-policy framing. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: 'Approve a spender contract to transfer ERC-20 tokens on your behalf.' An agent knows exactly what the tool does. It does not, however, distinguish itself from close siblings like approve_permit2 or check_approval, so it falls short of a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives clear when-to-use context: 'Required before interacting with any DeFi protocol (DEXs, lending, etc.).' This is meaningful routing guidance. It stops short of naming alternatives (e.g. approve_permit2 for Permit2 flows) or stating when this tool is the wrong choice.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.