Skip to main content
Glama

Build contract call data (unsigned, nothing sent)

contract_encode_call
Read-onlyIdempotent

Build the calldata for any function of an EVM contract (write functions included) and return it with the target, chain, value (payable functions only, in wei) and a decoded human-readable view, for the user's own wallet to review, sign and send. SwapChan never signs, sends or broadcasts it. Powered by blocktools (ABI coding). How to combine this with the other tools: swapchan_playbook (workflows: find-money, best-swap, rebalance, revoke-approvals, bridge-stuck, token-safety, recover-old-wallet).

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "chainId": "<chainId>",
      "address": "<address>",
      "function": "<function>"
    },
    "name": "contract_encode_call"
  }
}

Input Schema

NameRequiredDescriptionDefault
abiNoOptional ABI JSON to use instead of the Sourcify / Etherscan lookup (labelled as pasted; not checked against source).
argsNoArguments in order; arrays/tuples as JSON lists, big numbers as decimal strings.
valueNoWei to send (payable functions only)
addressYesContract address (0x...)
chainIdYesEVM chain id or name (1 eth, 8453 base, 42161 arbitrum, 10 optimism, 137 polygon, 56 bnb, 43114 avalanche, 59144 linea, 534352 scroll).
functionYesFunction name, or the full signature for overloads, e.g. "balanceOf" or "get(uint256)"

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.2/5.0
Behavior4/5

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

Annotations declare readOnlyHint=true and destructiveHint=false; the description reinforces this with the concrete consequence — nothing is signed, sent or broadcast, so no on-chain state changes from calling it. It also discloses the return shape (target, chain, value in wei, decoded human-readable view) and the backing library (blocktools ABI coding). It does not mention failure modes such as unverified contracts requiring the pasted ABI, which is left entirely to the schema.

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-loaded with the core action and the no-broadcast guarantee in the first sentence, then the library attribution and the playbook pointer. Three sentences with little waste, though the 'Powered by blocktools' attribution is the least load-bearing part.

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?

With no output schema, the description steps in to describe what comes back — calldata plus target, chain, value, and a decoded human-readable view — which is exactly what an agent needs to plan a downstream signing step. Combined with a fully documented schema, an agent can call this correctly without further information.

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 all six parameters are already documented, including the ABI override precedence and the args encoding of tuples/large numbers. The description only restates the value field ('payable functions only, in wei') that the schema already says, adding essentially no parameter meaning beyond structured data. Baseline 3 applies.

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 — build calldata for any EVM contract function — and immediately clarifies an ambiguity an agent would otherwise hit: write functions are included even though nothing is signed or broadcast. That distinguishes it clearly from contract_read/contract_reader (which read state) and from broadcast_tx (which sends).

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?

Makes the usage context explicit: the output is for the user's own wallet to review, sign and send, and SwapChan never signs, sends or broadcasts — which effectively routes the agent to a signing/broadcast path for execution. It also names swapchan_playbook with concrete workflow names. It stops short of naming a specific alternative (e.g., build_swap_tx for swaps or contract_read for view calls), so it's clear context without explicit 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.