Skip to main content
Glama

zetrix_get_latest_block

Retrieve current block data from the Zetrix blockchain to monitor network status and access transaction information.

Instructions

Get the latest block information from Zetrix blockchain

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler implementation: Queries Zetrix RPC /getLedger endpoint (without seq param) to fetch latest block data, processes response into ZetrixBlock interface.
    async getLatestBlock(): Promise<ZetrixBlock> { try { // Get latest ledger without seq parameter const response = await this.client.get("/getLedger"); if (response.data.error_code !== 0) { throw new Error( response.data.error_desc || `API Error: ${response.data.error_code}` ); } const block = response.data.result.header; return { blockNumber: block.seq, closeTime: block.close_time || 0, hash: block.hash || "", prevHash: block.previous_hash || "", txCount: block.tx_count || 0, transactions: response.data.result.transactions, }; } catch (error) { if (axios.isAxiosError(error)) { throw new Error(`Failed to get latest block: ${error.message}`); } throw error; } }
  • MCP server tool handler: switch case that invokes ZetrixClient.getLatestBlock() and formats response for MCP protocol.
    case "zetrix_get_latest_block": { const result = await zetrixClient.getLatestBlock(); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; }
  • Tool schema definition and registration in tools[] array used by MCP ListToolsRequestHandler.
    { name: "zetrix_get_latest_block", description: "Get the latest block information from Zetrix blockchain", inputSchema: { type: "object", properties: {}, }, },
  • TypeScript interface defining the return type structure for block data.
    export interface ZetrixBlock { blockNumber: number; closeTime: number; hash: string; prevHash: string; txCount: number; transactions?: 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