Skip to main content
Glama

Duo Data Utilities

Keccak-256 hash, 4-byte function selector and 32-byte event topic from a Solidity signature

chain_selector
Read-onlyIdempotent

Compute the Keccak-256 hash of a Solidity function or event signature and derive the 4-byte function selector and the 32-byte event topic. Normalises the signature first — strips parameter names, expands uint to uint256 and the other aliases, flattens tuples — so a signature copied from source code produces the same selector as the canonical form. Also hashes arbitrary text or hex bytes with Keccak-256. Price: $0.05 per successful call, paid over x402 (USDC on Base).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataNoAlternative to signature: raw data to Keccak-256 hash. Accepted: at most 8192 characters.
kindNofunction (default), event or error. Accepted: function, event, error.
encodingNoEncoding of data: utf8 (default) or hex. Accepted: utf8, hex.
signatureNoSolidity function, event or error signature, e.g. transfer(address to, uint amount). Accepted: at most 1024 characters.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.3/5.0
Behavior4/5

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

Annotations declare readOnlyHint and idempotentHint, so safety is already covered; the description goes beyond by disclosing cost and payment mechanics ('$0.05 per successful call, paid over x402 (USDC on Base)') and the normalisation pipeline. It stops short of describing failure behaviour for malformed signatures, which is the remaining behavioral gap.

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?

Front-loads the core purpose, then normalisation, alternate mode, and pricing — each sentence carries distinct information with no filler. Slightly long at four sentences, but nothing is redundant enough to cut.

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

Completeness4/5

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

No output schema exists, but the description enumerates the outputs (Keccak-256 hash, 4-byte selector, 32-byte topic), and all four parameters are fully documented in the schema. Cost, normalisation, and dual input modes are all covered; only error/invalid-input behaviour is unaddressed.

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 baseline is 3; the description earns above baseline by explaining how the signature parameter is interpreted (parameter names stripped, uint expanded to uint256, tuples flattened) and by clarifying that data is the raw-hash alternative. That meaning is not recoverable from the schema descriptions alone.

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?

States a specific verb and resource ('Compute the Keccak-256 hash of a Solidity function or event signature') and names the exact derived outputs (4-byte selector, 32-byte event topic). It also carves out a secondary mode ('Also hashes arbitrary text or hex bytes'), so an agent can distinguish it from generic hashing siblings like code_hash.

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?

Gives clear usage context: use it on signatures copied from source because normalisation guarantees the canonical selector, and use the data/encoding path for arbitrary text or hex. It does not explicitly state when not to use it or name an alternative sibling, but the mode selection (signature vs data) is well implied.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources