Skip to main content
Glama
tywenk

Model Context Protocol Server for Solana Client

by tywenk

get_fee_for_message

Calculate the transaction fee for a message transfer on Solana by providing sender and recipient public keys along with the lamports amount. Returns fee details.

Instructions

Returns the fee for a message.

Args: from_pubkey (str): Sender's public key to_pubkey (str): Recipient's public key lamports (int): Amount of lamports to transfer

Returns: str: Fee information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
from_pubkeyYes
lamportsYes
to_pubkeyYes

Implementation Reference

  • The handler function for the 'get_fee_for_message' MCP tool. It constructs a Solana transfer message from the input parameters and uses the AsyncClient to retrieve the required fee via get_fee_for_message RPC method. The @mcp.tool() decorator handles registration and schema inference from the signature and docstring.
    @mcp.tool()
    async def get_fee_for_message(from_pubkey: str, to_pubkey: str, lamports: int) -> str:
        """Returns the fee for a message.
    
        Args:
            from_pubkey (str): Sender's public key
            to_pubkey (str): Recipient's public key
            lamports (int): Amount of lamports to transfer
    
        Returns:
            str: Fee information
        """
        async with AsyncClient(rpc_url) as client:
            msg = Message(
                [
                    transfer(
                        TransferParams(
                            from_pubkey=Pubkey.from_string(from_pubkey),
                            to_pubkey=Pubkey.from_string(to_pubkey),
                            lamports=lamports,
                        )
                    )
                ]
            )
            fee = await client.get_fee_for_message(msg)
            return f"Message fee: {fee}"
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool returns fee information but doesn't describe what that entails (e.g., is it a read-only operation, does it simulate a transaction, are there rate limits, or what format the fee information takes). This leaves significant gaps in understanding the tool's behavior beyond basic purpose.

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 appropriately sized and front-loaded, starting with the purpose in the first sentence. The 'Args' and 'Returns' sections are structured clearly, though they could be more integrated. There's minimal waste, but the formatting as a docstring might be slightly verbose for an MCP context.

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

Completeness2/5

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

Given the complexity (a fee calculation tool with 3 parameters), lack of annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects like read-only nature, error conditions, or what the fee information includes (e.g., numeric value, breakdown). For a tool that likely interacts with a blockchain or payment system, more context is needed for effective use.

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

Parameters2/5

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

Schema description coverage is 0%, so the schema provides no parameter details. The description includes an 'Args' section that lists parameters (from_pubkey, to_pubkey, lamports) and their types, adding some meaning beyond the bare schema. However, it doesn't explain what these parameters represent (e.g., lamports as a currency unit, pubkeys as identifiers) or constraints, which is insufficient given the low coverage.

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 tool's purpose: 'Returns the fee for a message.' It specifies the verb ('Returns') and resource ('fee for a message'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'send_transaction' or 'request_airdrop', which might also involve fees or transactions.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing to check fees before sending a transaction), exclusions, or comparisons to sibling tools like 'send_transaction' (which might involve fees) or other fee-related operations. Usage is implied but not explicitly stated.

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

Related 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/tywenk/mcp-sol'

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