Skip to main content
Glama

cpu_swap

Swap ETH for $CPU or sell $CPU for ETH on Uniswap v4. Set the amount and max slippage; the exact-input trade executes on-chain and confirms.

Instructions

Swap between native ETH and $CPU on the game token pool (Uniswap v4), in either direction: sell: "ETH" buys $CPU, sell: "CPU" sells it for ETH. amount is how much of the sold token to spend. Preview the result first with cpu_quote_swap. The swap is exact-input: you spend amount and receive at least the quoted output minus slippage (a percent, e.g. 0.5 = 0.5%). Selling $CPU auto-approves it (via Permit2) once before the first swap; the trade is submitted on-chain and this waits for confirmation. A 1% pool fee applies.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sellYesToken to spend: ETH (to buy $CPU) or CPU (to sell for ETH).
amountYesAmount of the `sell` token to spend, as a decimal string (e.g. "0.5"). 18 decimals.
slippageNoMax slippage as a percent (e.g. 0.5 = 0.5%); the floor on what you receive. Default 0.5.
Behavior5/5

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

With no annotations provided, the description fully carries the behavioral burden. It discloses exact-input semantics, slippage application as a floor, Permit2 auto-approval for CPU, on-chain submission and confirmation waiting, and the 1% pool fee. This is comprehensive and gives the agent a clear safety profile.

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?

The description is dense but every sentence earns its place. It front-loads the core purpose and direction, then logically explains amount, workflow, slippage, approval, and fee. It could be slightly shorter, but the structure is clear and no information is redundant with the structured schema.

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?

Given there is no output schema, the description covers all the important aspects of the swap: direction, amount, slippage, fee, and on-chain behavior. The only gap is that it does not describe the expected return value (e.g., transaction hash or receipt), which would help the agent know what to do with the result. Still, it is complete enough for safe invocation.

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 coverage is 100% (all three parameters have descriptions). The description reinforces the schema's meaning (e.g., `sell` directions, `amount` as spend amount, `slippage` as a percent) but adds little beyond what the schema already states. The Permit2 approval detail is behavioral, not parameter-specific, so the baseline of 3 is appropriate.

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?

The description clearly states the action ('Swap between native ETH and $CPU'), the resource ('game token pool (Uniswap v4)'), and supports both directions with explicit `sell` enum mapping. It also distinguishes itself from the sibling `cpu_quote_swap` by labeling that as a preview and this as the execution.

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?

The description provides clear usage context: it tells the agent to preview with `cpu_quote_swap` first, implies this tool is for executing the actual swap after quoting, and explains the slippage and exact-input behavior. It does not explicitly mention alternatives or when not to use, but for a swap tool the guidance is sufficient.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/projectcpu/project-cpu-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server