Skip to main content
Glama

Compile & Diagnose Solidity

evm_compile_and_diagnose
Read-onlyIdempotent

Compile a Foundry project and return structured compiler diagnostics. On failure, provides file, line, column, message, and code snippet for each error.

Instructions

Run forge build and return structured compiler diagnostics.

If compilation succeeds, returns { "success": true, "diagnostics": [] }. If compilation fails, parses the error output into a JSON array of diagnostics.

Args:

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

Returns: { "success": boolean, // true if the project compiled cleanly "diagnostics": [ { "file": string, // e.g. "src/Token.sol" "line": number, // Line number (1-indexed) "column": number, // Column number (1-indexed) "message": string, // Compiler error message "snippet": string // Code snippet around the error } ] }

Examples:

  • "Check if my contracts compile" → projectPath = "/path/to/project"

  • "Fix the compilation error" → call this tool, read the diagnostics, fix the file

Error Handling:

  • Returns isError=true if forge is not installed

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectPathYesAbsolute path to the Foundry project root

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
successYes
diagnosticsYes
Behavior5/5

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

Annotations already indicate readOnlyHint=true, idempotentHint=true, destructiveHint=false. The description adds context: error handling (returns isError=true if forge not installed), details on return format, and that output is structured diagnostics. 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?

Well-structured with sections: purpose, args, returns, examples, error handling. Front-loaded with the main action. Every sentence adds value; no fluff.

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 one parameter, full return type described, good annotations, and examples covering common cases, the description is complete for an agent to understand usage and outcomes.

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 already documents 'projectPath' as absolute path. Description adds example values and clarifies it is the 'Foundry project root'. Schema coverage is 100%, so marginal added value but enough to be helpful.

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 clearly states 'Run forge build and return structured compiler diagnostics.' The verb 'compile' and resource 'Solidity project' are specific. It distinguishes from siblings like evm_run_tests and evm_scan_vulnerabilities by its focus on compilation diagnostics.

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 examples like 'Check if my contracts compile' and 'Fix the compilation error', indicating when to use. However, it does not explicitly state when not to use or compare with sibling tools, leaving some room for ambiguity.

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