query_sc
Execute read-only queries against Klever smart contracts via view calls. Returns base64-encoded contract function results without modifying state.
Instructions
Execute a read-only query against a Klever smart contract (VM view call). Returns the contract function result as base64-encoded return data. Arguments must be base64-encoded. Use this to read contract state without modifying it.
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": {
"scAddress": "<scAddress>",
"funcName": "<funcName>"
},
"name": "query_sc"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scAddress | Yes | Smart contract address (klv1... bech32 format). | |
| funcName | Yes | Function name to call (must be a #[view] function on the contract). | |
| args | No | Optional base64-encoded arguments. For addresses, encode the hex-decoded bech32 bytes. For numbers, use big-endian byte encoding. | |
| caller | No | Optional caller address (klv1... bech32 format). Some view functions use the caller to look up address-keyed storage mappers. | |
| network | No | Network to query. Options: "mainnet", "testnet", "devnet", "local". Defaults to server default (mainnet). |