forge_snapshot
Create or compare gas snapshots to detect changes in smart contract test gas usage; use diff or check to compare against an existing .gas-snapshot and fail on differences.
Instructions
Create or compare gas snapshots (forge snapshot). Use diff=true to compare against existing .gas-snapshot, check=true to fail on changes.
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_snapshot"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| diff | No | Compare against existing .gas-snapshot | |
| check | No | Fail if snapshot differs from existing | |
| filter | No | Test function name filter (--match-test) | |
| profile | No | Foundry profile to use (maps to FOUNDRY_PROFILE env var) | |
| projectPath | Yes | Absolute path to the foundry project directory | |
| contractFilter | No | Contract name filter (--match-contract) |