Skip to main content
Glama

encode_function_data

Encode function call data from an ABI, function name, and optional arguments into a hex string for building transaction calldata.

Instructions

Encode function call data from ABI, function name, and optional args. Uses viem encodeFunctionData. Returns hex data string. Use for building transaction calldata.

Input Schema

NameRequiredDescriptionDefault
abiYesABI as JSON string or array (must include the function)
argsNoOptional array of arguments (in order)
functionNameYesName of the function

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.5/5.0
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses the return type ('hex data string') and the underlying implementation (viem encodeFunctionData), but does not state that it is a pure, side-effect-free local computation, nor what happens on invalid ABI/args. Adequate but incomplete for an unannotated tool.

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 short sentences, front-loaded with purpose and ending with the usage cue. Slightly redundant, since 'Uses viem encodeFunctionData' largely restates 'Encode function call data from ABI,' but overall tight.

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 simple 3-parameter, fully documented, non-mutating utility with no output schema, the description covers purpose, inputs, return format, and usage. Missing only edge-case/error behavior, which is minor here.

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 three parameters. The description only echoes the parameter list ('ABI, function name, and optional args') without adding syntax, ordering, or format detail beyond what the schema provides. Baseline 3 is correct.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb (Encode) and resource (function call data) and enumerates the inputs (ABI, function name, optional args). It is clearly distinguishable from the read-oriented siblings, though it does not name any sibling explicitly.

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?

'Use for building transaction calldata' gives a clear when-to-use context, but there are no exclusions, prerequisites, or named alternatives (e.g., when to use read_contract vs this). Guidance is implied rather than explicit.

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