forge_script
Run Forge scripts for smart contract deployments, migrations, and complex on-chain interactions; enable broadcasting to send transactions on-chain.
Instructions
Run a Forge script (forge script). Use for deployments, migrations, and complex on-chain interactions. Pass broadcast=true to send transactions on-chain.
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>",
"scriptPath": "<scriptPath>"
},
"name": "forge_script"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| aws | No | Sign with AWS KMS (requires AWS_KMS_KEY_ID env var) | |
| gcp | No | Sign with Google Cloud KMS (requires GCP_PROJECT_ID, GCP_LOCATION, GCP_KEY_RING, GCP_KEY_NAME, GCP_KEY_VERSION env vars) | |
| from | No | Sender address, used with --unlocked or hardware wallets. Maps to --from for cast/deploy, --sender for forge script. | |
| slow | No | Send transactions one at a time (slower but safer) | |
| ledger | No | Sign with a Ledger hardware wallet | |
| rpcUrl | No | RPC URL of the target network | |
| sender | No | Override --sender address for forge script | |
| trezor | No | Sign with a Trezor hardware wallet | |
| verify | No | Verify contracts after deployment | |
| account | No | Named keystore account from ~/.foundry/keystores (recommended for production). Create one with: cast wallet import <name> --interactive | |
| profile | No | Foundry profile to use (maps to FOUNDRY_PROFILE env var) | |
| keystore | No | Path to an encrypted keystore JSON file | |
| unlocked | No | Use eth_sendTransaction with --from address (no local signing). For nodes that manage keys natively. | |
| broadcast | No | Actually broadcast transactions on-chain | |
| extraArgs | No | Additional CLI flags | |
| privateKey | No | Raw private key for signing. Only use for local development with well-known test keys (e.g. anvil accounts). For production, use 'account' (named keystore) or hardware wallets instead. | |
| scriptPath | Yes | Path to the script file, e.g. script/Deploy.s.sol | |
| projectPath | Yes | Absolute path to the foundry project directory | |
| passwordFile | No | Path to a file containing the keystore password | |
| keystorePassword | No | Keystore password (prefer passwordFile to keep it out of process args) |