The forc-call module provides MCP tools for interacting with deployed Fuel contracts, enabling AI assistants to call functions, inspect ABIs, transfer assets, and analyze execution traces.
Call functions on deployed Fuel contracts with full support for complex types and execution modes.
Parameters:
contract_id
(string) - Contract address to call abi
(string) - Contract ABI (JSON string or URL) function
(string) - Function name to call function_args
(array) - Function arguments as encoded strings mode
(string) - Execution mode: dry-run
(default), simulate
, or live
node_url
(string, optional) - Custom node URL signing_key
(string, optional) - Private key for live transactions amount
(number, optional) - Asset amount for payable functions asset_id
(string, optional) - Asset ID for transfers (default: native asset) gas_price
(number, optional) - Gas price setting verbosity
(number, optional) - Output verbosity level (0-3) Example:
{
"tool": "call_contract",
"parameters": {
"contract_id": "0x1234567890abcdef...",
"abi": "{\"functions\":[{\"name\":\"get_balance\",\"outputs\":[{\"type\":\"u64\"}]}]}",
"function": "get_balance",
"mode": "dry-run"
}
}
List all callable functions in a contract's ABI with example usage commands.
Parameters:
contract_id
(string) - Contract address abi
(string) - Contract ABI (JSON string or URL) Example:
{
"tool": "list_contract_functions",
"parameters": {
"contract_id": "0x1234567890abcdef...",
"abi": "https://api.fuel.network/contract-abi.json"
}
}
Transfer assets directly to addresses or contracts (live mode only).
Parameters:
signing_key
(string) - Private key for transaction signing recipient
(string) - Recipient address or contract ID amount
(number) - Transfer amount asset_id
(string, optional) - Asset ID (default: native asset) node_url
(string, optional) - Custom node URL verbosity
(number, optional) - Output verbosity level Example:
{
"tool": "transfer_assets",
"parameters": {
"recipient": "0x5678901234abcdef...",
"amount": 1000,
"signing_key": "your-private-key"
}
}
Generate human-readable execution traces from contract call results.
Parameters:
trace_events
(array) - Trace events from CallResponse total_gas
(number) - Total gas used labels
(object, optional) - Contract address to name mappings Example:
{
"tool": "get_execution_trace",
"parameters": {
"trace_events": [/* events from call result */],
"total_gas": 50000,
"labels": {
"0x1234...": "MainContract",
"0x5678...": "TokenContract"
}
}
}
The forc-call module provides comprehensive documentation resources accessible through the MCP protocol:
forc-call://type-encoding-reference
)
forc-call://examples/common-commands
)
forc-call://examples/contract-samples
)
Resources can be accessed through the MCP resources API:
list_resources
to see all available resources read_resource
with the URIs above to access specific documentation The forc-call module supports three execution modes:
When calling contract functions, arguments must be encoded according to their Sway types. Refer to the Type Encoding Reference resource for detailed information on encoding various types including:
The module provides detailed error messages for common issues:
dry-run
mode first to validate calls list_contract_functions
before calling