get-block-raw
Retrieve raw hex data for a specific Bitcoin block by providing its unique hash using the Mempool MCP Server tool designed for accessing real-time blockchain information.
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
- src/interface/controllers/BlocksToolsController.ts:75-87 (registration)Registers the MCP 'get-block-raw' tool with input schema for block hash and a handler that fetches raw block data via BlocksService and returns it as text content.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 }] }; } ); }
- Core implementation of fetching raw block hex by making an API request to the endpoint `block/${hash}/raw` using IApiClient.async getBlockRaw({ hash }: { hash: string }): Promise<string | null> { return this.client.makeRequest<string>(`block/${hash}/raw`); }
- Helper service method that delegates to BlocksRequestService and adds a 'Block Raw Hex:' prefix to the raw data.async getBlockRaw({ hash }: IHashParameter): Promise<string> { const data = await this.requestService.getBlockRaw({ hash }); return `Block Raw Hex: ${data}`; }
- Zod input schema validating the block hash as a 64-character string.{ hash: z.string().length(64).describe("The block hash to get raw hex for"), },