Skip to main content
Glama

Build repay

build_repay
Read-only

Build the steps that repay debt. 'auto' requires slippage; 'manual' repays from the owner's wallet. Returns UNSIGNED transaction steps for the owner to sign in order; this server never holds keys or sends transactions. The build expires after 180 seconds (expiresAt, unix ms): build immediately before signing, not as a plan for later. Builds are single-use: rebuilding an open predicts a different position address, so never replay one. A successful build does not guarantee a successful transaction: pass steps to simulate and check ok before asking anyone to sign. Any build the owner funds (open, adjust push, manual repay), zap-in or not, gets 422 insufficient_balance (token, required, available) when the owner holds less than it pulls.

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": {
      "chainId": "<chainId>",
      "positionAddress": "<positionAddress>",
      "strategyId": "<strategyId>",
      "mode": "<mode>",
      "owner": "<owner>",
      "repayAmount": "<repayAmount>"
    },
    "name": "build_repay"
  }
}

Input Schema

NameRequiredDescriptionDefault
modeYes
ownerYesEOA that owns the position and signs the steps. The smart account is derived from it server-side.
chainIdYesEVM chain id
slippageNoSlippage tolerance as a decimal: 0.005 means 0.5% (not 1e18 fixed-point)
strategyIdYesStrategy id from list_strategies (`strategyId`)
repayAmountYes
approvalModeNo'manual' only
forceSwapperNo'auto' only. Retry only: route the swap through the swapper instead of the routing engine. Set it when simulate reports a build as failing, then rebuild.
withdrawAmountNo'auto' only
positionAddressYesPosition (vault) address

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.2/5.0
Behavior5/5

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

Beyond the annotations, it discloses the 180-second `expiresAt` window, single-use semantics with the concrete consequence of address drift on rebuild, the fact that the server never holds keys or sends transactions, and the exact 422 `insufficient_balance` payload shape. The replay warning and the 'successful build is not a successful transaction' caveat are exactly the traits an agent would otherwise get wrong.

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?

Purpose is front-loaded in the first clause, then constraints follow in descending importance. It is dense but nearly every clause is load-bearing; the parenthetical error-shape detail is slightly heavy for a description but earns its place by enabling error handling without a failed call.

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 10-parameter, 6-required builder with no output schema, the description covers lifecycle (expiry, single-use), safety (no keys, unsigned), verification (simulate/`ok`), and the main failure mode. The remaining gaps are the amount units and the quote-vs-build relationship, which matter for a financial tool but are secondary to what is already documented.

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 already 80%, so the schema documents owner, slippage units, strategyId provenance, and the mode-scoped optional params. The description still adds value the schema lacks: slippage is conditionally required for `auto`, and the balance precondition is tied to which modes pull owner funds. It does not explain `repayAmount` / `withdrawAmount` units, which remain unstated in both places.

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?

"Build the steps that repay debt" states a specific verb (build) and resource (repay steps), and the mode sentence clarifies the two repay paths. It does not, however, distinguish itself from the sibling quote_repay or from build_close, so an agent must infer the quote-vs-build split on its own.

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?

Strong operational guidance: build immediately before signing rather than as a later plan, pass the result to `simulate` first, `auto` requires slippage while `manual` repays from the owner's wallet. What is missing is the upstream routing — nothing says to call quote_repay first or when to prefer build_repay over build_close for a position being wound down.

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