get-block-header
Retrieve Bitcoin block header data in hexadecimal format by providing the specific block hash. This tool enables access to blockchain information for analysis and verification purposes.
Instructions
Returns the block header in hex
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hash | Yes | The block hash to get header for |
Implementation Reference
- Core handler logic that makes the API request to fetch the block header hex for the given block hash.async getBlockHeader({ hash }: { hash: string }): Promise<string | null> { return this.client.makeRequest<string>(`block/${hash}/header`); }
- src/interface/controllers/BlocksToolsController.ts:104-116 (registration)Registers the 'get-block-header' MCP tool with server, defining name, description, input schema, and thin handler delegating to service.private registerGetBlockHeaderHandler(): void { this.server.tool( "get-block-header", "Returns the block header in hex", { hash: z.string().length(64).describe("The block hash to get header for"), }, async ({ hash }) => { const text = await this.blocksService.getBlockHeader({ hash }); return { content: [{ type: "text", text }] }; } ); }
- Zod schema for tool input: requires a 64-char hex block hash.{ hash: z.string().length(64).describe("The block hash to get header for"), },
- Intermediate service wrapper that calls the request service and formats the response text.async getBlockHeader({ hash }: { hash: string }): Promise<string> { const data = await this.requestService.getBlockHeader({ hash }); return `Block Header: ${data}`; }