Skip to main content
Glama

Duo Data Utilities: IBAN, VAT, ISIN Validation API

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).

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "solidity_function_selector"
  }
}

Input 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. Changed1 schema field changed
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
  2. 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 and openWorldHint=false, so safety needs little elaboration. The description adds genuinely non-obvious behaviour: the signature is normalised (parameter names stripped, uint expanded to uint256, tuples flattened) so source-copied signatures match canonical selectors, and it discloses a $0.05 x402/USDC-on-Base payment per successful call, which is critical operational context. Minor gap: no note on output shape beyond the 4-byte/32-byte result lengths.

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 capability is front-loaded in the first clause, followed by the normalisation benefit and then the secondary hashing mode and price. Sentence flow is logical and each element carries information, though the pricing sentence and the normalisation detail compete for attention. Slightly dense but not padded.

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?

For a stateless, idempotent hashing utility with no output schema, the description covers inputs, canonicalisation, both operating modes, result sizes and cost. The only meaningful omission is the mutual exclusivity/precedence of signature versus data. An agent has enough 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 coverage is 100%, so the baseline is 3 and the schema already documents each parameter including the signature/data alternatives and the kind/encoding enums. The description goes beyond it by explaining the normalisation applied to `signature`, which tells the agent that loosely formatted inputs are acceptable. It does not clarify precedence when both signature and data are provided, which the schema only hints at.

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 and resource chain: compute Keccak-256 of a function/event signature, derive the 4-byte selector and 32-byte topic, with an additional arbitrary-data hashing mode. It is clearly distinguishable from generic hash siblings like hash_generate because it is scoped to Solidity signature canonicalisation. An agent can identify the tool's job without opening the 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?

The description frames the two usage modes indirectly (signature-based vs 'arbitrary text or hex bytes'), which implies when the tool applies. However it never states when to prefer this over sibling hash_generate for plain Keccak hashing, nor does it say what happens if both signature and data are supplied. Usage is inferable but not explicitly routed.

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.