call
Execute immediate message calls on the blockchain without submitting a transaction, enabling direct interactions with smart contracts while bypassing network confirmation delays.
Instructions
Executing a new message call immediately without submitting a transaction to the network
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | ||
| to | Yes | ||
| value | No |
Implementation Reference
- The main handler function that performs the contract message call using wagmi/core's call, handles the result and errors.execute: async (args) => { try { const to = args.to as Address const value = args.value ? BigInt(args.value) : undefined const data = args.data as Address const result = await call(wagmiConfig, { to, value, data, }) return { content: [ { type: "text", text: JSONStringify({ hash: result }), }, ], } } catch (error) { if (error instanceof TransactionExecutionError) { return { content: [ { type: "text", text: error.cause.message, } ] } } return { content: [ { type: "text", text: (error as Error).message, } ] } } },
- Zod input schema defining parameters: to (contract address), optional value, and calldata.parameters: z.object({ to: z.string(), value: z.coerce.number().optional(), data: z.string(), }),
- packages/metamask-mcp/src/tools/call.ts:9-58 (registration)Direct registration of the 'call' tool using FastMCP's addTool method inside registerCallTools.server.addTool({ name: "call", description: "Executing a new message call immediately without submitting a transaction to the network", parameters: z.object({ to: z.string(), value: z.coerce.number().optional(), data: z.string(), }), execute: async (args) => { try { const to = args.to as Address const value = args.value ? BigInt(args.value) : undefined const data = args.data as Address const result = await call(wagmiConfig, { to, value, data, }) return { content: [ { type: "text", text: JSONStringify({ hash: result }), }, ], } } catch (error) { if (error instanceof TransactionExecutionError) { return { content: [ { type: "text", text: error.cause.message, } ] } } return { content: [ { type: "text", text: (error as Error).message, } ] } } }, });
- packages/metamask-mcp/src/index.ts:39-39 (registration)Top-level invocation of registerCallTools during server setup to include the 'call' tool.registerCallTools(server);