Skip to main content
Glama

prepare_marginfi_borrow

DestructiveIdempotent

Prepare an unsigned borrow transaction from your MarginFi collateral with automatic oracle updates and on-chain health enforcement.

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?

Discloses that tool builds unsigned transaction, includes pre-flight checks, SDK computes oracle-refresh, health-factor gate enforced on-chain, and BLIND-SIGN on Ledger. Adds value beyond annotations.

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?

Multiple sentences but each adds value. Slightly longer but well-structured and front-loaded with key info.

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?

Covers purpose, behavior, prerequisites, parameter nuances, and Ledger note. No missing context given no output schema. Complete for a borrow transaction builder.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

All 5 parameters have schema descriptions. Description adds meaning: symbol resolution to mint, SOL/wSOL handling, accountIndex default, and human-readable amount. No gaps.

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?

Explicitly states 'Build an unsigned MarginFi BORROW tx', including pre-flight checks and prerequisites. Clearly distinguishes from sibling tools like prepare_marginfi_supply.

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

Usage Guidelines5/5

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

Mentions prerequisites (durable nonce, prepare_marginfi_init), advises using mint if token not in canonical list, and explains pre-flight refuses on zero collateral. Implicitly warns against use when no collateral available.

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/vaultpilot-mcp'

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