get-transaction
Retrieve blockchain transactions using specific hashes or chain identifiers with the MCPilot server, enabling secure and direct interaction with blockchains through MetaMask.
Instructions
Get the transactions given hashes or chain identifiers
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chainId | No | ||
| hash | Yes |
Implementation Reference
- Handler function that fetches the transaction details using wagmi's getTransaction and returns it as JSON string.execute: async (args) => { const hash = args.hash as Address const chainId = args.chainId as typeof wagmiConfig['chains'][number]['id'] const result = await getTransaction(wagmiConfig, { hash, chainId, }) return { content: [ { type: "text", text: JSONStringify(result), }, ], } },
- Input schema using Zod: hash (string), chainId (optional number).parameters: z.object({ hash: z.string(), chainId: z.coerce.number().optional(), }),
- packages/metamask-mcp/src/tools/get-transaction.ts:8-33 (registration)Function that registers the get-transaction tool on the FastMCP server, including name, description, schema, and handler.export function registerGetTransactionTools(server: FastMCP): void { server.addTool({ name: "get-transaction", description: "Get the transactions given hashes or chain identifiers", parameters: z.object({ hash: z.string(), chainId: z.coerce.number().optional(), }), execute: async (args) => { const hash = args.hash as Address const chainId = args.chainId as typeof wagmiConfig['chains'][number]['id'] const result = await getTransaction(wagmiConfig, { hash, chainId, }) return { content: [ { type: "text", text: JSONStringify(result), }, ], } }, }); };
- packages/metamask-mcp/src/index.ts:53-53 (registration)Top-level registration call that adds the get-transaction tool to the main MetaMask MCP server.registerGetTransactionTools(server);