Skip to main content
Glama
gblinproject

@gblin-protocol/mcp-server

swap_gblin_to_usdc_jit

Read-onlyIdempotent

Generate ready-to-broadcast calldata to convert GBLIN treasury into exact USDC needed for x402 invoices, using staged approvals, redemptions, and a WETH-to-USDC swap.

Instructions

When an x402 invoice (or any USDC obligation) arrives and your treasury sits in GBLIN, call this to get ready-to-broadcast calldata that redeems exactly the USDC you need, just in time. Three sequential transactions: (1) approve the shares to the GBLIN Zap, (2) GBLINZap.sellGBLINForEth, which redeems in kind and sells every leg for ETH, all or nothing, (3) a Uniswap WETH->USDC swap that spends only the guaranteed ETH minimum and still returns at least the requested USDC. EOAs sign three times; ERC-4337 / EIP-7702 wallets can batch them into one operation. Every step carries a non-zero minimum; ETH above the minimum stays in the wallet. Free to call. A redemption carries no protocol fee; the costs are the Zap's swaps and gas.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
usdc_neededYesUSDC amount, decimal string.
wallet_addressYesAgent's 0x address (for cooldown check).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
stepsYesTransactions to send in order.
actionYesAlways sequential_txs: send the steps one after the other.
paramsNo
expectedYesShares spent, ETH and USDC expected, and the minimums applied.
gas_hintYesGas limit to set on the Zap step.
compatibilityNo
gas_hint_noteNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.1.5
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "properties": {
      +    "action": {
      +      "description": "Always sequential_txs: send the steps one after the other.",
      +      "type": "string"
      +    },
      +    "compatibility": {
      +      "type": "object"
      +    },
      +    "expected": {
      +      "description": "Shares spent, ETH and USDC expected, and the minimums applied.",
      +      "type": "object"
      +    },
      +    "gas_hint": {
      +      "description": "Gas limit to set on the Zap step.",
      +      "type": "number"
      +    },
      +    "gas_hint_note": {
      +      "type": "string"
      +    },
      +    "params": {
      +      "type": "object"
      +    },
      +    "steps": {
      +      "description": "Transactions to send in order.",
      +      "items": {
      +        "description": "One transaction to send, in order: target, calldata, value in wei, and gas when the step needs an explicit limit. The same call is repeated as to, data and chainId (8453) for wallet batch APIs such as send_calls.",
      +        "type": "object"
      +      },
      +      "type": "array"
      +    }
      +  },
      +  "required": [
      +    "action",
      +    "steps",
      +    "expected",
      +    "gas_hint"
      +  ],
      +  "type": "object"
      +}
  2. First observedv1.1.2

TDQS

A4.6/5.0
Behavior5/5

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

Goes well beyond the annotations by disclosing the exact three-transaction sequence, the all-or-nothing redemption semantics, the non-zero minimum guarantees on every step, wallet handling of surplus ETH, EOA vs ERC-4337/EIP-7702 signing paths, and the cost/fee profile. This is a rich behavioral contract, not a repeat of readOnlyHint/idempotentHint.

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 trigger and the deliverable, then the mechanics; every sentence carries information an agent needs (sequence, minimums, signing model, cost). It is dense and slightly long, but nothing is disposable boilerplate.

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

Completeness5/5

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

With an output schema present, the description needn't explain return values, and it covers the remaining obligations: when to invoke, what gets produced, how many signatures are required, and what the cost surface is. An agent has everything needed to call it correctly.

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, and the description adds real meaning on top: usdc_needed is 'exactly the USDC you need' with a guarantee the swap returns at least that amount, and wallet_address is tied to a cooldown check. Both parameters are given purpose beyond their field-level docs.

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?

States a specific verb and artifact ('get ready-to-broadcast calldata') plus the exact resource pair (GBLIN -> USDC) and the timing constraint (just in time). An agent can distinguish it from invest_usdc_to_gblin (the reverse direction) and prepare_gblin_payment without opening either schema.

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 a clear trigger condition: 'When an x402 invoice (or any USDC obligation) arrives and your treasury sits in GBLIN.' It covers when to use it but never names the sibling to prefer when the treasury is already in USDC or when no obligation exists, so the exclusion side is inferred rather than stated.

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