Skip to main content
Glama

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

NameRequiredDescriptionDefault
awsNoSign with AWS KMS (requires AWS_KMS_KEY_ID env var)
gcpNoSign with Google Cloud KMS (requires GCP_PROJECT_ID, GCP_LOCATION, GCP_KEY_RING, GCP_KEY_NAME, GCP_KEY_VERSION env vars)
fromNoSender address, used with --unlocked or hardware wallets. Maps to --from for cast/deploy, --sender for forge script.
slowNoSend transactions one at a time (slower but safer)
ledgerNoSign with a Ledger hardware wallet
rpcUrlNoRPC URL of the target network
senderNoOverride --sender address for forge script
trezorNoSign with a Trezor hardware wallet
verifyNoVerify contracts after deployment
accountNoNamed keystore account from ~/.foundry/keystores (recommended for production). Create one with: cast wallet import <name> --interactive
profileNoFoundry profile to use (maps to FOUNDRY_PROFILE env var)
keystoreNoPath to an encrypted keystore JSON file
unlockedNoUse eth_sendTransaction with --from address (no local signing). For nodes that manage keys natively.
broadcastNoActually broadcast transactions on-chain
extraArgsNoAdditional CLI flags
privateKeyNoRaw 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.
scriptPathYesPath to the script file, e.g. script/Deploy.s.sol
projectPathYesAbsolute path to the foundry project directory
passwordFileNoPath to a file containing the keystore password
keystorePasswordNoKeystore password (prefer passwordFile to keep it out of process args)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.5/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are supplied, so the description carries the full burden, and it does deliver the single most important behavioral fact: without broadcast=true nothing hits the chain. It says nothing about irreversibility of broadcasts, runtime/long-running behavior, RPC requirements, or how signing/keystore failures surface across the many signing modes the schema exposes.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two tight sentences with the core action first and the critical safety flag second; nothing is padded. The parenthetical '(forge script)' is mildly redundant with the tool name but harmless.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 20-parameter tool with a fully documented schema, the description covers what an agent most needs to decide correctly: the purpose and the broadcast gate. Absent annotations and an output schema, it could say more about what is returned and that broadcasts are irreversible, but the schema compensates for most parameter-level detail.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% and all 20 parameters carry their own detailed documentation, including env-var prerequisites for KMS and hardware-wallet signing. The description only echoes the `broadcast` parameter's meaning, so it adds no parameter semantics beyond the schema; baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a concrete verb and resource ('Run a Forge script') and clarifies it wraps `forge script`, then names the use cases (deployments, migrations, complex on-chain interactions). It is clearly distinct from the build/test/fmt siblings, but does not distinguish itself from the closest behavioral neighbor, forge_create, which also deploys.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives positive usage context ('deployments, migrations, and complex on-chain interactions') and the key invocation hint that broadcast=true is what actually sends transactions, which implicitly signals the default is a simulation. However, there are no explicit when-not conditions and no named alternatives for simpler cases that forge_create or cast would handle better.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.