Skip to main content
Glama

eth_encode_calldata

Read-only

Encode a function call into ABI-encoded calldata hex. Accepts either a human-readable function signature (e.g. 'transfer(address to, uint256 amount)') or a full ABI JSON array plus function name. Pass uint/int values as decimal strings to avoid JS number precision loss. Pure computation — no RPC call needed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
abiNoFull ABI as a JSON array (or JSON-encoded string). Use with function_name.
argsNoArguments array. Pass uint/int values as decimal or hex strings for precision.
signatureNoHuman-readable function signature, e.g. 'transfer(address to, uint256 amount)'. Use instead of abi+function_name.
function_nameNoFunction name — required when using abi instead of signature

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 already include readOnlyHint=true and openWorldHint=true, signaling a safe read-only operation. The description adds 'Pure computation — no RPC call needed,' clarifying no network side effects, and warns about JS number precision loss by passing uint/int as decimal strings. This provides useful behavioral context beyond the annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is compact and front-loaded with the purpose. Every sentence adds value: purpose, input modes, precision guidance, and the pure-computation trait. There is no fluff or redundant phrasing.

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?

Given the tool's moderate complexity and full parameter schema, the description is complete. It explains both input modes, the output type (ABI-encoded calldata hex), and the no-RPC nature. The absence of an output schema is mitigated by the clear statement of what is returned.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all four parameters, including the need to pass uint/int as decimal or hex strings. The description adds a practical example and clarifies the two modes (signature vs abi+function_name), but this guidance is largely redundant with the existing parameter descriptions. It adds marginal value beyond 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?

The description clearly states the action: 'Encode a function call into ABI-encoded calldata hex.' This verb+resource pairing distinguishes it from sibling decode tools (eth_decode_calldata) and call tools (eth_call) since it focuses on producing calldata. The example signature further clarifies the domain.

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?

The description gives clear context: it is for encoding calldata locally, emphasized by 'Pure computation — no RPC call needed.' It explains the two input modes (signature vs abi+function_name) but does not explicitly name alternatives or exclusions (e.g., 'for decoding, use eth_decode_calldata'). This is a clear context without formal exclusions.

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