get-block
Retrieve detailed Bitcoin block information using a specific hash with the MCP server’s tool designed for accessing real-time blockchain data.
Instructions
Returns details about a block from hash
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hash | Yes | The hash info to get block |
Implementation Reference
- The handler function that executes the core logic of the 'get-block' tool: fetches block data via BlockService and returns it formatted as MCP text content.async ({ hash }: IHashParameter) => { const text = await this.service.getBlock({ hash }); return { content: [ { type: "text", text: text, }, ], }; }
- Input schema for the 'get-block' tool using Zod: requires a 64-character hash string.{ hash: z.string().length(64).describe("The hash info to get block"), },
- src/interface/controllers/BlockToolsController.ts:19-36 (registration)Registration of the 'get-block' MCP tool on the server, including description, schema, and handler."get-block", "Returns details about a block from hash", { hash: z.string().length(64).describe("The hash info to get block"), }, async ({ hash }: IHashParameter) => { const text = await this.service.getBlock({ hash }); return { content: [ { type: "text", text: text, }, ], }; } );
- Supporting service method in BlockService that fetches block data from BlockRequestService and formats the response.async getBlock({ hash }: IHashParameter): Promise<string> { const data = await this.requestService.getBlock({ hash }); return formatResponse<IBlockResponse>("Details about a block.", data); }