Skip to main content
Glama

eth_getStorageAt

Retrieve storage values from smart contracts on EVM blockchains by specifying contract address and storage position to access contract state data.

Instructions

Returns the value from a storage position at a given address

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesContract address
blockNumberNoBlock number or 'latest', 'earliest', 'pending'latest
positionYesStorage position (hex string)

Implementation Reference

  • The asynchronous handler function for the 'eth_getStorageAt' tool. It makes an RPC call to eth_getStorageAt with the provided address, position, and blockNumber, formats the result, and returns it in the MCP response format. Handles errors by returning an error message.
    async ({ address, position, blockNumber }) => {
      try {
        const result = await makeRPCCall("eth_getStorageAt", [
          address,
          position,
          blockNumber,
        ]);
    
        return {
          content: [
            {
              type: "text",
              text: formatResponse(
                {
                  address,
                  position,
                  value: result,
                  block: blockNumber,
                },
                "Storage Value",
              ),
            },
          ],
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: "text",
              text: `Error: ${error.message}`,
            },
          ],
        };
      }
    },
  • Zod schema defining the input parameters for the eth_getStorageAt tool: address (string), position (string, hex), blockNumber (string, optional, default 'latest').
    {
      address: z.string().describe("Contract address"),
      position: z.string().describe("Storage position (hex string)"),
      blockNumber: z
        .string()
        .optional()
        .default("latest")
        .describe("Block number or 'latest', 'earliest', 'pending'"),
    },
  • src/index.ts:670-717 (registration)
    The server.tool() call that registers the 'eth_getStorageAt' tool with the MCP server, including name, description, schema, and handler function.
    server.tool(
      "eth_getStorageAt",
      "Returns the value from a storage position at a given address",
      {
        address: z.string().describe("Contract address"),
        position: z.string().describe("Storage position (hex string)"),
        blockNumber: z
          .string()
          .optional()
          .default("latest")
          .describe("Block number or 'latest', 'earliest', 'pending'"),
      },
      async ({ address, position, blockNumber }) => {
        try {
          const result = await makeRPCCall("eth_getStorageAt", [
            address,
            position,
            blockNumber,
          ]);
    
          return {
            content: [
              {
                type: "text",
                text: formatResponse(
                  {
                    address,
                    position,
                    value: result,
                    block: blockNumber,
                  },
                  "Storage Value",
                ),
              },
            ],
          };
        } catch (error: any) {
          return {
            content: [
              {
                type: "text",
                text: `Error: ${error.message}`,
              },
            ],
          };
        }
      },
    );
  • Generic helper function used by the eth_getStorageAt handler (and others) to make RPC calls to the Ethereum provider.
    async function makeRPCCall(method: string, params: any[] = []): Promise<any> {
      try {
        const result = await provider.send(method, params);
        return result;
      } catch (error: any) {
        throw new Error(`RPC call failed: ${error.message}`);
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states the tool returns a value but lacks details on behavioral traits: it doesn't specify if this is a read-only operation (implied but not explicit), potential errors (e.g., invalid address), performance considerations, or the format of the returned value (e.g., hex string). This leaves significant gaps for an agent to understand how to handle the tool effectively.

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, clear sentence with no wasted words. It front-loads the core action ('Returns the value') and efficiently conveys the essential purpose, making it easy to parse and understand quickly.

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 tool's complexity (EVM storage access) and lack of annotations or output schema, the description is insufficient. It doesn't explain the return value format, error conditions, or practical usage context (e.g., for debugging contracts). This leaves the agent with incomplete information to invoke the tool correctly and interpret results.

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%, so the schema fully documents parameters like 'address' as 'Contract address' and 'position' as 'Storage position (hex string)'. The description adds no additional semantic context beyond what the schema provides, such as explaining what a storage position represents in Ethereum or how to derive it. This meets the baseline for high schema coverage.

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 clearly states the action ('Returns the value') and target ('from a storage position at a given address'), making the purpose understandable. However, it doesn't explicitly differentiate this tool from similar siblings like eth_getBalance or eth_getCode, which also retrieve data from addresses but for different types of data.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention use cases like inspecting contract state variables, comparing it to eth_call for more complex queries, or specifying prerequisites such as needing a contract address with storage.

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/JamesANZ/evm-mcp'

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