Skip to main content
Glama

Build an Earn transaction

earn_build

Build an Earn action for the key's wallet to sign: deposit, withdraw (USDG lent), borrow, repay, addCollateral, withdrawCollateral, revoke, multiply (leverage on a Stock Token in one transaction), repayWithCollateral (sell part of the collateral to repay, max to repay it all), vaultDeposit, vaultWithdraw. Same checks as trnch.fun/earn: listed markets and vaults only, Trnch max LTV, exact approvals, receiver is always the wallet. The Trnch fee (borrow, repay, Multiply) and the swap fee are in preview. Returns { calls, preview, chainId, from }: send calls in order from the key's wallet (chainId 4663); each was simulated on chain before being returned. Nothing is sent by Trnch. multiply and repayWithCollateral: send the calls as one atomic batch (EIP-5792) or, one by one, ALWAYS send the last call (it removes an approval), even if an earlier one failed. Requires an API key (created by wallet signature), sent as Authorization: Bearer .

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": {
      "action": "<action>"
    },
    "name": "earn_build"
  }
}

Input Schema

NameRequiredDescriptionDefault
vaultNoVault address, from earn_markets (vaults).
actionYes
amountNoAmount in token units, or max; borrow also takes ltv:20|35|50|max. repayWithCollateral: collateral to sell.
leverageNomultiply: target leverage, 1.2 up to the Trnch cap, or max.
marketIdNoMorpho market id, from earn_markets (marketId).
collateralNoborrow and multiply: collateral to supply, or wallet for the whole balance.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.6/5.0
Behavior5/5

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

Adds substantial behavior beyond the annotations: every returned call was simulated on chain, nothing is broadcast by Trnch, receiver is always the wallet, checks mirror trnch.fun/earn (listed markets/vaults, max LTV, exact approvals), and API key auth is via Bearer header. It also warns that the last call removes an approval and must be sent even if an earlier call failed, which is exactly the kind of operational caveat annotations cannot express; the non-readOnly/destructive profile is consistent with a build-only tool.

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 purpose and the action list, then layered with safety/auth/batching details in a logical order; nearly every clause earns its place. It is dense and run-on in places (the atomic-batch and auth notes are folded into long sentences), which slightly hurts scanability.

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?

No output schema exists, but the description spells out the return shape ({ calls, preview, chainId, from }), where fees appear, required auth, chain to send on, and batching/ordering rules. For a complex multi-action builder this covers everything an agent needs to call and use 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 high (83%), so the schema already documents vault, amount, leverage, marketId, and collateral. The description still adds real meaning for the tricky actions — multiply as one-transaction leverage on a Stock Token, repayWithCollateral as selling collateral to repay (max to repay all), withdraw as USDG lent, and borrow's ltv: forms — going beyond the bare enum list.

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?

Opens with a specific verb+resource ('Build an Earn action for the key's wallet to sign') and enumerates every supported action (deposit, withdraw, borrow, repay, addCollateral, revoke, multiply, repayWithCollateral, vault/vaultWithdraw). An agent immediately knows this constructs unsigned calls, not a query or a submission, which distinguishes it from earn_quote/earn_position siblings.

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 clear invocation context: the result is for the wallet to sign, calls must be sent in order on chainId 4663, and multiply/repayWithCollateral must go as one atomic batch (EIP-5792) with the last call always sent. It does not explicitly route to earn_quote for previewing fees or state a 'do not use this to send' exclusion against trnch_confirm, so the when-not guidance is implied rather than stated.

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