Skip to main content
Glama

wait-for-transaction-receipt

Waits for blockchain transaction confirmation and returns the receipt after specified confirmations, enabling reliable transaction status verification.

Instructions

Waits for the transaction to be included on a block, and then returns the transaction receipt.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hashYesThe transaction hash to wait for.
confirmationsNoThe number of confirmations (blocks that have passed) to wait before resolving.
chainIdNoID of chain to use when fetching data.

Implementation Reference

  • The execute handler for the 'wait-for-transaction-receipt' tool. It awaits wagmi's waitForTransactionReceipt with the config and args, then returns the JSON-stringified result in MCP content format or the error message on failure.
    execute: async (args) => { try { const result = await waitForTransactionReceipt(wagmiConfig, args); return { content: [ { type: "text", text: JSONStringify(result), }, ], }; } catch (error) { return { content: [ { type: "text", text: (error as Error).message, }, ], }; } },
  • Zod schema for the tool's input parameters: hash (TransactionHash), optional confirmations (default 0), optional chainId.
    parameters: z.object({ hash: TransactionHash.describe("The transaction hash to wait for."), confirmations: z.coerce.number().optional().default(0).describe("The number of confirmations (blocks that have passed) to wait before resolving."), chainId: z.coerce.number().optional().describe("ID of chain to use when fetching data."), }),
  • The tool registration function exported from the file, which calls server.addTool to register the tool with name, description, schema, and handler.
    export function registerWaitForTransactionReceiptTools(server: FastMCP, wagmiConfig: Config): 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: TransactionHash.describe("The transaction hash to wait for."), confirmations: z.coerce.number().optional().default(0).describe("The number of confirmations (blocks that have passed) to wait before resolving."), chainId: z.coerce.number().optional().describe("ID of chain to use when fetching data."), }), execute: async (args) => { try { const result = await waitForTransactionReceipt(wagmiConfig, args); return { content: [ { type: "text", text: JSONStringify(result), }, ], }; } catch (error) { return { content: [ { type: "text", text: (error as Error).message, }, ], }; } }, }); };
  • Invocation of the tool's registration function within the central registerTools function that sets up all tools on the server.
    registerWaitForTransactionReceiptTools(server, wagmiConfig);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Xiawpohr/metamask-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server