Skip to main content
Glama

base_swap_validity

Read-onlyIdempotent

A swap that lands only when your conditions hold (Cobalt validity tx) — The base-swap 0x trade as a Cobalt validity transaction: Base includes your signed tx only while your conditions hold — a conditional order with no limit-order contract and nobody holding the trade. We never hold funds or keys; you sign and submit. Every request carries the deadline Base requires (at most 60 s out; set for you if omitted). Optional conditions: fromBlock, minNativeBalanceWei, or a caller-supplied storage predicate for price. Required inputs: sell, buy, amount, taker. Priced $0.02 per call over x402 on Base; send a prepaid x-credit-token header for unlimited calls, or get 1 free call/day per tool. No API key required.

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": {
      "sell": "<sell>",
      "buy": "<buy>",
      "amount": "<amount>",
      "taker": "<taker>"
    },
    "name": "base_swap_validity"
  }
}

Input Schema

NameRequiredDescriptionDefault
buyYesToken you buy
sellYesToken you sell
takerYesYour wallet (signs the swap)
amountYesAmount you sell
slippageNoSlippage in bps (optional, default 100)
fromBlockNoEarliest block (optional)
storageOpNoAdvanced: operator (< <= = != > >=)
beforeBlockNoDeadline block (optional; at most 60 s out, set for you if omitted)
storageMaskNoAdvanced: mask (hex, optional)
storageSlotNoAdvanced: storage slot (hex)
storageValueNoAdvanced: compare value (hex)
storageAddressNoAdvanced: pool/token for a storage condition
minNativeBalanceWeiNoMin taker ETH balance in wei (optional)

Output Schema

NameRequiredDescriptionDefault
dataNoThe result payload. Shape is service-specific; every field is documented in the tool description.
serviceNoThe service id that answered.
checkedAtNoISO-8601 timestamp of when the underlying reads were taken.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • removedInput schema / properties / flashblockIndex
      Removed value: -{
      -  "description": "Flashblock index 1-10 (optional)",
      -  "type": "string"
      -}
  2. Changed2 schema fields changed
    • changedInput schema / properties / beforeBlock / description
      Previous value: -"Deadline: before this block (recommended)"New value: +"Deadline block (optional; at most 60 s out, set for you if omitted)"
    • changedInput schema / properties / flashblockIndex / description
      Previous value: -"Flashblock index (optional)"New value: +"Flashblock index 1-10 (optional)"
  3. Added

TDQS

A3.8/5.0
Behavior4/5

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

Beyond annotations, it discloses custody (no funds or keys held; you sign and submit), the mandatory deadline (≤60 s out, auto-set if omitted), and payment mechanics (x402 $0.02/call, prepaid x-credit-token, 1 free call/day, no API key). These are substantial operational facts an agent needs before calling. It omits what the returned validity-tx payload contains and what happens on condition failure, which keeps it at 4.

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

Conciseness3/5

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

It is front-loaded with the core concept, but the prose is dense and em-dash-chained, and passages like 'a conditional order with no limit-order contract and nobody holding the trade' plus full pricing/credits detail consume space without aiding invocation. The required-inputs sentence duplicates the schema's required list.

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 13-parameter tool with an output schema and annotations, the description covers the essential gaps: custody model, deadline constraint, condition types, required inputs, and cost/auth. The advanced storage-predicate path and failure behavior remain underspecified, but nothing critical to a correct call is missing.

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 all 13 parameters are already documented, and the description only restates the four required inputs (sell, buy, amount, taker) and summarizes optional conditions. It adds slight meaning about the 60 s deadline rationale but nothing about the advanced storageOp/storageMask/storageSlot predicate semantics beyond what the schema labels them.

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?

The description names a specific verb and resource — a swap that settles only while caller conditions hold, implemented as a Cobalt validity transaction — and contrasts it with a plain 'base-swap 0x trade', so an agent can tell it apart from base_swap. It does not name the sibling tool explicitly, which keeps it one step 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?

Usage context is clear: use it when the trade should land only under block/balance/storage conditions, and it lists the optional condition inputs (fromBlock, minNativeBalanceWei, storage predicate). It never states when NOT to use it or which sibling (base_swap, swap_route, validity_build) to pick instead.

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