Skip to main content
Glama
alexandresanlim

Mempool MCP Server

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
NameRequiredDescriptionDefault
hashYesThe 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"), },
  • 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}`; }

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/alexandresanlim/mempool-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server