get-blocks
Retrieve the latest Bitcoin blocks in real-time using the Mempool MCP Server, enabling access to up-to-date blockchain data for AI and analytics applications.
Instructions
Returns the latest blocks
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/interface/controllers/BlocksToolsController.ts:21-31 (registration)Registers the MCP 'get-blocks' tool on the server with no input parameters and an async handler that fetches blocks via BlocksService and returns formatted text content.private registerGetBlocksHandler(): void { this.server.tool( "get-blocks", "Returns the latest blocks", {}, async () => { const text = await this.blocksService.getBlocks(); return { content: [{ type: "text", text }] }; } ); }
- Handler method in BlocksService that retrieves blocks data from the request service and formats it using formatResponse.async getBlocks(): Promise<string> { const data = await this.requestService.getBlocks(); return formatResponse<IBlocksResponse[]>("Blocks", data); }
- Core handler implementation in BlocksRequestService that performs the actual API request to the 'blocks' endpoint using IApiClient.async getBlocks(): Promise<IBlocksResponse[] | null> { return this.client.makeRequest<IBlocksResponse[]>(`blocks`); }