evm_decode_function_result
Decode hex-encoded EVM function return data with a contract ABI and function name to interpret call results and transaction outputs as named values.
Instructions
Decode function return data from transaction or call.
Takes hex-encoded return data and decodes it according to the function's return types defined in the ABI. Essential for interpreting contract call results and transaction outputs.
CRITICAL RULES:
Requires correct ABI for function being decoded
Data must be hex-encoded return data (0x-prefixed)
Returns both formatted (named) and raw (array) results
Handles BigInt serialization for JSON compatibility
Function must have return values defined in ABI
PARAMETERS:
chain: EVM chain context (required)
abi: Contract ABI (required)
functionName: Function name that returned this data (required)
data: Hex-encoded return data to decode (required)
EXAMPLES: ✅ Decode ERC20 balance: {chain: "polygon", abi: [...ERC20_ABI], functionName: "balanceOf", data: "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000"}
✅ Decode multiple return values: {chain: "ethereum", abi: [...], functionName: "getReserves", data: "0x..."}
✅ Decode struct returns: {chain: "arbitrum", abi: [...], functionName: "getPoolInfo", data: "0x..."}
❌ Invalid - wrong function name: {functionName: "wrongFunction", data: "0x..."} // ABI mismatch
SUPPORTED EVM CHAINS (7 networks): • ethereum (Sepolia) - EIP-1559 enabled, ~12s blocks, moderate gas costs • polygon (Amoy) - Low fees, fast finality (~2s), layer 2 • avalanche (Fuji C-Chain) - Sub-second finality, dynamic fees • bsc (BNB Testnet) - 3s blocks, low gas costs, Binance ecosystem • arbitrum (Sepolia) - Optimistic rollup, low fees, Ethereum security • base (Sepolia) - Coinbase layer 2, EIP-1559, low fees • worldchain (World Sepolia) - World Network testnet, EIP-1559
CRITICAL GAS CONSIDERATIONS:
Ethereum: High gas costs, use gas oracle for timing
Polygon/BSC: Very low gas, safe for frequent transactions
Arbitrum/Base: L2 optimizations, ~10-50x cheaper than Ethereum
Avalanche: Dynamic fees, can spike during congestion
Always check gas price before executing transactions
TESTNET TOKENS: All chains use testnet tokens with NO REAL VALUE. Faucets available for all supported networks.
OUTPUT STRUCTURE: • decodedResult: Formatted result with named outputs • rawResult: Raw array of decoded values • functionName: Function that was decoded
COMMON MISTAKES:
Using wrong ABI for decoding
Mismatched function name
Truncated or malformed data
Not handling BigInt values properly
USE CASES:
Interpret contract call results
Decode transaction return data
Parse multicall results
Debug contract interactions
Extract values from view function calls
Running on Linux.
LINUX-SPECIFIC NOTES:
Package manager: apt (Ubuntu/Debian), yum (RHEL/CentOS), or pacman (Arch)
Python 3 is typically 'python3' command
GNU tools are standard
Use 'xdg-open' command to open files/applications
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": {
"chain": "<chain>",
"abi": "<abi>",
"functionName": "<functionName>",
"data": "<data>"
},
"name": "evm_decode_function_result"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| abi | Yes | Contract ABI | |
| data | Yes | Hex-encoded return data to decode | |
| chain | Yes | EVM chain context | |
| functionName | Yes | Function name that returned this data |