get-historical-price
Retrieve the Bitcoin price for a specific date in YYYY-MM-DD format using this tool from the Mempool MCP Server, designed for accessing historical BTC price data.
Instructions
Returns the BTC price for a specific date (YYYY-MM-DD)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date | Yes | The date in YYYY-MM-DD format |
Implementation Reference
- src/interface/controllers/GeneralToolsController.ts:39-51 (registration)Registers the MCP tool 'get-historical-price' with description, input schema (date: YYYY-MM-DD Zod validator), and handler function that delegates to GeneralService.getHistoricalPrice and formats response as MCP content.private registerGetHistoricalPriceHandler(): void { this.server.tool( "get-historical-price", "Returns the BTC price for a specific date (YYYY-MM-DD)", { date: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).describe("The date in YYYY-MM-DD format") }, async ({ date }) => { const text = await this.generalService.getHistoricalPrice(date); return { content: [{ type: "text", text }] }; } ); }
- Application layer service method: fetches data from infrastructure request service and formats it using formatResponse helper.async getHistoricalPrice(date: string): Promise<string> { const data = await this.requestService.getHistoricalPrice(date); return formatResponse<any>("Historical Price", data); }
- Infrastructure layer: executes the core logic by making an API request to the mempool.space endpoint `/api/historical-price/{date}` via IApiClient.async getHistoricalPrice(date: string): Promise<any | null> { // date format: YYYY-MM-DD return this.client.makeRequest<any>(`historical-price/${date}`); }