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
| Name | Required | Description | Default |
|---|---|---|---|
| blockNumber | Yes | The block height/number to query |
Implementation Reference
- src/zetrix-client.ts:212-239 (handler)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; } }
- src/index.ts:804-817 (handler)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"], }, },
- src/zetrix-client.ts:26-33 (schema)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[]; }