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
| Name | Required | Description | Default |
|---|---|---|---|
| commitment | No | ||
| message | Yes | Base64 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
- src/handlers/helius.ts:508-517 (handler)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)}`); } }
- src/tools.ts:504-515 (schema)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,
- src/handlers/helius.types.ts:270-273 (schema)TypeScript type definition for the handler input, used for type checking.export type GetFeeForMessageInput = { message: string; // Base64 encoded message string commitment?: "confirmed" | "finalized" | "processed"; }