Skip to main content
Glama

Run Foundry Tests

evm_run_tests
Read-only

Run Foundry forge tests and get structured results with per-test status, fuzz counterexamples, and gas metrics to verify smart contract behavior after changes.

Instructions

Run forge test and return structured per-suite, per-test results — including fuzz runs and the exact counterexample calldata for failing fuzz/invariant tests.

Use this to verify behavior equivalence after a rewrite, run invariant suites, or drive a Generate-Repair-Execute proof-of-concept loop.

Args:

  • projectPath (string): Absolute path to the Foundry project root

  • matchTest (string, optional): Only run test functions matching this regex (forge --match-test)

  • matchPath (string, optional): Only run test files matching this glob (forge --match-path)

Returns: JSON object: { "allPassed": boolean, "totalPassed": number, "totalFailed": number, "totalSkipped": number, "suites": [ { "name": string, // e.g. "test/Vault.t.sol:VaultTest" "passed": number, "failed": number, "skipped": number, "tests": [ { "name": string, // e.g. "testFuzz_withdraw(uint256)" "status": string, // "pass" | "fail" | "skip" "reason": string, // Failure reason (on fail) "counterexample": string, // Fuzz counterexample calldata + args (on fuzz fail) "gas": number, // Gas for unit tests "fuzzRuns": number, // Runs for fuzz/invariant tests "medianGas": number // Median gas for fuzz tests } ] } ] }

Examples:

  • "Do my invariant tests still hold?" → matchTest = "invariant"

  • "Verify the refactor didn't break Vault" → matchPath = "test/Vault.t.sol"

Error Handling:

  • Returns isError=true if forge is not installed, the path is invalid, or compilation fails (use evm_compile_and_diagnose for compiler errors)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
matchPathNoOnly run test files matching this glob
matchTestNoOnly run test functions matching this regex
projectPathYesAbsolute path to the Foundry project root

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
suitesYes
allPassedYes
totalFailedYes
totalPassedYes
totalSkippedYes
Behavior4/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false. The description adds value by detailing the structured return format, including fuzz counterexample calldata, and specifying error conditions (isError for missing forge, invalid path, compilation failure). No contradictions.

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?

The description is well-structured with sections for purpose, usage, arguments, returns, examples, and error handling. Every sentence adds value, no fluff, and it is front-loaded with the core action.

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

Completeness5/5

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

Given the tool's complexity (nested return object with failures, fuzz data), the description fully explains the output schema, error cases, and provides concrete examples. No gaps for an agent to understand invocation and results.

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

Parameters4/5

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

Schema coverage is 100% with descriptions for all three parameters. The description adds context by explaining matchTest as regex and matchPath as glob, and includes usage examples that clarify parameter semantics. Slight duplication but beneficial elaboration.

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

Purpose5/5

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

The description explicitly states it runs forge test and returns structured per-suite, per-test results. It distinguishes from siblings by mentioning 'use evm_compile_and_diagnose for compiler errors' and the unique output includes fuzz counterexample 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?

The description provides clear use cases: verify behavior equivalence, run invariant suites, or drive a Generate-Repair-Execute loop. It includes examples and error handling notes, but lacks an explicit 'when not to use' statement for sibling tools.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/0xendale/evm-agent-toolkit'

If you have feedback or need assistance with the MCP directory API, please join our Discord server