Skip to main content
Glama
franckyo
by franckyo

Derive a Solidity storage slot

compute_storage_slot
Read-only

Derive storage slot locations for EVM mappings, nested mappings, arrays, and keccak-based layouts. Compute Solidity slots from keys, base slots, indices, or words.

Instructions

Derive storage slots. kind=mapping: keccak256(pad32(key).pad32(slot)). kind=nested_mapping: applied left to right. kind=array: keccak256(pad32(slot))+index. kind=keccak_words: keccak256 over concatenated 32-byte words, which is what hand-written assembly does when it MSTOREs values and hashes the region. kind=keccak_utf8 / keccak_hex: plain hashing.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyNoKey, for kind=mapping.
keysNoKeys outermost-first, for kind=nested_mapping.
kindYes
slotNoBase slot, for mapping/nested_mapping/array.
indexNoElement index, for kind=array.
inputNoString for keccak_utf8, or hex for keccak_hex.
wordsNoValues to pad to 32 bytes and hash, for kind=keccak_words.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.4/5.0
Behavior3/5

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

Annotations declare readOnlyHint=true, so the description doesn't need to restate safety. It adds useful behavioral context by explaining the exact hashing formulas for each kind, including the note that keccak_words matches hand-written assembly MSTORE behavior. However, it doesn't disclose edge cases like whether keys are left-padded or right-padded, or what happens with invalid input.

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 description is compact and front-loaded with the core purpose ('Derive storage slots'), then efficiently enumerates the kinds. Each kind's formula is stated in a single clause. The only minor issue is that the list of kinds is dense and could be slightly more scannable, but it earns its place.

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

Completeness3/5

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

For a computation tool with readOnlyHint=true and no output schema, the description covers the main formulas but leaves gaps: it doesn't specify the expected input format (hex vs decimal), the output format (32-byte hex?), or how nested_mapping ordering maps to the 'keys' array. These are important for an agent to call it correctly without guessing.

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 86%, so the schema already documents most parameters. The description adds meaning by explaining the formulas that connect parameters (e.g., pad32(key).pad32(slot) for mapping), which goes beyond the schema. However, it doesn't clarify the exact format of key/slot strings (hex? decimal?) or how nested_mapping applies left to right in terms of parameter order.

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?

The description states a specific verb ('Derive') and resource ('Solidity storage slot'), and enumerates the supported kinds, which distinguishes it from sibling tools like read_storage or eth_call. However, it doesn't explicitly name a sibling alternative or contrast itself, so it's clear but not fully differentiated.

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 by listing the kinds and their formulas, but it doesn't explicitly state when to use this tool vs alternatives like read_storage. It provides no exclusions or conditions, so an agent must infer that this is for computing slots rather than reading them.

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