Skip to main content
Glama

Duo Data Utilities: IBAN, ISIN, VAT & Tax ID, Barcode, Timezone, Geo APIs

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

solidity_function_selector
Read-onlyIdempotent

Solidity function selector and event topic: compute the Keccak-256 hash of a function or event signature and derive the 4-byte selector and the 32-byte 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. Added

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already declare readOnlyHint/idempotentHint, so the bar is lower, and the description goes beyond them by disclosing the signature normalisation rules (parameter names stripped, uint expanded to uint256, tuples flattened) and the payment model ($0.05 per successful call via x402/USDC on Base). It omits error behaviour for malformed signatures.

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?

Four sentences, front-loaded with the primary capability before the normalisation detail and the pricing footnote. Efficient overall, though the pricing sentence is dispensable for invocation and the normalisation sentence is dense.

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, and the description does cover the return shape (4-byte selector, 32-byte topic), plus payment and normalisation context. Remaining gaps are minor: no statement of precedence between signature and data, and no error/edge-case behaviour.

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 a 3 is the baseline, but the description adds real meaning: it explains that normalisation makes a source-copied signature hash identically to the canonical form, and that the data parameter hashes arbitrary text or hex bytes rather than signatures. That clarifies intent beyond the enum/length descriptions in 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?

States a specific verb (compute/derive), a specific algorithm (Keccak-256), and concrete artifacts (4-byte selector, 32-byte event topic) tied to a named domain (Solidity). This is precise enough to separate it from the generic sibling hash_generate without opening either schema.

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?

Usage is implied by the domain description rather than stated: an agent can infer it is for Solidity signatures, but there is no explicit when-to-use/when-not, no mention of hash_generate as the alternative for non-Keccac hashes, and no statement of what happens when neither signature nor data is supplied.

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.