get-tx-raw
Retrieve the raw hexadecimal data for any Bitcoin transaction by providing its transaction ID (txid). This tool enables developers to access complete transaction details directly from the Bitcoin blockchain for analysis, verification, or integration purposes.
Instructions
Returns raw hex for a transaction
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| txid | Yes | The txid to get raw hex for |
Implementation Reference
- src/interface/controllers/TxToolsController.ts:48-60 (registration)Registration of the MCP tool 'get-tx-raw', including input schema (txid: string length 64) and handler that delegates to TxService.getTxRaw and formats responseprivate registerGetTxRawHandler(): void { this.server.tool( "get-tx-raw", "Returns raw hex for a transaction", { txid: z.string().length(64).describe("The txid to get raw hex for"), }, async ({ txid }) => { const text = await this.txService.getTxRaw({ txid }); return { content: [{ type: "text", text }] }; } ); }
- TxService.getTxRaw method: fetches raw tx from request service and prefixes with 'Transaction Raw Hex: 'async getTxRaw({ txid }: { txid: string }): Promise<string> { const data = await this.requestService.getTxRaw({ txid }); return `Transaction Raw Hex: ${data}`; }
- TxRequestService.getTxRaw: makes API request to `/tx/{txid}/raw` endpoint to retrieve raw transaction hexasync getTxRaw({ txid }: { txid: string }): Promise<string | null> { return this.client.makeRequest<string>(`tx/${txid}/raw`); }