get_transaction
Retrieve detailed transaction information from the Algorand blockchain by providing the transaction ID. Use this tool to access specific transaction data for analysis or verification on the Algorand MCP Server.
Instructions
Get transaction details by transaction ID
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| txId | Yes | Transaction ID |
Input Schema (JSON Schema)
{
"properties": {
"txId": {
"description": "Transaction ID",
"type": "string"
}
},
"required": [
"txId"
],
"type": "object"
}
Implementation Reference
- src/index.ts:702-725 (handler)MCP tool handler for 'get_transaction': parses input arguments using Zod schema, fetches transaction details via algorandService, and returns formatted response or error.case 'get_transaction': { const parsed = GetTransactionArgsSchema.parse(args); try { const txInfo = await algorandService.getTransaction(parsed.txId); return { content: [ { type: 'text', text: `Transaction Information:\n${JSON.stringify(txInfo, null, 2)}`, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error getting transaction: ${error}`, }, ], isError: true, }; } }
- src/algorand.ts:330-337 (helper)Core helper method in AlgorandService that retrieves transaction information by txId using the Algorand algod client.async getTransaction(txId: string) { try { const txInfo = await this.algodClient.pendingTransactionInformation(txId).do(); return txInfo; } catch (error) { throw new Error(`Failed to get transaction: ${error}`); } }
- src/index.ts:75-77 (schema)Zod schema defining the input structure for the get_transaction tool (requires txId string).const GetTransactionArgsSchema = z.object({ txId: z.string(), });
- src/index.ts:309-321 (registration)Tool registration in the TOOLS array, defining name, description, and JSON input schema for MCP server.{ name: 'get_transaction', description: 'Get transaction details by transaction ID', inputSchema: { type: 'object', properties: { txId: { type: 'string', description: 'Transaction ID', }, }, required: ['txId'], },