Skip to main content
Glama

zetrix_get_block

Retrieve detailed information about a specific block on the Zetrix blockchain by providing its block number or height.

Instructions

Get information about a specific block by height

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
blockNumberYesThe block height/number to query

Implementation Reference

  • Core handler function that performs the RPC call to /getLedger for the specified block number, processes the response, and returns formatted block information.
    async getBlock(blockNumber: number): Promise<ZetrixBlock> { try { const response = await this.client.get("/getLedger", { params: { seq: blockNumber }, }); 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 || blockNumber, 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 block: ${error.message}`); } throw error; } }
  • MCP server dispatch handler for the 'zetrix_get_block' tool call, which extracts the blockNumber argument and invokes ZetrixClient.getBlock().
    case "zetrix_get_block": { if (!args) { throw new Error("Missing arguments"); } const result = await zetrixClient.getBlock(args.blockNumber as number); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; }
  • src/index.ts:83-96 (registration)
    Tool registration entry defining the name, description, and input schema for 'zetrix_get_block' in the MCP tools list.
    { name: "zetrix_get_block", description: "Get information about a specific block by height", inputSchema: { type: "object", properties: { blockNumber: { type: "number", description: "The block height/number to query", }, }, required: ["blockNumber"], }, },
  • TypeScript interface defining the output structure returned by the getBlock handler.
    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