Skip to main content
Glama

call_contract

Execute a read-only smart contract call to retrieve raw on-chain data such as token balances, prices, and positions without spending gas or modifying state.

Instructions

Execute a read-only call against a smart contract (eth_call). Returns the raw hex result. Does not cost gas or modify state. Useful for reading on-chain data like token balances, prices, positions.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "chain_id": "<chain_id>",
      "to": "<to>",
      "data": "<data>"
    },
    "name": "call_contract"
  }
}

Input Schema

NameRequiredDescriptionDefault
toYesContract address
dataYesABI-encoded calldata (0x-prefixed hex)
chain_idYesChain ID

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv1.14.8
    • addedInput schema / properties / chain_id / maximum
      Added value: +9007199254740991
    • addedInput schema / properties / chain_id / minimum
      Added value: +-9007199254740991
  2. First observedv1.7.3

TDQS

A3.8/5.0
Behavior4/5

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

There are no annotations, so the description carries the full behavioral burden. It does well by explicitly stating that the call is read-only, does not cost gas, does not modify state, and returns raw hex, but it omits failure behavior such as how reverts or invalid calldata are surfaced.

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 three compact sentences, front-loads the core operation, then adds safety and return-value context. Every sentence contributes useful information without repetition.

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

Completeness4/5

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

For a three-parameter read-only tool with no output schema, the description is nearly complete: it explains the eth_call semantics, states that the return value is raw hex, and notes that no state or gas is involved. It could be strengthened by mentioning revert handling or decoding expectations, but the essential context is present.

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 three parameters: chain_id, to, and data. The description adds no parameter-specific semantics beyond what the schema provides, so the baseline score of 3 is appropriate.

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 states a specific verb and resource: execute a read-only call against a smart contract, specifically eth_call. It clearly identifies the operation as read-only and raw-hex-returning, but it does not explicitly distinguish itself from sibling helpers like get_balance or get_token_balance that also read on-chain data.

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 gives implied usage guidance by saying it is useful for reading on-chain data such as token balances, prices, and positions. However, it does not state when to use this tool instead of sibling tools like get_balance, get_token_balance, or simulate_transaction, leaving the agent to infer the boundary.

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