Skip to main content
Glama

call

Execute message calls to blockchain contracts directly without submitting transactions, enabling secure testing and interaction through MetaMask wallet integration.

Instructions

Executing a new message call immediately without submitting a transaction to the network

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toYes
valueNo
dataYes

Implementation Reference

  • Handler function that executes the low-level 'call' action using wagmi/core's call, casting arguments, handling TransactionExecutionError and generic errors, returning JSON-stringified result or error message.
    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 for the 'call' tool defining parameters: to (string address), optional value (number coerced to bigint), data (string calldata).
    parameters: z.object({ to: z.string(), value: z.coerce.number().optional(), data: z.string(), }),
  • Core registration of the 'call' tool on the FastMCP server within registerCallTools, including name, description, schema, and handler.
    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, } ] } } }, });
  • Invocation of the registerCallTools function on the main FastMCP server instance to register 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