wait-for-transaction-receipt
Waits for blockchain transaction confirmation and returns the receipt after inclusion in a block.
Instructions
Waits for the transaction to be included on a block, and then returns the transaction receipt
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hash | Yes | ||
| chainId | No |
Implementation Reference
- The handler function that executes the tool logic: waits for the transaction receipt using wagmi/core's waitForTransactionReceipt, stringifies the result or error message and returns as MCP content.execute: async (args) => { try { const hash = args.hash as Address const chainId = args.chainId as typeof wagmiConfig['chains'][number]['id'] const result = await waitForTransactionReceipt(wagmiConfig, { hash, chainId, }) return { content: [ { type: "text", text: JSONStringify(result), }, ], } } catch (error) { return { content: [ { type: "text", text: (error as Error).message, }, ], } } },
- Zod input schema defining required 'hash' (string) and optional 'chainId' (number).parameters: z.object({ hash: z.string(), chainId: z.coerce.number().optional(), }),
- The registration function that defines and adds the tool to the FastMCP server instance.export function registerWaitForTransactionReceiptTools(server: FastMCP): void { server.addTool({ name: "wait-for-transaction-receipt", description: "Waits for the transaction to be included on a block, and then returns the transaction receipt", parameters: z.object({ hash: z.string(), chainId: z.coerce.number().optional(), }), execute: async (args) => { try { const hash = args.hash as Address const chainId = args.chainId as typeof wagmiConfig['chains'][number]['id'] const result = await waitForTransactionReceipt(wagmiConfig, { hash, chainId, }) return { content: [ { type: "text", text: JSONStringify(result), }, ], } } catch (error) { return { content: [ { type: "text", text: (error as Error).message, }, ], } } }, }); };
- packages/metamask-mcp/src/index.ts:59-59 (registration)Top-level call to register the wait-for-transaction-receipt tool during server initialization.registerWaitForTransactionReceiptTools(server);