Skip to main content
Glama

prepare_marginfi_borrow

DestructiveIdempotent

Build an unsigned borrow transaction on MarginFi using your collateral. Pre-flight validation prevents failed transactions when free collateral is zero.

Instructions

Build an unsigned MarginFi BORROW tx against the user's supplied collateral. Pre-flight refuses if the account has zero free collateral. The SDK computes the required oracle-refresh instructions and the health-factor gate is enforced on-chain — but this tool is the right place to surface a clear error rather than burning SOL on a reverting tx. DURABLE NONCE + prepare_marginfi_init prerequisites identical to prepare_marginfi_supply. BLIND-SIGN on Ledger.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
walletYesBase58 Solana mainnet address (ed25519 pubkey, 43 or 44 chars).
symbolNoCanonical token symbol (USDC, SOL, USDT, JUP, BONK, JTO, mSOL, jitoSOL). The builder resolves this to the underlying mint; MarginFi treats SOL as wSOL internally with auto-wrap/unwrap. Pass `mint` instead if your token isn't in the canonical list.
mintNoBase58 SPL mint address. Used as an override or when the token isn't in the canonical SOLANA_TOKENS table. Exactly one of `symbol` or `mint` must be passed.
accountIndexNoMarginfiAccount slot (0 = first, 1 = second, ...). Most users stay on 0. Use a different index to segregate positions across multiple MarginfiAccounts owned by the same wallet.
amountYesHuman-readable decimal amount to borrow. Pre-flight refuses if the account has zero free collateral.
Behavior5/5

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

Annotations already indicate destructiveHint=true and idempotentHint=true. The description adds significant behavioral details: pre-flight check for free collateral, SDK computes oracle refreshes, health-factor gate enforced on-chain, and error surfacing. No contradiction with annotations.

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?

The description is concise (three sentences) and front-loaded with the core action. Every sentence serves a purpose: defining the tool, stating pre-flight behavior, noting on-chain enforcement, and listing prerequisites. No redundancy.

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?

Given the complexity of a borrow transaction and the absence of an output schema, the description covers key aspects: what it builds, pre-flight, prerequisites, and Ledger signing. It does not explicitly state the return format (unsigned transaction), but the purpose implies it. Sibling tools are many, but the description sufficiently differentiates from other prepare_marginfi tools.

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 coverage is 100%, so baseline is 3. The description does not add much meaning beyond the schema's already detailed parameter descriptions (e.g., 'symbol' and 'mint' are well-documented). The description mentions 'human-readable decimal amount' but that's also in the schema. Minimal extra value.

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?

The description clearly states the tool builds an unsigned MarginFi BORROW transaction against supplied collateral. It specifies the action (borrow), protocol (MarginFi), and distinguishes from similar tools like prepare_marginfi_supply by noting identical prerequisites. The pre-flight condition for free collateral adds clarity.

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?

The description provides usage context: prerequisites (DURABLE NONCE + prepare_marginfi_init) are identical to prepare_marginfi_supply, and the tool surfaces clear errors instead of reverting on-chain. It mentions Ledger blind-sign, which guides signing. However, it does not explicitly state when not to use this tool versus alternatives like Kamino borrow.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/szhygulin/recon-crypto-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server