Skip to main content
Glama

eth_call

Execute smart contract calls without creating blockchain transactions to read data, test functions, or simulate contract interactions on EVM networks.

Instructions

Executes a new message call immediately without creating a transaction

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
blockNumberNoBlock number or 'latest', 'earliest', 'pending'latest
dataYesData to send (hex string)
fromNoFrom address (optional)
gasNoGas limit (optional)
gasPriceNoGas price (optional)
toYesContract address
valueNoValue in wei (optional)

Implementation Reference

  • The handler function for the 'eth_call' tool. It constructs a transaction object from the input parameters and uses the makeRPCCall helper to execute the eth_call RPC method via the ethers provider, then formats and returns the result.
    async ({ to, data, blockNumber, from, value, gas, gasPrice }) => {
      try {
        const txObject: any = {
          to,
          data,
        };
    
        if (from) txObject.from = from;
        if (value) txObject.value = value;
        if (gas) txObject.gas = gas;
        if (gasPrice) txObject.gasPrice = gasPrice;
    
        const result = await makeRPCCall("eth_call", [txObject, blockNumber]);
    
        return {
          content: [
            {
              type: "text",
              text: formatResponse(
                {
                  result,
                  to,
                  data,
                  block: blockNumber,
                },
                "Contract Call Result",
              ),
            },
          ],
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: "text",
              text: `Error: ${error.message}`,
            },
          ],
        };
      }
    },
  • Zod input schema defining the parameters for the eth_call tool: to (required), data (required), and optional blockNumber, from, value, gas, gasPrice.
    {
      to: z.string().describe("Contract address"),
      data: z.string().describe("Data to send (hex string)"),
      blockNumber: z
        .string()
        .optional()
        .default("latest")
        .describe("Block number or 'latest', 'earliest', 'pending'"),
      from: z.string().optional().describe("From address (optional)"),
      value: z.string().optional().describe("Value in wei (optional)"),
      gas: z.string().optional().describe("Gas limit (optional)"),
      gasPrice: z.string().optional().describe("Gas price (optional)"),
    },
  • src/index.ts:432-434 (registration)
    Registration of the 'eth_call' MCP tool using server.tool(name, description, inputSchema, handler).
    server.tool(
      "eth_call",
      "Executes a new message call immediately without creating a transaction",
  • Generic helper function that performs RPC calls to the Ethereum provider using ethers.JsonRpcProvider.send(). Directly used by the eth_call handler at line 460.
    async function makeRPCCall(method: string, params: any[] = []): Promise<any> {
      try {
        const result = await provider.send(method, params);
        return result;
      } catch (error: any) {
        throw new Error(`RPC call failed: ${error.message}`);
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It mentions 'immediately without creating a transaction,' which hints at read-only behavior, but fails to disclose critical details like whether it requires authentication, rate limits, error handling, or what the return format looks like (e.g., hex data). For a tool with no annotation coverage, this is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the key information ('executes a new message call immediately without creating a transaction'). There's no wasted text, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of Ethereum RPC calls, no annotations, and no output schema, the description is insufficient. It lacks details on behavioral traits (e.g., side effects, error responses), return values, and practical usage context, making it incomplete for effective agent use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 7 parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema (e.g., it doesn't explain interactions between parameters like 'from' and 'gas'). Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('executes a new message call') and distinguishes it from creating a transaction, which helps differentiate it from sibling tools like eth_sendRawTransaction. However, it doesn't explicitly contrast with other read-only siblings like eth_getBalance or eth_getCode, which also don't create transactions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for immediate execution without transaction creation, suggesting it's for read-only or simulation purposes. However, it doesn't provide explicit guidance on when to use this versus alternatives like eth_estimateGas (for gas estimation) or other query tools, leaving some ambiguity.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/JamesANZ/evm-mcp'

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