get_marinade_state
Retrieve current protocol state data for Marinade Finance on Solana, including staked assets, rewards, pricing, and mint address information.
Instructions
Retrieve the current state of the Marinade Finance protocol, including information about staked assets, mint address, price, rewards, and other relevant data.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools.ts:98-172 (handler)The core handler function that implements the 'get_marinade_state' tool. It instantiates Marinade, calls getMarinadeState(), serializes the result handling Solana-specific types (PublicKey, BN), circular refs, and returns formatted JSON or error.callback: async () => { try { const marinade = new Marinade() const marinadeStateRaw = await marinade.getMarinadeState(); const visited = new WeakSet(); const marinadeState = JSON.parse(JSON.stringify(marinadeStateRaw, (key, value) => { if (value === null || typeof value !== 'object') { return value; } if (visited.has(value)) { return '[Circular Reference]'; } visited.add(value); if (value && value.constructor?.name === 'PublicKey') { return value.toString(); } if (value && value.constructor?.name === 'BN') { return value.toString(); } const problematicTypes = [ 'Marinade', 'MarinadeReferralProgram', 'RpcWebSocketClient', 'Connection', 'EventEmitter', 'Events' ]; if (value.constructor && problematicTypes.includes(value.constructor.name)) { return '[Filtered Object: ' + value.constructor.name + ']'; } if (typeof value === 'function' || (value && value._events)) { return undefined; } return value; })); return { content: [ { type: "text", text: JSON.stringify(marinadeState, null, 2), }, ], }; } catch (err) { const isAbort = (err as Error)?.name === "AbortError"; return { content: [ { type: "text", text: JSON.stringify( { error: isAbort ? "Request timed out" : "Failed to fetch Marinade State", reason: String((err as Error)?.message ?? err), }, null, 2 ), }, ], }; } }
- src/tools.ts:97-97 (schema)The input schema for the tool, defined as an empty object since the tool requires no input parameters.inputSchema: {},
- src/server.ts:25-43 (registration)Registers all tools from marinadeFinanceTools (including get_marinade_state) with the MCP server using server.registerTool, passing name, schema/details, and a wrapper around the tool's callback.for (const t of marinadeFinanceTools) { server.registerTool( t.name, { title: t.title, description: t.description, inputSchema: t.inputSchema }, async (args) => { const result = await t.callback(args); return { content: result.content.map(item => ({ ...item, type: "text" as const })) }; } ); }