Skip to main content
Glama

prepare_marginfi_init

DestructiveIdempotent

Create a deterministic MarginfiAccount PDA for your Solana wallet on MarginFi mainnet. Required before using supply, borrow, or repay actions; rent is reclaimable upon close.

Instructions

One-time setup: build a tx that creates a deterministic MarginfiAccount PDA under the user's wallet on MarginFi mainnet. Uses marginfi_account_initialize_pda so only the wallet (authority + fee_payer) signs — no ephemeral keypair required, Ledger-compatible. PDA seeds are ["marginfi_account", group, wallet, accountIndex, 0], with accountIndex defaulting to 0. After broadcast, prepare_marginfi_supply / withdraw / borrow / repay for this wallet will use this MarginfiAccount automatically. COST: ~0.01698 SOL rent-exempt minimum (for the 2312-byte PDA) + ~0.000005 SOL tx fee. The rent is PAID FROM THE USER WALLET DIRECTLY (not via an ephemeral keypair) and is reclaimable when the MarginfiAccount is closed. Surface this cost to the user before they approve on Ledger — the blind-sign screen only shows a Message Hash, so the user has no on-device check of the balance delta. DURABLE NONCE REQUIRED: this tx carries ix[0] = nonceAdvance (same pattern as every other Solana send in this server), so the wallet must have run prepare_solana_nonce_init first; otherwise this tool errors with a clear pointer. BLIND-SIGN on Ledger (MarginFi's program ID is not in the Solana app's clear-sign registry) — the user matches the Message Hash on-device after preview_solana_send. Refuses if a MarginfiAccount already exists at the derived PDA.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
walletYesSolana wallet that will own the MarginfiAccount PDA. The account is deterministic — seeds (marginfi_account, group, authority, accountIndex, third_party_id=0) produce the same PDA every time. Only the user (authority + fee_payer) signs; no rent-exempt seed is moved (this is a PDA, not a fresh account).
accountIndexNoAccount slot (default 0). Pass a different index to init a second MarginfiAccount under the same wallet.
Behavior5/5

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

The description fully discloses behavior: uses marginfi_account_initialize_pda, PDA seeds, cost details (rent-exempt minimum + tx fee), rent refundability, durable nonce requirement, Ledger blind-sign, and error condition. Annotations (readOnlyHint=false, destructiveHint=true, idempotentHint=true) are consistent with the description; no contradiction.

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?

The description is packed with useful information but is somewhat lengthy. However, it is well-structured: purpose first, then details, cost, prerequisites, and error conditions. Every sentence adds value, so it earns a 4.

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?

Given the complexity of the tool (Solana PDA initialization with Ledger and nonce), the description covers purpose, mechanics, cost, prerequisites, device compatibility, and error conditions. No output schema exists, but the description sufficiently informs the agent of all needed context.

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%. The description adds meaning beyond the schema by explaining the deterministic PDA seeds, default accountIndex, and that wallet is both authority and fee_payer. This provides useful context beyond the basic parameter descriptions.

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 a transaction to create a deterministic MarginfiAccount PDA on MarginFi mainnet. It uses specific verbs ('build a tx that creates') and identifies the resource, and distinguishes from sibling tools by noting it is a one-time setup.

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?

The description explicitly says this is a one-time setup required before supply/borrow/repay/withdraw, that it requires a durable nonce, and that it refuses if the account already exists. It also addresses Ledger compatibility and blind-sign requirements, providing clear when-to-use and prerequisite guidance.

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