Skip to main content
Glama

Read a contract function (eth_call)

contract_read
Read-onlyIdempotent

Call one view/pure function of an EVM contract via eth_call and return the ABI-decoded result. A failed or reverted read returns ok=false with an error code, never a zero. Read-only; nothing is signed or sent. Powered by blocktools (ABI coding). How to combine this with the other tools: swapchan_playbook (workflows: find-money, best-swap, rebalance, revoke-approvals, bridge-stuck, token-safety, recover-old-wallet).

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": {
      "chainId": "<chainId>",
      "address": "<address>",
      "function": "<function>"
    },
    "name": "contract_read"
  }
}

Input Schema

NameRequiredDescriptionDefault
abiNoOptional ABI JSON to use instead of the Sourcify / Etherscan lookup (labelled as pasted; not checked against source).
argsNoArguments in order; arrays/tuples as JSON lists, big numbers as decimal strings.
addressYesContract address (0x...)
chainIdYesEVM chain id or name (1 eth, 8453 base, 42161 arbitrum, 10 optimism, 137 polygon, 56 bnb, 43114 avalanche, 59144 linea, 534352 scroll).
functionYesFunction name, or the full signature for overloads, e.g. "balanceOf" or "get(uint256)"

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A3.6/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false, and openWorldHint, so the safety profile is covered. The description still adds genuinely non-obvious behavior: a failed or reverted read returns ok=false with an error code and never a zero, and nothing is signed or sent. Missing are any notes on upstream lookup failures (Sourcify/Etherscan fallback), rate limits, or latency.

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

Conciseness3/5

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

The first three sentences are front-loaded and earn their place: what it does, failure semantics, and read-only confirmation. The 'Powered by blocktools (ABI coding)' line adds little, and the trailing sentence enumerating seven unrelated playbook workflows (find-money, best-swap, rebalance, bridge-stuck, etc.) is padding for an eth_call tool.

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 five-parameter tool with no output schema, the description covers the essentials: what gets returned (ABI-decoded), the failure shape (ok=false plus error code), and the read-only guarantee. The remaining gaps—how the ABI is resolved when not supplied, and chain coverage limits—are handled adequately in the schema.

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 all five parameters (including the abi override, args encoding, chainId aliases, and overload signatures) are already documented. The description adds no parameter-level meaning beyond what the schema states, so the baseline 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?

States a specific verb and resource: calls one view/pure function of an EVM contract via eth_call and returns the ABI-decoded result. The verb/resource pair is precise enough to act on. However, it never differentiates itself from near-identical siblings such as contract_reader, contract_abi, and contract_encode_call, so an agent choosing between them gets no help here.

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 phrase 'one view/pure function' implicitly constrains usage to read-only calls and implicitly excludes state-mutating calls (which belong to broadcast_tx / build_swap_tx). That is implied rather than stated. There is no explicit when-to-use or when-not statement, and the only pointer given (swapchan_playbook) routes to workflows rather than to the sibling tools an agent would actually confuse this with.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.