Skip to main content
Glama

Analyze EVM Gas Profile

evm_analyze_gas_profile
Read-onlyIdempotent

Run forge test --gas-report on a Foundry project and return structured gas consumption data per contract and function, including deployment cost, bytecode size, and function gas metrics.

Instructions

Run forge test --gas-report and return structured gas consumption data per contract and function.

Args:

  • projectPath (string): Absolute path to a Foundry project (must contain foundry.toml)

Returns: JSON object: { "contracts": [ { "name": string, // e.g. "src/Token.sol:Token" "deploymentCost": number, // Gas used for deployment "deploymentSize": number, // Bytecode size in bytes "functions": [ { "name": string, // Function name "min": number, // Minimum gas "avg": number, // Average gas "median": number, // Median gas "max": number, // Maximum gas "calls": number // Number of calls in tests } ] } ] }

Examples:

  • "Show gas usage for my project" → projectPath = "/path/to/foundry-project"

  • Do NOT use for security auditing (use evm_scan_vulnerabilities instead)

Error Handling:

  • Returns isError=true if Foundry is not installed or tests fail to compile

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectPathYesAbsolute path to the Foundry project root

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
contractsYes
Behavior4/5

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

Annotations already indicate readOnlyHint=true, destructiveHint=false, idempotentHint=true. The description adds that it runs forge test, which may imply compilation and execution, and includes error handling (returns isError=true if Foundry missing or compilation fails). No contradiction to annotations.

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?

Description is well-organized with clear sections (Args, Returns, Examples, Error Handling). It is concise, front-loads the main action, and each sentence adds value without redundancy.

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?

With one parameter, a detailed output schema, comprehensive annotations, and error handling documented, the description covers all necessary aspects for an agent to correctly invoke and interpret 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 description 'Absolute path to the Foundry project root'. The description adds extra context: 'must contain foundry.toml' and provides an example value, enriching understanding beyond the schema alone.

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?

Description explicitly states 'Run forge test --gas-report and return structured gas consumption data per contract and function.' This clearly differentiates from sibling tools like evm_scan_vulnerabilities, which is for security auditing.

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?

Provides a clear example ('Show gas usage for my project') and explicitly states 'Do NOT use for security auditing (use evm_scan_vulnerabilities instead).' Also mentions prerequisites (must contain foundry.toml), but does not elaborate on when to use other siblings beyond the security one.

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