Skip to main content
Glama
laszlopere

mcp-bytesmith

eth_hash

Compute an Ethereum hash: keccak-256, EIP-191, EIP-712, or EIP-7702.

Instructions

Compute an Ethereum hash: keccak-256, EIP-191, EIP-712, or EIP-7702.

Returns {kind, hash}. For kind=eip712 the result also carries {domain_separator, struct_hash}, the two EIP-712 component hashes. For kind=eip7702 data is the authorization tuple {chainId, address, nonce} and the result carries the preimage that was hashed, 0x05 || rlp([chain_id, address, nonce]) — the 0x05 keeps a signed authorization from ever being replayed as a transaction. A chainId of 0 is not a missing value there: it authorizes the delegation on every chain. Note keccak-256 is the pre-NIST Ethereum variant, not hashlib's SHA3-256.

Example: eth_hash("keccak256", "hello", "text") -> hash="0x1c8aff950685c2ed4bc3174f3472287b56d9517b9c948127319a09a7a36deac8".

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYesPolymorphic: for keccak256/eip191 it is the message bytes decoded per input_format; for eip712 it is the typed-data JSON object (a JSON string or already-parsed dict with types/primaryType/domain/message) and input_format is ignored; for eip7702 it is the authorization object {chainId, address, nonce}.
kindYesHash flavor: 'keccak256' (raw Ethereum keccak-256), 'eip191' (personal_sign prefixed message), 'eip712' (typed-data digest), or 'eip7702' (delegation authorization tuple).
input_formatNoHow to decode `data` to bytes for keccak256/eip191 (ignored for eip712); hex is 0x-prefixed or bare.text
output_formatNoDigest encoding: 'hex' is 0x-prefixed, or 'base64'.hex

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.4.1
    • changedInput schema / properties / data / description
      Previous value: -"Polymorphic: for keccak256/eip191 it is the message bytes decoded per input_format; for eip712 it is the typed-data JSON object (a JSON string or already-parsed dict with types/primaryType/domain/message) and input_format is ignored."New value: +"Polymorphic: for keccak256/eip191 it is the message bytes decoded per input_format; for eip712 it is the typed-data JSON object (a JSON string or already-parsed dict with types/primaryType/domain/message) and input_format is ignored; for eip7702 it is the authorization object {chainId, address, nonce}."
    • changedInput schema / properties / kind / description
      Previous value: -"Hash flavor: 'keccak256' (raw Ethereum keccak-256), 'eip191' (personal_sign prefixed message), or 'eip712' (typed-data digest)."New value: +"Hash flavor: 'keccak256' (raw Ethereum keccak-256), 'eip191' (personal_sign prefixed message), 'eip712' (typed-data digest), or 'eip7702' (delegation authorization tuple)."
    • changedInput schema / properties / kind / enum
      Previous value: -[
      -  "keccak256",
      -  "eip191",
      -  "eip712"
      -]New value: +[
      +  "keccak256",
      +  "eip191",
      +  "eip712",
      +  "eip7702"
      +]
  2. Changed4 schema fields changedv0.3.0
    • addedInput schema / properties / data / description
      Added value: +"Polymorphic: for keccak256/eip191 it is the message bytes decoded per input_format; for eip712 it is the typed-data JSON object (a JSON string or already-parsed dict with types/primaryType/domain/message) and input_format is ignored."
    • addedInput schema / properties / input_format / description
      Added value: +"How to decode `data` to bytes for keccak256/eip191 (ignored for eip712); hex is 0x-prefixed or bare."
    • addedInput schema / properties / kind / description
      Added value: +"Hash flavor: 'keccak256' (raw Ethereum keccak-256), 'eip191' (personal_sign prefixed message), or 'eip712' (typed-data digest)."
    • addedInput schema / properties / output_format / description
      Added value: +"Digest encoding: 'hex' is 0x-prefixed, or 'base64'."
  3. First observedv0.0.1

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations and no output schema, the description carries the full burden and does so well: it spells out the return shape ({kind, hash}, plus {domain_separator, struct_hash} for eip712 and `preimage` for eip7702), explains the 0x05 replay-protection prefix, and clarifies the chainId=0 meaning. It does not cover error/edge-case behavior (e.g. malformed typed data or non-hex input), keeping it short of a 5.

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 purpose is front-loaded in the first line, followed by return shape, per-kind semantics, and a concrete example. It is dense but every clause carries information; the preimage/replay explanation is the only part that leans verbose for an invocation-time 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?

For a 4-parameter, 4-variant computation tool with no output schema, the description supplies the return structure for every kind, the key non-obvious gotchas, and a worked example, so an agent has everything needed to invoke 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 adds genuine meaning on top: it notes that `input_format` is ignored for eip712/eip7702, that `data` is a parsed-JSON/dict or authorization tuple for those kinds, and what the chainId field means — beyond what the schema literally states.

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 names a specific verb (compute) and resource (Ethereum hash) and enumerates the exact four supported flavors (keccak-256, EIP-191, EIP-712, EIP-7702), which cleanly separates it from generic siblings like `hash`/`hmac` and from Ethereum signing/decoding tools such as `eth_sign` or `eth_userop_hash`.

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 text characterizes each `kind` well enough to imply when each applies, and it warns that keccak-256 is not SHA3-256, but it never states when to prefer a sibling (e.g. `hash`, `eth_sign`, `eth_userop_hash`) or any when-not-to-use rule. Guidance is implied rather than explicit.

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