get-transaction
Fetch blockchain transaction details using a transaction hash and chain ID to retrieve specific on-chain data through MetaMask MCP.
Instructions
Fetch transaction given hash or block identifiers.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hash | Yes | Hash to get transaction. | |
| chainId | No | ID of chain to use when fetching data. |
Implementation Reference
- src/tools/get-transaction.ts:16-26 (handler)The async execute function implementing the tool: fetches transaction using wagmi/core's getTransaction and returns JSON stringified result.execute: async (args) => { const result = await getTransaction(wagmiConfig, args); return { content: [ { type: "text", text: JSONStringify(result), }, ], }; },
- src/tools/get-transaction.ts:12-15 (schema)Zod input schema defining parameters: hash (TransactionHash type) and optional chainId.parameters: z.object({ hash: TransactionHash.describe("Hash to get transaction."), chainId: z.coerce.number().optional().describe("ID of chain to use when fetching data."), }),
- src/tools/get-transaction.ts:9-27 (registration)The server.addTool call within registerGetTransactionTools that registers the tool with FastMCP server.server.addTool({ name: "get-transaction", description: "Fetch transaction given hash or block identifiers.", parameters: z.object({ hash: TransactionHash.describe("Hash to get transaction."), chainId: z.coerce.number().optional().describe("ID of chain to use when fetching data."), }), execute: async (args) => { const result = await getTransaction(wagmiConfig, args); return { content: [ { type: "text", text: JSONStringify(result), }, ], }; }, });
- src/tools/register-tools.ts:50-50 (registration)Call to registerGetTransactionTools within the main registerTools function.registerGetTransactionTools(server, wagmiConfig);