Skip to main content
Glama

read_contract

Read-onlyIdempotent

Call any view/pure function on a verified EVM contract by providing contract address, function name, and optional arguments. Fetches ABI from Etherscan or accepts inline ABI.

Instructions

READ-ONLY — call any view/pure function on any verified-ABI EVM contract. Mirrors Etherscan's "Read Contract" tab and the symmetric counterpart of prepare_custom_call. Use for the long tail of on-chain reads no protocol-specific tool covers: OZ AccessControl role members (getRoleMember(bytes32,uint256), hasRole(bytes32,address)), governance proposal state, oracle prices, vault share prices, Safe owner enumeration, ERC-1155 balances, etc. ABI source: pass abi: [...] inline (preferred when you have the project's published artifact) OR omit it and the tool fetches via Etherscan V2 — refuses on unverified contracts with NO raw-bytecode fallback. Proxies are followed once to the implementation when Etherscan exposes the link. Pass fn as a name ("getRoleMember") when unambiguous, or as the full signature ("getRoleMember(bytes32,uint256)") to disambiguate overloads. args types are validated by viem's encoder — uint256 expects a decimal string, address expects 0x-prefixed hex, bytes32 expects 0x-prefixed 64-hex (e.g. an OZ role hash like keccak256("EXECUTOR_ROLE") = 0xd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e63). Refuses on functions whose stateMutability is not view or pureeth_call would simulate a state-changing function and return a hypothetical result that has not occurred on-chain. Use prepare_custom_call for writes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chainNoethereum
contractYesTarget contract address. Must be Etherscan-verified OR the `abi` arg must be passed inline.
fnYesFunction name to call (e.g. "getRoleMember"). Pass the FULL signature ("getRoleMember(bytes32,uint256)") to disambiguate when the ABI has overloads for the same name.
argsNoArray of args matching the function's inputs in order. Decimal strings for uint256 (e.g. "0"), 0x-prefixed hex for bytes32/bytes (e.g. an OZ role hash like keccak256("EXECUTOR_ROLE")), lowercase 0x-prefixed addresses, plain numbers/booleans for primitives, nested arrays/objects for structs and tuples.
abiNoInline ABI array. When omitted, the tool fetches it via Etherscan V2. Pass it to override the Etherscan ABI, to call a contract whose source isn't yet verified, or to call through a proxy whose implementation can't be auto-followed.
Behavior5/5

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

Annotations already indicate readOnly, destructive=false, idempotent, openWorld. The description adds critical behavioral traits: it follows proxies once, refuses non-view/pure functions, fetches ABI from Etherscan or requires inline ABI, validates types via viem. No contradictions; the description enriches transparency significantly.

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

Conciseness4/5

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

The description is thorough and well-structured, starting with a clear one-line summary. It covers many edge cases without being overly verbose. A slight reduction in examples could improve conciseness, but overall it is efficient and front-loaded.

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?

Given the tool's complexity (5 parameters, 2 required, no output schema), the description covers inputs, behavior, and restrictions thoroughly. It omits explicit return value format, but since the return is dynamic (function-dependent), this is acceptable. Provides sufficient context for an AI to use the tool correctly.

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

Parameters5/5

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

Schema coverage is 80%, but the description adds substantial meaning: explains ABI fetching options, function name disambiguation (full signature), argument type formatting with examples (decimal strings for uint256, hex for bytes32, addresses), and the `abi` parameter's override purpose. This goes well beyond the schema defaults and patterns.

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

Purpose5/5

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

The description clearly states it is a read-only tool for calling view/pure functions on EVM contracts, with explicit examples and a direct distinction from the write sibling `prepare_custom_call`. It covers the exact resource (contract state) and verb (read via function call), leaving no ambiguity.

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

Usage Guidelines5/5

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

The description explicitly guides when to use (long tail of on-chain reads not covered by protocol-specific tools) and when not to (state-changing functions, unverified contracts without ABI). It provides alternative tool (`prepare_custom_call`) for writes, and offers detailed guidance on function disambiguation and argument formatting.

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/szhygulin/recon-crypto-mcp'

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