Skip to main content
Glama

helius_get_fee_for_message

Check the transaction fee for a base64-encoded Solana message using commitment levels (confirmed, finalized, processed) with MCP Helius.

Instructions

Get the fee for a serialized message

Input Schema

NameRequiredDescriptionDefault
commitmentNo
messageYesBase64 encoded message string

Input Schema (JSON Schema)

{ "properties": { "commitment": { "enum": [ "confirmed", "finalized", "processed" ], "type": "string" }, "message": { "description": "Base64 encoded message string", "type": "string" } }, "required": [ "message" ], "type": "object" }

Implementation Reference

  • The main handler function implementing the tool logic: deserializes base64-encoded message to VersionedMessage and retrieves the fee using Helius Solana connection.
    export const getFeeForMessageHandler = async (input: GetFeeForMessageInput): Promise<ToolResultSchema> => { try { const messageBytes = Buffer.from(input.message, 'base64'); const versionedMessage = VersionedMessage.deserialize(messageBytes); const fee = await (helius as any as Helius).connection.getFeeForMessage(versionedMessage, input.commitment); return createSuccessResponse(`Fee for message: ${JSON.stringify(fee, null, 2)}`); } catch (error) { return createErrorResponse(`Error getting fee for message: ${error instanceof Error ? error.message : String(error)}`); } }
  • MCP tool registration including the tool name and input schema definition for validation.
    { name: 'helius_get_fee_for_message', description: 'Get the fee for a serialized message', inputSchema: { type: 'object', properties: { message: { type: 'string', description: 'Base64 encoded message string' }, commitment: { type: 'string', enum: ['confirmed', 'finalized', 'processed'] } }, required: ['message'] } },
  • src/tools.ts:589-589 (registration)
    Maps the tool name to its handler function in the handlers dictionary.
    "helius_get_fee_for_message": getFeeForMessageHandler,
  • TypeScript type definition for the handler input, used for type checking.
    export type GetFeeForMessageInput = { message: string; // Base64 encoded message string commitment?: "confirmed" | "finalized" | "processed"; }

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/dcSpark/mcp-server-helius'

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