get-block-raw
Retrieve raw hexadecimal data for Bitcoin blocks by providing the block hash. This tool enables direct access to complete block information for analysis and processing.
Instructions
Returns raw hex for a block
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hash | Yes | The block hash to get raw hex for |
Implementation Reference
- Core handler function that executes the API call to fetch raw block hex data from the endpoint `block/${hash}/raw`.async getBlockRaw({ hash }: { hash: string }): Promise<string | null> { return this.client.makeRequest<string>(`block/${hash}/raw`); }
- Input schema validation using Zod for the 'hash' parameter (exactly 64 characters).{ hash: z.string().length(64).describe("The block hash to get raw hex for"), },
- src/interface/controllers/BlocksToolsController.ts:75-87 (registration)Registers the 'get-block-raw' tool with the MCP server, specifying name, description, input schema, and thin handler that delegates to BlocksService.private registerGetBlockRawHandler(): void { this.server.tool( "get-block-raw", "Returns raw hex for a block", { hash: z.string().length(64).describe("The block hash to get raw hex for"), }, async ({ hash }) => { const text = await this.blocksService.getBlockRaw({ hash }); return { content: [{ type: "text", text }] }; } ); }
- Helper method in BlocksService that wraps the request service call and adds a descriptive prefix to the raw hex response.async getBlockRaw({ hash }: IHashParameter): Promise<string> { const data = await this.requestService.getBlockRaw({ hash }); return `Block Raw Hex: ${data}`; }