Skip to main content
Glama

prepare_marginfi_repay

DestructiveIdempotent

Build an unsigned transaction to repay outstanding debt on MarginFi. Supports partial repayment or full repayment to clear the balance slot.

Instructions

Build an unsigned MarginFi REPAY tx against outstanding debt in the named bank. Pass repayAll: true to repay the full outstanding debt (also clears the balance slot). 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 repay against outstanding debt in this bank.
repayAllNoSet true to repay the full outstanding debt in this bank (SDK also clears the balance slot — cheaper for the user if they're closing out). Omit for partial.
Behavior4/5

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

Annotations indicate destructive and idempotent. Description adds that it builds an unsigned tx, mentions blind-sign on Ledger, and details repayAll behavior (clears balance slot). 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?

Three sentences, front-loaded with core purpose. Each sentence provides essential information without redundancy. Highly efficient.

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, but description clearly states return is an unsigned transaction. Covers prerequisites, parameter behavior, and Ledger consideration. Complete for a transaction-building tool.

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 100% with good descriptions. Description adds meaning: explains symbol resolution to mint, SOL treated as wSOL, repayAll clears slot and is cheaper. Adds value beyond schema.

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 it builds an unsigned MarginFi REPAY transaction against outstanding debt, with specific verb 'repay' and resource 'MarginFi bank'. It distinguishes from siblings by referencing 'prepare_marginfi_supply' for prerequisite pattern.

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?

Provides explicit prerequisites (durable nonce, prepare_marginfi_init) and guidance on repayAll (clears balance slot, cheaper for closing). However, lacks explicit when-not-to-use vs other marginfi tools like borrow or withdraw.

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