Skip to main content
Glama

get_contract_abi

Read-onlyIdempotent

Fetch a verified smart contract's ABI on Ethereum, Arbitrum, Polygon, Base, or Optimism. Supports proxy contracts by following to the implementation's ABI by default.

Instructions

READ-ONLY — fetch a verified contract's ABI on any Etherscan-V2-supported EVM chain (Ethereum, Arbitrum, Polygon, Base, Optimism). Wraps the same getsourcecode path prepare_custom_call and check_contract_security use, so the call carries the user's ETHERSCAN_API_KEY, the MAX_RESPONSE_BYTES cap, the sanitizeContractName discipline, and the 24h cache. Returns { chain, address, isVerified, isProxy, implementation?, contractName?, compilerVersion?, abi?, abiSource }. When the target is a proxy and followProxy=true (default), follows once to the implementation's ABI and reports abiSource: "proxy-implementation"; when followProxy=false or the implementation isn't verified, returns the proxy's own ABI with abiSource: "proxy-target" plus a proxyFollowSkippedReason explaining why. Unverified contracts return { isVerified: false } and no ABI — ask the user to paste the ABI inline if they have it from the project's published artifacts. ALWAYS prefer this tool over a generic WebFetch against etherscan.io/api.etherscan.io for ABI lookups in this MCP's surface — that path doesn't carry the API key (the env var lives in the MCP process, not the agent's harness), loses the size cap + verified-vs-unverified discipline, loses the 24h cache, and pulls the response through the agent's web layer with no sanitization for attacker-controlled fields like ContractName. Issue #495.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesEVM contract address to fetch the ABI for. Etherscan V2 covers Ethereum + Arbitrum + Polygon + Base + Optimism (the same five chains the rest of this MCP supports).
chainYesWhich chain the contract is deployed on. The same address can map to different contracts on different chains; this arg disambiguates.
followProxyNoWhen the target is a proxy with a resolvable implementation, follow once to the implementation's verified ABI (typical caller intent — you want the function selectors the proxy delegates to, not the proxy's own admin surface). Set to false to inspect the proxy's own ABI (e.g. when calling `upgradeTo` on the proxy itself). `abiSource` in the response tells you which path was taken.
Behavior4/5

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

Annotations already declare readOnlyHint and idempotentHint. The description adds valuable behavioral details: proxy following logic, cache, size cap, sanitization, and response structure, going beyond 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?

Front-loaded with core purpose, then detailed behavior. While somewhat long, every sentence adds value and is well-structured for an AI agent.

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?

No output schema, but description fully explains response shape including edge cases (proxy, unverified). Covers error handling and context for all parameters.

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

Parameters4/5

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

Schema coverage is 100% with good descriptions. The description adds context for followProxy behavior and explains response fields like abiSource and proxyFollowSkippedReason, providing extra meaning.

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 fetches a verified contract's ABI on supported EVM chains, explicitly distinguishes itself from generic WebFetch and sibling tools like check_contract_security and prepare_custom_call.

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?

Explicitly instructs to prefer this tool over generic WebFetch for ABI lookups, explains when proxy following is applied, and what to do for unverified contracts (ask user to paste ABI).

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