Skip to main content
Glama
laszlopere

mcp-bytesmith

eth_sign

Sign, verify, ecrecover, or reformat a secp256k1 signature over a 32-byte hash.

Instructions

Sign, verify, ecrecover, or reformat a secp256k1 signature over a 32-byte hash.

This signs a raw digest — unlike the JSON-RPC eth_sign/personal_sign, it adds no "\x19Ethereum Signed Message" prefix. Hash a message first with eth_hash (kind=eip191 for personal_sign, eip712 for typed data), or pass a transaction's signing hash (eth_tx_codec's signing_hash) or a user operation's hash (eth_userop_hash).

action=sign (message_hash, private_key_file) -> {signature (65-byte, v=27/28), r, s, v, yParity, eip2098, address}. The nonce is RFC 6979, so the result is deterministic and matches eth_account/ethers; s is always low (EIP-2). address is the signer's, to confirm the right key was used. The key is never echoed. action=verify (message_hash, signature, address) -> {valid, recovered, low_s}; a signature that recovers no key is soft: valid false plus reason. action=recover (message_hash, signature) -> {address, low_s}. action=convert (signature, signature_format) -> {format, result, low_s}. low_s is false for a malleable high-s signature: the ecrecover precompile accepts it, but Ethereum transactions and OpenZeppelin's ECDSA reject it.

Example: eth_sign("sign", message_hash="0x…32 bytes…", private_key_file="~/keys/dev.key") -> {signature: "0x…1b", r, s, v: 27, …}.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYes'sign' a digest with the key in `private_key_file`; 'verify' a signature against an expected `address`; 'recover' the signer address (ecrecover); 'convert' a signature between forms.
addressNoaction=verify: the expected signer's 20-byte address (any casing).
signatureNoFor verify/recover/convert: a 65-byte r || s || v hex string (v 27/28 or 0/1), a 64-byte EIP-2098 compact hex string, or an object {r, s, v} / {r, s, yParity} (ints as int, decimal, or 0x-hex).
message_hashNoThe 32-byte digest to sign or check, as hex (0x optional) — signed exactly as given, with no prefix added. Required for sign, verify, and recover.
private_key_fileNoaction=sign only: path of a file holding the private key as 64 hex digits (0x and surrounding whitespace optional) or as 32 raw bytes; `~` is expanded. The server reads it itself, so the key never appears in the call or the result, and no error quotes the file's contents. There is deliberately no inline key argument.
signature_formatNoaction=convert: the form to produce — 'rsv' (object {r, s, v, yParity}), 'packed65' (65-byte r || s || v, v=27/28), or 'eip2098' (64-byte compact; low-s signatures only). Default packed65.packed65

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.4.1

TDQS

A4.6/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 does so well: RFC 6979 deterministic nonces matching eth_account/ethers, always-low-s (EIP-2), the key is read from a file by the server and never echoed or leaked in errors, and recovery failure is a soft error (valid false plus reason) rather than an exception. It stops short of stating global preconditions such as file-permission requirements or whether the tool is read-only across actions, so a 5 is not warranted.

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?

Dense but front-loaded: capability and the key semantic caveat (no EIP-191 prefix) come first, then per-action contracts, with a concrete example at the end. The block is long relative to a typical tool, but nearly every sentence carries a distinct constraint (determinism, low-s, no key echo, soft failure), so little is wasted.

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?

There is no output schema, and the description compensates by specifying the return shape for every action ({signature, r, s, v, yParity, eip2098, address}, {valid, recovered, low_s}, {address, low_s}, {format, result, low_s}). Together with the parameter-to-action mapping and the low_s caveat, an agent has everything needed to call and interpret results 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 coverage is 100%, so the 3 baseline is met by the schema alone; the description goes beyond it by tying each parameter to an action, documenting the low_s distinction on the returned signature, and explaining why there is deliberately no inline key argument. It adds genuine interpretation rather than restating 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 set (sign, verify, ecrecover, reformat) over a named resource (secp256k1 signature over a 32-byte hash), then enumerates the four actions with their inputs and outputs. It explicitly distinguishes itself from the nearest name-collision sibling, the JSON-RPC eth_sign/personal_sign, by noting the absence of the \x19Ethereum Signed Message prefix.

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

Usage Guidelines5/5

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

Gives explicit routing: hash first with eth_hash (naming kind=eip191 for personal_sign, eip712 for typed data), or pass eth_tx_codec's signing_hash or eth_userop_hash. Each action's required parameters are stated inline, so an agent can pick sign vs verify vs recover vs convert without opening the schema.

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