Skip to main content
Glama

midnight-compile-contract

Read-onlyIdempotent

Compile Compact contract code to validate syntax and semantics using a hosted compiler. Returns compiler errors or falls back to static analysis for reliability.

Instructions

🔧 REAL COMPILATION - Compile Compact code using the hosted compiler service.

Unlike static analysis tools, this ACTUALLY COMPILES the contract and returns real compiler errors.

Use this to: • Validate that generated code compiles before showing to users • Get actual compiler error messages with line numbers • Check if a contract is syntactically and semantically correct

Options: • skipZk=true (default): Fast syntax validation only (~1-2s) • fullCompile=true: Full compilation with ZK circuit generation (~10-30s)

FALLBACK BEHAVIOR: • If the compiler service is unavailable, automatically falls back to static analysis • Check 'validationType' in response: 'compiler' = real compilation, 'static-analysis-fallback' = fallback mode • Fallback provides structure/security analysis but may miss semantic errors

USAGE GUIDANCE: • Call after generating or modifying Compact code • Use skipZk=true for quick validation during development • Use fullCompile=true for final validation before deployment

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesCompact contract source code to compile
skipZkNoSkip ZK circuit generation for faster syntax-only validation (default: true)
fullCompileNoPerform full compilation including ZK generation (slower but complete)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
successYesWhether compilation/validation succeeded
messageYesHuman-readable status message
validationTypeYesType of validation performed - compiler (real) or static-analysis-fallback (when service unavailable)
compilerVersionNoVersion of the Compact compiler used (if available)
compilationModeNoType of compilation performed
outputNo
warningsNoCompiler warnings or fallback warnings
errorNoError code if compilation failed
locationNoLocation of error if applicable
hintNoHelpful hint for resolving the issue
serviceUrlNoURL of the compiler service used
serviceAvailableNoWhether the compiler service is available
fallbackReasonNoReason for falling back to static analysis (if applicable)
staticAnalysisNoStatic analysis results (only present when using fallback)
Behavior5/5

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

Goes well beyond annotations by detailing fallback to static analysis, explaining response field validationType, and providing time estimates for compilation modes. Aligns with readOnlyHint and idempotentHint, 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.

Conciseness4/5

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

Well-structured with sections, bullet points, and emojis. Each sentence provides distinct value. Slightly verbose but not wasteful; could be tightened slightly.

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?

Covers purpose, usage guidance, parameter behavior, fallback, and response interpretation. With output schema present, return values don't need explanation. Complete for a compilation tool with moderate complexity.

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%, so baseline 3. Description adds practical context: time estimates for skipZk vs fullCompile, default behavior, and fallback implications for parameters. Adds value beyond schema.

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?

Clearly states it compiles Compact code using a hosted compiler service, distinguishing itself from static analysis tools like midnight-analyze-contract. The emphasis on 'REAL COMPILATION' and 'returns real compiler errors' makes its purpose explicit.

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

Usage Guidelines5/5

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

Provides clear when to use (after generating/modifying code, for validation), when to use each option (skipZk for quick validation, fullCompile for final checks), and explains fallback behavior when service is unavailable. Implicitly contrasts with static analysis 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/Olanetsoft/midnight-mcp'

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