read_contract
Extract and decode blockchain contract states by specifying contract address, method, and expected output types. Ensures accurate data retrieval for nested structures and tuples.
Instructions
Read contract state from a blockchain. important:
In case of a tuple, don't use type tuple, but specify the inner types (found in the source) in order. For nested structs, include the substructs types.
Example:
struct DataTypeA {
DataTypeB b;
//the liquidity index. Expressed in ray
uint128 liquidityIndex;
}
struct DataTypeB {
address token;
}
results in outputs for function with return type DataTypeA (tuple in abi): outputs: [{"type": "address"}, {"type": "uint128"}]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": {
"network": "<network>",
"contract": "<contract>",
"method": "<method>",
"inputs": "<inputs>",
"outputs": "<outputs>"
},
"name": "read_contract"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| contract | Yes | The contract address | |
| inputs | Yes | Input parameters for the method call | |
| method | Yes | The contract method to call | |
| network | Yes | The blockchain network (e.g., "ethereum", "base") | |
| outputs | Yes | Expected output types for the method call. In case of a tuple, don't use type tuple, but specify the inner types (found in the source) in order. For nested structs, include the substructs types. Example: struct DataTypeA { DataTypeB b; //the liquidity index. Expressed in ray uint128 liquidityIndex; } struct DataTypeB { address token; } results in outputs for function with return type DataTypeA (tuple in abi): outputs: [{"type": "address"}, {"type": "uint128"}] |