Skip to main content
Glama

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

NameRequiredDescriptionDefault
diffNoCompare against existing .gas-snapshot
checkNoFail if snapshot differs from existing
filterNoTest function name filter (--match-test)
profileNoFoundry profile to use (maps to FOUNDRY_PROFILE env var)
projectPathYesAbsolute path to the foundry project directory
contractFilterNoContract name filter (--match-contract)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.7/5.0
Behavior3/5

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

With no annotations, the description carries the full behavioral burden. It does disclose that check=true fails on changes and that diff reads an existing .gas-snapshot, which is useful beyond structured fields. However, it never says whether the default invocation writes or overwrites the .gas-snapshot file, nor what the output looks like, which are the key risks for a snapshot-writing tool.

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

Conciseness5/5

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

Two short sentences, front-loaded with the core action and followed by the mode flags. Every clause earns its place and there is no filler or repetition.

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

Completeness3/5

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

For a six-parameter tool with no annotations and no output schema, the description covers the two mode flags but omits the write/overwrite semantics of the default behavior and any sense of what a snapshot result contains. The schema handles the remaining parameters well, so this is adequate but with a real gap around side effects.

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 the schema already states 'Compare against existing .gas-snapshot' for diff and 'Fail if snapshot differs from existing' for check, so the description's parameter notes are nearly verbatim restatements. The filter, profile, and contractFilter parameters are documented only in the schema and receive no added context here. 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?

The description uses a specific verb pair and resource: 'Create or compare gas snapshots', plus the underlying CLI command '(forge snapshot)'. That is unambiguous and no sibling tool covers snapshotting, though it does not explicitly contrast itself with forge_test or forge_coverage, which also produce gas data.

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

Usage Guidelines4/5

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

It routes between the tool's two operating modes: 'Use diff=true to compare against existing .gas-snapshot, check=true to fail on changes.' That is concrete conditional guidance. It stops short of stating when not to use the tool or how diff and check interact if both are set.

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