Skip to main content
Glama

is_contract

Verify if an address is a smart contract or an externally owned account (EOA) on Ethereum and EVM-compatible networks using a unified interface.

Instructions

Check if an address is a smart contract or an externally owned account (EOA)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesThe wallet or contract address or ENS name to check (e.g., '0x1234...' or 'uniswap.eth')
networkNoNetwork name (e.g., 'ethereum', 'optimism', 'arbitrum', 'base', etc.) or chain ID. Supports all EVM-compatible networks. Defaults to Ethereum mainnet.

Implementation Reference

  • The core handler function that implements the logic to check if a given address or ENS name corresponds to a contract by retrieving and checking its bytecode. Returns true if bytecode exists and is not empty ('0x'), false otherwise.
    export async function isContract(addressOrEns: string, network = 'ethereum'): Promise<boolean> {
      // Resolve ENS name to address if needed
      const address = await resolveAddress(addressOrEns, network);
    
      const client = getPublicClient(network);
      const code = await client.getBytecode({ address });
      return code !== undefined && code !== '0x';
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While it states what the tool does, it lacks important behavioral details: it doesn't specify what happens with invalid addresses, whether ENS resolution is performed internally, what the return format looks like (boolean, object with details), or any rate limits/authentication requirements. For a tool with zero annotation coverage, this represents significant gaps.

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

Conciseness5/5

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

The description is a single, efficient sentence that immediately communicates the core purpose without any fluff or redundant information. It's appropriately sized for a straightforward classification tool and front-loads the essential information.

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

Completeness2/5

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

Given the lack of annotations and output schema, the description should provide more complete context. It doesn't explain what the tool returns (crucial for a classification tool), doesn't mention error handling, and provides minimal behavioral transparency. For a tool with 2 parameters and no structured output documentation, the description is insufficiently complete.

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

Parameters3/5

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

The schema description coverage is 100%, with both parameters well-documented in the schema itself. The description doesn't add any parameter-specific information beyond what's already in the schema descriptions (address format examples, network defaults). This meets the baseline of 3 for high schema coverage situations where the schema does the heavy lifting.

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 specific action ('Check if') and the target resource ('an address is a smart contract or an externally owned account'), using precise terminology that distinguishes it from sibling tools like get_balance or resolve_ens. It directly communicates the binary classification purpose without ambiguity.

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 description implies usage when needing to determine address type, but provides no explicit guidance on when to use this tool versus alternatives like resolve_ens (which handles ENS resolution) or check_nft_ownership (which checks NFT status). There's no mention of prerequisites, error conditions, or typical use cases beyond the basic purpose.

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

Related 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/mcpdotdirect/evm-mcp-server'

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