get-tx-raw
Retrieve raw hexadecimal data for any Bitcoin transaction using its transaction ID (txid). Includes schema validation for accurate query execution.
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-59 (registration)Registers the MCP tool 'get-tx-raw' including input schema (txid: string length 64), description, and handler function that fetches raw tx via TxService and returns as text content.private 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 delegates to TxRequestService.getTxRaw and adds a prefix to the raw hex string.async getTxRaw({ txid }: { txid: string }): Promise<string> { const data = await this.requestService.getTxRaw({ txid }); return `Transaction Raw Hex: ${data}`; }
- Performs the actual API request to retrieve the raw transaction hex using the API client.async getTxRaw({ txid }: { txid: string }): Promise<string | null> { return this.client.makeRequest<string>(`tx/${txid}/raw`); }