Skip to main content
Glama
leandrogavidia

Marinade Finance MCP Server

Get Marinade State

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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
                        ),
                    },
                ],
            };
        }
    }
  • 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
                    }))
                };
            }
        );
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states it 'retrieves' data, implying a read-only operation, but doesn't mention potential side effects, rate limits, authentication needs, or response format. For a protocol state tool, details like data freshness or update frequency would be helpful but are absent, leaving significant gaps.

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 a single, well-structured sentence that efficiently conveys the purpose and scope. It's front-loaded with the main action and includes relevant examples without unnecessary detail. However, it could be slightly more concise by omitting 'and other relevant data' if the listed items are comprehensive.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (protocol state retrieval), lack of annotations, and no output schema, the description is minimally adequate. It covers what data is retrieved but doesn't explain the return format, potential errors, or operational constraints. For a tool with no structured behavioral hints, more context on data structure or usage limits would improve completeness.

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?

The tool has 0 parameters, and schema description coverage is 100%, so no parameter documentation is needed. The description doesn't add param info beyond the schema, but with no params, this is acceptable. A baseline of 4 is appropriate as it doesn't need to compensate for any gaps.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Retrieve') and resource ('current state of the Marinade Finance protocol'), with specific examples of what's included ('staked assets, mint address, price, rewards, and other relevant data'). It distinguishes from siblings like 'get_msol_balance' by covering broader protocol state rather than just balance. However, it doesn't explicitly contrast with all siblings, preventing a perfect score.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives. For example, it doesn't specify if this should be used for general protocol overview versus more specific operations like 'stake_msol' or 'send_msol', nor does it mention prerequisites or context for usage. The description implies a read-only operation but lacks explicit usage rules.

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/leandrogavidia/marinade-finance-mcp-server'

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