Skip to main content
Glama

Prepare a loan

build_borrow
Read-onlyIdempotent

Returns the unsigned transactions to open a loan: an approval (only if needed) then openLoan. Includes the quote and warnings. The user's wallet must sign and send each step in order.

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": {
      "asset": "<asset>",
      "collateral_amount": "<collateral_amount>",
      "term": "<term>",
      "borrower": "<borrower>"
    },
    "name": "build_borrow"
  }
}

Input Schema

NameRequiredDescriptionDefault
termYesLoan term: short, medium or long (or 0/1/2). Durations and costs come from get_protocol_info.
assetYesToken contract address on Base (preferred) or its symbol, e.g. WETH, VIRTUAL, esALB
borrowerYesWallet that will sign; used to skip unneeded approvals and check balances
loan_amount_usdcNoLoan amount before the fee, in USDC. Omit to borrow the most the collateral allows
collateral_amountYesCollateral to offer, in token units, e.g. 0.5. It is a maximum: only what the loan needs is taken
max_shortfall_bpsNoMax gap between requested and funded amount in basis points. Omit for the protocol default.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changed
    • addedInput schema / properties / collateral_amount / description
      Added value: +"Collateral to offer, in token units, e.g. 0.5. It is a maximum: only what the loan needs is taken"
    • removedInput schema / properties / loan_amount_usdc / $ref
      Removed value: -"#/properties/collateral_amount"
    • addedInput schema / properties / loan_amount_usdc / description
      Added value: +"Loan amount before the fee, in USDC. Omit to borrow the most the collateral allows"
    • addedInput schema / properties / loan_amount_usdc / pattern
      Added value: +"^\\d+(\\.\\d+)?$"
    • addedInput schema / properties / loan_amount_usdc / type
      Added value: +"string"
  2. First observed

TDQS

A3.8/5.0
Behavior4/5

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

With annotations already declaring readOnlyHint, idempotent, and non-destructive, the description adds real value beyond them: it discloses that the output is unsigned, that approval is conditional, that the quote and warnings are bundled in, and that signing/sending is the caller's responsibility. This is the key behavioral fact an agent needs for a transaction-builder and it is stated plainly.

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

Conciseness5/5

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

Two sentences, both front-loaded with the highest-value facts: what is returned and what the caller must do with it. No filler, no restating of the name or title.

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 six-parameter transaction-builder with no output schema, the description compensates by enumerating the return shape (approval step, openLoan step, quote, warnings) and the signing obligation. What remains thin is how to handle the warnings or partial-fill outcomes, but the essentials for correct invocation are present.

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%, and the parameter descriptions themselves cover term encodings, collateral-as-maximum semantics, and shortfall handling in more detail than the tool description. The description adds no parameter-level meaning, so the baseline 3 applies.

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 states a specific outcome — it returns unsigned transactions (an approval, then openLoan) to open a loan — which tells an agent exactly what the tool produces rather than just repeating 'build_borrow'. It implicitly separates itself from quote_borrow (this one yields signable transactions) but never names a sibling, so the differentiation is inferred rather than explicit.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is workflow guidance — the wallet must sign and send each step in order, and the approval appears only if needed — which tells the agent how to sequence the result. However, there is no guidance on when to prefer this over quote_borrow, simulate_transaction, or get_loan, and no stated prerequisites or exclusions.

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.