Skip to main content
Glama

Call contract function (read-only)

call_contract_function
Read-only

Execute read-only smart contract calls on Celo using eth_call to retrieve function results without signing or sending transactions. Failed calls return success false with the revert reason.

Instructions

Call a contract function with eth_call and return its result. Read-only: nothing is signed or sent, even for functions that would change state. Integers larger than 2^53 are returned as decimal strings and bytes as 0x-prefixed hex. A failed call returns success false with the revert reason in error.

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": {
      "contract_address": "<contract_address>",
      "function_name": "<function_name>",
      "abi": "<abi>"
    },
    "name": "call_contract_function"
  }
}

Input Schema

NameRequiredDescriptionDefault
abiYesThe contract ABI, as a JSON array or a JSON string. Only the entry for function_name is needed.
from_addressNoAddress to call from (msg.sender).
function_argsNoPositional arguments for the function.
function_nameYesThe function to call, as named in the ABI.
contract_addressYesThe contract address.

Output Schema

NameRequiredDescriptionDefault
errorNoError message if failed
resultNoFunction call result
successYesWhether call was successful
function_nameYesFunction name
contract_addressYesContract address

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.5.0

TDQS

A3.8/5.0
Behavior4/5

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

The readOnlyHint=true annotation is consistent with the description's claim that nothing is signed or sent, and the description adds real context beyond it: big integers are returned as decimal strings, bytes as 0x-hex, and failures surface as success=false with a revert reason. Encoding details overlap somewhat with the existing output schema, keeping it short of a 5.

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?

Three short sentences, front-loaded with the action and followed by the safety scope, encoding rules, and error behavior. No filler or 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?

With annotations covering the safety profile and an output schema covering the return shape, the description supplies the remaining behavioral essentials: no signing, serialization formats, and revert handling. Only minor gaps remain, such as the default for from_address or node-side eth_call constraints.

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 five parameters, including the ABI-as-array-or-string form and the from_address/msg.sender meaning. The description adds no parameter-level meaning beyond that, so the baseline of 3 applies.

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?

States a specific verb and resource ('Call a contract function with eth_call and return its result') and immediately scopes it as read-only. It does not explicitly contrast itself with the closest sibling, estimate_contract_gas, but the purpose is unambiguous without reading the schema.

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 'read-only: nothing is signed or sent' line implies this is for reading contract state, including view calls on state-changing functions. There is no explicit when-to-use vs. when-not-to-use guidance or reference to an alternative (e.g., estimate_contract_gas for gas estimation), so selection still requires inference.

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