Skip to main content
Glama

read_contract

Read-onlyIdempotent

Read view/pure functions on verified EVM contracts. Pass function name and args to retrieve on-chain data like token balances, governance states, or oracle prices.

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 mark it as read-only, non-destructive, idempotent, and open world. The description adds rich behavioral details: proxies are followed once, it refuses unverified contracts with no fallback, validates args via viem, and refuses non-view/pure functions. No contradiction with annotations.

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 well-structured and front-loaded with purpose and constraints. Each sentence adds value, though it is fairly long. Could be slightly trimmed without losing clarity.

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

Completeness5/5

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

Given no output schema, the description covers all essential aspects: return format (viem encoder results), edge cases (unverified contracts, proxies, overloads), and argument type validation. It is fully complete for a tool that calls arbitrary view functions.

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 provides extensive meaning for each parameter: chain enum listed, contract requires verification or inline ABI, fn disambiguation via full signature, args types with examples (uint256 as decimal string, bytes32 as 0x-prefixed hex, etc.), and ABI override. This far exceeds the schema's descriptions.

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 explicitly states it calls any view/pure function on any verified-ABI EVM contract, mirrors Etherscan's Read Contract, and is the counterpart of prepare_custom_call for writes. It includes specific examples (OZ roles, governance, etc.), clearly differentiating from sibling tools.

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 advises using this tool for the long tail of on-chain reads not covered by protocol-specific tools, and explicitly directs to prepare_custom_call for writes. It also notes that it refuses state-changing functions, providing clear when-to-use and when-not-to-use guidance.

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/vaultpilot-mcp'

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