Skip to main content
Glama

zetrix_get_ledger

Retrieve blockchain block or ledger data from the Zetrix network, with options to include validator lists, consensus values, and fee configurations for detailed analysis.

Instructions

Get block/ledger information with optional details

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
seqNoBlock sequence number (optional)
withValidatorNoInclude validator list (optional)
withConsValueNoInclude consensus value (optional)
withFeeNoInclude fee configuration (optional)

Implementation Reference

  • Core handler function that executes the getLedger logic by making an HTTP GET request to the Zetrix API endpoint "/getLedger" with optional parameters for sequence, validators, consensus value, and fees. Handles errors and returns formatted ledger data.
    async getLedger( seq?: number, withValidator?: boolean, withConsValue?: boolean, withFee?: boolean ): Promise<ZetrixLedger> { try { const params: any = {}; if (seq) params.seq = seq; if (withValidator) params.with_validator = withValidator; if (withConsValue) params.with_consvalue = withConsValue; if (withFee) params.with_fee = withFee; const response = await this.client.get("/getLedger", { params }); if (response.data.error_code !== 0) { throw new Error( response.data.error_desc || `API Error: ${response.data.error_code}` ); } return response.data.result; } catch (error) { if (axios.isAxiosError(error)) { throw new Error(`Failed to get ledger: ${error.message}`); } throw error; } }
  • MCP server tool handler case that parses input arguments and delegates execution to ZetrixClient.getLedger method, then formats the response as MCP content.
    case "zetrix_get_ledger": { const result = await zetrixClient.getLedger( args?.seq as number | undefined, args?.withValidator as boolean | undefined, args?.withConsValue as boolean | undefined, args?.withFee as boolean | undefined ); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; }
  • src/index.ts:229-253 (registration)
    MCP tool registration including name, description, and input schema definition for validation.
    { name: "zetrix_get_ledger", description: "Get block/ledger information with optional details", inputSchema: { type: "object", properties: { seq: { type: "number", description: "Block sequence number (optional)", }, withValidator: { type: "boolean", description: "Include validator list (optional)", }, withConsValue: { type: "boolean", description: "Include consensus value (optional)", }, withFee: { type: "boolean", description: "Include fee configuration (optional)", }, }, }, },
  • TypeScript interface defining the structure of the ledger response data (output schema).
    export interface ZetrixLedger { header: { seq: number; hash: string; previous_hash: string; account_tree_hash: string; close_time: number; consensus_value_hash: string; fees_hash: string; tx_count: number; validators_hash: string; version: number; }; transactions?: any[]; validators?: any[]; consensus_value?: any; fees?: any; }

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/Zetrix-Chain/zetrix-mcp-server'

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