Skip to main content
Glama

approve_permit2

Grants a one-time ERC-20 allowance to the Permit2 contract so an agent can pay x402 "upto" endpoints with that token; set an amount to bound the approval, since maximum is refused by default.

Instructions

One-time ERC-20 approval of a token to the Permit2 contract, needed before paying x402 "upto" endpoints with that token. A normal on-chain transaction (needs gas). Pass amount to grant a bounded allowance; with no amount it asks for the maximum, which is refused by default, under AGENTWALLET_MAX_TX_TOKEN, and always under a spend policy (where the allowance counts against the budgets). Only the operator can allow a maximum approval, with AGENTWALLET_ALLOW_UNLIMITED_APPROVAL=1 while no policy is set. Permit2 itself only moves what each signed authorization allows.

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": {
      "wallet_id": "<wallet_id>",
      "token": "<token>",
      "chain_id": "<chain_id>"
    },
    "name": "approve_permit2"
  }
}

Input Schema

NameRequiredDescriptionDefault
tokenYesERC-20 token address (e.g. USDC on Base)
amountNoAllowance to grant in human units (e.g. "100"). Omit for unlimited.
chain_idYesChain ID
wallet_idYesWallet ID

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv1.14.8
    • addedInput schema / properties / chain_id / maximum
      Added value: +9007199254740991
    • addedInput schema / properties / chain_id / minimum
      Added value: +-9007199254740991
    • addedInput schema / properties / wallet_id / maximum
      Added value: +9007199254740991
    • addedInput schema / properties / wallet_id / minimum
      Added value: +-9007199254740991
  2. Addedv1.14.2

TDQS

A4/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does substantial work: it discloses that this is a real on-chain transaction requiring gas, that omitting amount requests an unlimited allowance which is refused by default, the AGENTWALLET_MAX_TX_TOKEN cap, that a spend policy makes the allowance count against budgets, and that only the operator can enable unlimited approvals. It omits what happens to an existing allowance on re-approval and what the call returns.

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 action and the use case, then the behavioral caveats. The final two sentences are clause-heavy (nested env var, policy, and operator conditions) but every clause carries distinct decision-relevant information, so nothing is wasted.

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 4-parameter mutation tool with no annotations and no output schema, the description covers purpose, preconditions, gas cost, and the full guardrail chain. An agent could call it correctly; the only real gap is the effect on a pre-existing allowance and any confirmation of result shape.

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, but the description adds real semantic weight the schema only gestures at: omitting amount means requesting the maximum, and that maximum is policy-refused by default. 'Pass amount to grant a bounded allowance' clarifies the safer path that the schema's terse 'Omit for unlimited' does not.

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 — 'one-time ERC-20 approval of a token to the Permit2 contract' — which is materially narrower than the sibling approve_token. The intended use case (enabling x402 'upto' payments) is bundled in, but the description never explicitly contrasts itself with approve_token, leaving the agent to infer the routing.

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?

'needed before paying x402 "upto" endpoints with that token' gives a concrete precondition that tells the agent when to reach for this tool. It does not state when *not* to use it or name approve_token as the general-purpose alternative, so the guidance is clear but not exhaustive.

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