Skip to main content
Glama

get_contract_abi

Read-onlyIdempotent

Fetches a verified contract's ABI from Etherscan on Ethereum, Arbitrum, Polygon, Base, and Optimism. Resolves proxy implementations to return the delegatee'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.
Behavior5/5

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

Beyond annotations (readOnlyHint, etc.), the description details the underlying path, 24h cache, size cap, sanitization discipline, proxy-following behavior with 'abiSource' and 'proxyFollowSkippedReason', and behavior for unverified contracts. 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 lengthy but efficiently structured. Front-loaded with main purpose, then details, return format, and guidance. Each sentence adds value, though it could be slightly more concise without losing information.

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?

Despite lacking an output schema, the description fully explains the return format including fields, variations for proxies and unverified contracts, and all possible values for 'abiSource'. Covers purpose, usage, parameters, and behavior completely.

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?

All three parameters are thoroughly explained. The description adds context to `address` (supported chains), `chain` (disambiguation), and `followProxy` (intent and response fields). Schema coverage is 100%, but description provides significant additional value.

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 the tool's purpose: 'fetch a verified contract's ABI' on supported EVM chains. It specifies the verb, resource, and scope, and distinguishes from sibling tools by mentioning the shared underlying path and recommending this tool over generic WebFetch.

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 states 'ALWAYS prefer this tool over a generic WebFetch' and explains why other paths lack API key, cache, and sanitization. Provides guidance for unverified contracts and references issue #495, giving comprehensive when-to-use and when-not-to-use instructions.

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