Skip to main content
Glama

get_contract_code

Read-onlyIdempotent

chainpeek: Get the deployed bytecode size and hash of an address, with EIP-1167 and EIP-7702 detection. For other proxy kinds use detect_proxy. Returns what is deployed at an address. Only EIP-1167 clones and EIP-7702 delegations are detected. A delegated wallet is not a contract. Ethereum, Base and Robinhood only. Read-only. A bad address is a 422 (not charged). Typically under 1 s. Price: USD 0.001. Free: 10 chain reads per IP per UTC day. Docs: https://tanod.dev/learn/ethereum-rpc-reads-api.html

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": {
      "chain": "<chain>",
      "address": "<address>"
    },
    "name": "get_contract_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
chainYesethereum, base or robinhood (Robinhood Chain, chain id 4663).
addressYesAccount or contract address (0x + 40 hex).

Output Schema

NameRequiredDescriptionDefault
kindNo
noteNo
blockNo
chainNo
errorNoOnly on an error result: an object {code, message}, or the reason string of an x402 PaymentRequired object.
addressNo
code_hashNo
code_sizeNo
code_prefixNo
is_contractNo
eip7702_delegateNo
is_eip1167_proxyNo
immutable_args_bytesNo
is_eip7702_delegatedNo
code_prefix_truncatedNo
eip1167_implementationNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedOutput schema / properties / immutable_args_bytes
      Added value: +{
      +  "type": [
      +    "integer",
      +    "null"
      +  ]
      +}
  2. Changed3 schema fields changed
    • removedInput schema / properties / address / title
      Removed value: -"Address"
    • removedInput schema / properties / chain / title
      Removed value: -"Chain"
    • removedInput schema / title
      Removed value: -"get_contract_codeArguments"
  3. Changed2 schema fields changed
    • changedInput schema / properties / chain / description
      Previous value: -"ethereum or base."New value: +"ethereum, base or robinhood (Robinhood Chain, chain id 4663)."
    • changedInput schema / properties / chain / enum
      Previous value: -[
      -  "ethereum",
      -  "base"
      -]New value: +[
      +  "ethereum",
      +  "base",
      +  "robinhood"
      +]
  4. Added

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint and destructiveHint=false, yet the description still adds substantive operational context: cost (USD 0.001), a free tier of 10 chain reads per IP per UTC day, ~1 s latency, and that a bad address returns 422 without being charged. The only thing left implicit is the response payload, which the output schema presumably covers.

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?

Information is front-loaded and the telegraphic style suits a catalog entry, but there is redundancy: the EIP-1167/EIP-7702 detection is stated twice, and "Returns what is deployed at an address" restates the opening sentence without adding detail.

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?

For a two-parameter read tool with an output schema and full annotation coverage, the description supplies everything needed to invoke it correctly: supported chains, cost and quota, error semantics, latency expectation, and the sibling that handles other proxy types.

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?

Schema description coverage is 100% and both parameters are documented with an enum and a regex pattern, so the schema does the heavy lifting. The description reinforces the chain scope and notes the failure behavior for a malformed address, but adds no per-parameter syntax beyond what is already structured.

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 opens with a specific verb and resource ("Get the deployed bytecode size and hash of an address") and immediately names the detection capabilities (EIP-1167, EIP-7702). It explicitly separates itself from detect_proxy, so an agent can route between the two without opening either schema.

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?

It states the alternative tool and the condition that selects it ("For other proxy kinds use detect_proxy"), restricts the supported chains, and clarifies an edge case ("A delegated wallet is not a contract"). When-to-use and when-not-to-use are both covered.

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.

Resources