Skip to main content
Glama

approve_token_spending

Approve a spender address to spend your ERC20 tokens, enabling interactions with DeFi protocols, exchanges, or other contracts that require an allowance.

Instructions

Approve another address (like a DeFi protocol or exchange) to spend your ERC20 tokens. This is often required before interacting with DeFi protocols.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "privateKey": "<privateKey>",
      "tokenAddress": "<tokenAddress>",
      "spenderAddress": "<spenderAddress>",
      "amount": "<amount>"
    },
    "name": "approve_token_spending"
  }
}

Input Schema

NameRequiredDescriptionDefault
amountYesThe amount of tokens to approve in token units, not wei (e.g., '1000' to approve spending 1000 tokens). Use a very large number for unlimited approval.
privateKeyYesPrivate key of the token owner account in hex format (with or without 0x prefix). SECURITY: This is used only for transaction signing and is not stored.
tokenAddressYesThe contract address of the ERC20 token to approve for spending (e.g., '0xA0b8...')
spenderAddressYesThe contract address being approved to spend your tokens (e.g., a DEX or lending protocol)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.2.2

TDQS

B3.1/5.0
Behavior2/5

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

No annotations are supplied, so the description carries the full burden. It does not disclose that this submits an on-chain transaction (gas cost, irreversibility, latency), that an unlimited approval is a security risk, or what the call returns — all critical for a mutation tool that grants spending rights to a third party.

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?

Two short sentences with the operation stated first and the motivating context second; no filler. Slightly under-specified rather than verbose, so length is not the issue.

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

Completeness2/5

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

For a 4-required-parameter, irreversible on-chain mutation with no annotations and no output schema, the description omits the return value, gas/transaction implications, and which network the approval applies to. An agent would have to guess at post-call behavior and preconditions.

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 every parameter, including amount units and the private-key security note, is already documented in structured data. The description only loosely maps 'another address (like a DeFi protocol or exchange)' to spenderAddress, adding no semantics beyond the schema.

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 another address ... to spend your ERC20 tokens') and clarifies the spender is typically a protocol or exchange. It implicitly separates the tool from transfer_erc20/transfer_token by framing it as granting an allowance rather than moving tokens, but never names or explicitly contrasts a sibling.

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

Usage Guidelines3/5

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

Provides one genuine usage signal: 'often required before interacting with DeFi protocols,' which tells the agent the approval is a prerequisite step. There is no guidance on when not to use it, no mention of alternatives, and no statement about required network/chain context.

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