Skip to main content
Glama

Inspect Contract Storage Layout

evm_inspect_storage_layout
Read-onlyIdempotent

Inspect the storage layout of a Solidity contract to verify proxy-upgrade safety and analyze storage packing for gas efficiency.

Instructions

Run forge inspect storage-layout and return the resolved storage slot assignment for every state variable.

Essential for proxy-upgrade safety checks (storage-layout collisions) and storage-packing gas analysis.

Args:

  • projectPath (string): Absolute path to the Foundry project root

  • contractName (string): Contract name (e.g. "Token") or fully qualified name (e.g. "src/Token.sol:Token")

Returns: JSON object: { "entries": [ { "label": string, // State variable name "slot": number, // Storage slot index "offset": number, // Byte offset within the slot "type": string, // Human-readable type (e.g. "address", "mapping(address => uint256)") "bytes": number // Size of the variable in bytes } ] }

Examples:

  • "Check storage layout of my proxy implementation" → contractName = "TokenV2"

  • "Will upgrading V1 to V2 corrupt storage?" → call once per contract, compare entries

Error Handling:

  • Returns isError=true if forge is not installed, the project path is invalid, or the contract is not found

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectPathYesAbsolute path to the Foundry project root
contractNameYesContract name (e.g. 'Token') or fully qualified name (e.g. 'src/Token.sol:Token')

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
entriesYes
Behavior5/5

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

Beyond annotations (readOnly, idempotent, non-destructive), the description explains the underlying forge command, return structure, and error conditions (forge not installed, invalid path, contract not found). No contradictions 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.

Conciseness5/5

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

The description is well-structured with clear sections (purpose, args, returns, examples, error handling). Every sentence is informative and front-loaded with the main purpose. No wasted words.

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?

Given the tool's complexity and the presence of annotations, output schema, and 100% parameter coverage, the description is fully complete. It explains the command, return format, use cases, and error handling, leaving no gaps for an agent.

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 baseline is 3. The description adds value with examples (e.g., fully qualified name format 'src/Token.sol:Token') and clarifies the contractName pattern, which goes beyond the schema's pattern description.

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 inspects storage layout via forge inspect, listing state variables per slot. It distinguishes from sibling tools (e.g., gas profiling, testing) by mentioning specific use cases: proxy-upgrade safety and storage-packing gas analysis.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides examples and error handling, indicating when to use (e.g., upgrade safety). However, it lacks an explicit 'when not to use' or direct comparison to sibling tools, though the use cases imply differentiation.

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/0xendale/evm-agent-toolkit'

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