Skip to main content
Glama

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
NameRequiredDescriptionDefault
dataYes
toYes
valueNo

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(), }),
  • 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, } ] } } }, });
  • Top-level invocation of registerCallTools during server setup to include the 'call' tool.
    registerCallTools(server);

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/mcpilot'

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