Skip to main content
Glama
laszlopere

mcp-bytesmith

eth_storage_slot

Compute a storage slot: a mapping/array entry, or a well-known layout's root.

Instructions

Compute a storage slot: a mapping/array entry, or a well-known layout's root.

layout: {"kind": …} — the first two describe a layout you declared, the rest are the standard constant slots, which need no "slot" of their own: mapping -> needs "slot" and key; "key_type" (default uint256). For nested mappings pass key (and "key_type") as lists. dynamic_array -> needs "slot" and index; optional "element_size" (slots). eip1967 -> the proxy slots, keccak256(label) - 1. Optional "name": implementation (default), admin, beacon, or rollback. eip1822 -> UUPS proxiableUUID, keccak256("PROXIABLE") — no -1. erc7201 -> namespaced storage root for "namespace", keccak256(abi.encode(keccak256(ns) - 1)) & ~0xff. An erc7201: annotation prefix on the namespace is stripped. diamond -> EIP-2535 diamond storage, plain keccak256("namespace"). Returns {slot, slot_hex}: the slot as a decimal string and a 0x 32-byte word, plus formula (and name/namespace) for the constant layouts. Every constant is derived by keccak here, not pasted from the EIP. The results compose: feed a namespaced root back in as another layout's "slot" to reach a mapping or array declared inside that struct, and use index to step to a later member of it.

Example: eth_storage_slot({"kind":"eip1967"}) -> slot_hex="0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc".

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyNoMapping key (required for kind=mapping); pass a list of keys outer-to-inner for nested mappings. Ignored otherwise.
indexNoElement index (required for kind=dynamic_array); int/decimal/0x-hex. For erc7201/diamond it is the optional slot offset of a member within the struct that starts at the root. Ignored otherwise.
layoutYesLayout object: {"kind": ..., ...}. Declared layouts take a "slot" (int/decimal/0x-hex): "mapping" (+ optional "key_type", default "uint256", or a list for nested mappings) and "dynamic_array" (+ optional "element_size" in slots, default 1). Well-known constant layouts take no slot: "eip1967" (+ "name": implementation|admin|beacon|rollback), "eip1822" (aka uups), "erc7201" and "diamond" (+ a "namespace" string). A stringified JSON object is accepted.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.4.1
    • changedInput schema / properties / index / description
      Previous value: -"Element index (required for kind=dynamic_array); int/decimal/0x-hex. Ignored for mappings."New value: +"Element index (required for kind=dynamic_array); int/decimal/0x-hex. For erc7201/diamond it is the optional slot offset of a member within the struct that starts at the root. Ignored otherwise."
    • changedInput schema / properties / key / description
      Previous value: -"Mapping key (required for kind=mapping); pass a list of keys outer-to-inner for nested mappings. Ignored for arrays."New value: +"Mapping key (required for kind=mapping); pass a list of keys outer-to-inner for nested mappings. Ignored otherwise."
    • changedInput schema / properties / layout / description
      Previous value: -"Layout object: {\"kind\":\"mapping\"|\"dynamic_array\", \"slot\": <declared base slot, int/decimal/0x-hex>, ...}. mapping takes optional \"key_type\" (default \"uint256\"; lists for nested mappings); dynamic_array takes optional \"element_size\" in slots (default 1). A stringified JSON object is accepted."New value: +"Layout object: {\"kind\": ..., ...}. Declared layouts take a \"slot\" (int/decimal/0x-hex): \"mapping\" (+ optional \"key_type\", default \"uint256\", or a list for nested mappings) and \"dynamic_array\" (+ optional \"element_size\" in slots, default 1). Well-known constant layouts take no slot: \"eip1967\" (+ \"name\": implementation|admin|beacon|rollback), \"eip1822\" (aka uups), \"erc7201\" and \"diamond\" (+ a \"namespace\" string). A stringified JSON object is accepted."
  2. Changed3 schema fields changedv0.3.0
    • addedInput schema / properties / index / description
      Added value: +"Element index (required for kind=dynamic_array); int/decimal/0x-hex. Ignored for mappings."
    • addedInput schema / properties / key / description
      Added value: +"Mapping key (required for kind=mapping); pass a list of keys outer-to-inner for nested mappings. Ignored for arrays."
    • addedInput schema / properties / layout / description
      Added value: +"Layout object: {\"kind\":\"mapping\"|\"dynamic_array\", \"slot\": <declared base slot, int/decimal/0x-hex>, ...}. mapping takes optional \"key_type\" (default \"uint256\"; lists for nested mappings); dynamic_array takes optional \"element_size\" in slots (default 1). A stringified JSON object is accepted."
  3. First observedv0.0.1

TDQS

A4.4/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and mostly meets it: it discloses the return shape ({slot, slot_hex}, plus formula/name/namespace), that every constant is derived by keccak rather than pasted from the EIP, and a specific preprocessing rule (the 'erc7201:' annotation prefix is stripped). It never explicitly asserts side-effect freedom or authorization, though 'Compute' plus the deterministic formula list make purity inferable.

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 first line states purpose, then a well-formatted per-layout block, then returns, then composition, then a concrete example. Long, but nearly every token is load-bearing formula or constraint, and it is front-loaded. Minor redundancy exists between the layout bullets and the equally detailed schema 'layout' description.

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?

No output schema exists, so the description must document the return value itself — and it does ({slot, slot_hex}, formula, name/namespace). For a tool with a nested, polymorphic object parameter and three branching layout families, the per-kind requirements, formatting rules for hex/decimal/int, and a worked example together leave nothing an agent needs in order to call it correctly.

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 description coverage is already 100%, so the baseline is 3. The description goes beyond the schema by giving the derivation rationale behind each parameter's role in the formulas (key_type default uint256, nested mapping key lists, element_size in slots, index doubling as a struct offset for erc7201/diamond) and by explaining how a returned slot composes back into the 'slot' field. That compositional semantics is not present in the schema.

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?

Opens with a specific verb+resource: 'Compute a storage slot: a mapping/array entry, or a well-known layout's root.' The two modes of operation are named up front, so an agent can immediately distinguish this from siblings like eth_hash or eth_selector. No sibling names are used, but the domain-specificity is high enough that misselection against the keccak-family tools is unlikely.

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 layout enumeration effectively acts as a routing table: each kind states what it needs ('mapping -> needs "slot" and `key`', 'dynamic_array -> needs "slot" and `index`') and which are constant and need no slot. It also explains the composition workflow (feed a namespaced root back in as another layout's slot). What it lacks is any explicit statement of when to reach for this tool over eth_hash or abi_codec when a raw hash might suffice.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.