Skip to main content
Glama

zetrix_get_latest_block

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

Instructions

Get the latest block information from Zetrix blockchain

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core implementation of getLatestBlock method in ZetrixClient class. Fetches latest ledger via GET /getLedger RPC, processes header into structured ZetrixBlock, handles errors.
    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 tool handler in switch statement: calls zetrixClient.getLatestBlock() and returns JSON-formatted result as MCP content.
    case "zetrix_get_latest_block": { const result = await zetrixClient.getLatestBlock(); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; }
  • Tool schema definition: name, description, and empty inputSchema (no parameters required).
    { name: "zetrix_get_latest_block", description: "Get the latest block information from Zetrix blockchain", inputSchema: { type: "object", properties: {}, }, },
  • src/index.ts:819-829 (registration)
    Tool registration in the CallToolRequestSchema switch dispatcher.
    case "zetrix_get_latest_block": { const result = await zetrixClient.getLatestBlock(); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; }

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