Skip to main content
Glama

Contract ABI and functions (Read/Write Contract)

contract_abi
Read-onlyIdempotent

Load an EVM contract's ABI like a block explorer's Contract tab: Sourcify first, then Etherscan (when configured), else pass abi. Follows EIP-1967 proxies (shows the implementation's functions, calls still go to the proxy). Returns read (view/pure) and write functions with signatures, selectors, inputs, outputs and payable flags, plus warnings (third-party ABI, proxy, no code). Read-only. 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>"
    },
    "name": "contract_abi"
  }
}

Input Schema

NameRequiredDescriptionDefault
abiNoOptional ABI JSON to use instead of the Sourcify / Etherscan lookup (labelled as pasted; not checked against source).
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).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.1/5.0
Behavior5/5

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

Well beyond the annotations, it discloses the ABI resolution order, EIP-1967 proxy traversal with the important caveat that calls still go to the proxy, the full return shape (signatures, selectors, inputs, outputs, payable flags), and emitted warning categories (third-party ABI, proxy, no code). This is exactly the operational context annotations cannot carry.

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 the core action, then sourcing, behavior, and return shape in a logical order with no filler. The trailing playbook/combination sentence is somewhat bolted-on and dilutes the focus slightly.

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?

There is no output schema, and the description compensates by enumerating the returned fields and warning types, plus source fallbacks and proxy semantics. An agent has everything needed to call it and interpret the result.

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%, so the baseline is 3, but the description adds real meaning: it explains when the optional abi parameter should be supplied instead of a lookup, and that the proxy caveat applies to the address parameter. That raises it above the schema-only baseline.

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 ('Load an EVM contract's ABI') with a concrete analogy (block explorer's Contract tab) and enumerates what is returned. It does not, however, distinguish itself from near-name siblings like contract_reader, contract_read, or evm_abi, which an agent could easily confuse it with.

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 sourcing fallback chain ('Sourcify first, then Etherscan (when configured), else pass abi') is useful in-context guidance. But there is no explicit when-to-use-this vs. contract_read/contract_reader, and the playbook sentence only points at workflows rather than selection criteria.

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.