get-blocks
Retrieve recent Bitcoin blockchain data to monitor network activity and analyze transaction patterns using real-time mempool information.
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 tool 'get-blocks' with empty input schema. The inline handler fetches latest blocks using BlocksService.getBlocks() and returns the formatted text as MCP 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 }] }; } ); }
- BlocksService.getBlocks(): Delegates to BlocksRequestService.getBlocks() and formats the response using formatResponse for JSON string output.async getBlocks(): Promise<string> { const data = await this.requestService.getBlocks(); return formatResponse<IBlocksResponse[]>("Blocks", data); }
- Core implementation: Makes an API request to the 'blocks' endpoint using IApiClient.makeRequest to fetch the latest blocks data.async getBlocks(): Promise<IBlocksResponse[] | null> { return this.client.makeRequest<IBlocksResponse[]>(`blocks`); }