forge_test
Runs Foundry project tests with filters for test name, contract, and path; supports live-network forking and gas reports.
Instructions
Run tests in a Foundry project (forge test). Supports filtering by test name, contract, and path. Can fork from a live network and generate gas reports.
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": {
"projectPath": "<projectPath>"
},
"name": "forge_test"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filter | No | Test function name filter (--match-test) | |
| forkUrl | No | RPC URL to fork from for tests | |
| profile | No | Foundry profile to use (maps to FOUNDRY_PROFILE env var) | |
| gasReport | No | Include gas usage report in output | |
| verbosity | No | Verbosity level 0-5 (maps to -v, -vv, etc.) | |
| pathFilter | No | Path filter (--match-path) | |
| projectPath | Yes | Absolute path to the foundry project directory | |
| contractFilter | No | Contract name filter (--match-contract) | |
| forkBlockNumber | No | Block number to fork from (requires forkUrl) |