Skip to main content
Glama

zetrix_get_block

Retrieve detailed information about a specific Zetrix blockchain block by providing its height or number to access transaction data and network state.

Instructions

Get information about a specific block by height

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
blockNumberYesThe block height/number to query

Implementation Reference

  • Tool schema definition including name, description, and input schema requiring blockNumber.
    { 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/index.ts:804-817 (registration)
    Tool registration in the MCP server switch statement, dispatching to 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), }, ], }; }
  • Core handler logic in ZetrixClient.getBlock(): Calls Zetrix API /getLedger with seq parameter, processes response, maps to ZetrixBlock interface, handles errors.
    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; } }

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