Skip to main content
Glama

midnight-analyze-contract

Read-onlyIdempotent

Analyze contract structure and security patterns through static analysis. Provides structural insights and recommendations without compiling the code.

Instructions

⚠️ STATIC ANALYSIS ONLY - Analyze contract structure and patterns. 🚫 THIS DOES NOT COMPILE THE CONTRACT. Cannot catch: sealed field rules, disclose() requirements, semantic errors. 👉 Use 'midnight-extract-contract-structure' for pre-compilation checks.

Use this for: understanding structure, security pattern analysis, recommendations. NEVER claim a contract 'works' or 'compiles' based on this tool alone.

USAGE GUIDANCE: • Call once per contract - results are deterministic • For security review, also use midnight-review-contract (requires sampling) • Run before making changes, not repeatedly during iteration

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesCompact contract source code to analyze
checkSecurityNoRun security analysis (default: true)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
summaryYesSummary statistics of the contract
structureYesContract structure breakdown
securityFindingsYesSecurity analysis findings
recommendationsYesRecommendations for improvement
Behavior5/5

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

Annotations already declare readOnlyHint and idempotentHint. Description adds crucial behavioral details: it's static analysis only, does not compile, cannot catch certain errors (sealed field rules, disclose() requirements, semantic errors). This exceeds what annotations provide.

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 warnings front-loaded. Slightly wordy (e.g., repeated emphasis on static analysis), but each sentence adds value. Usage guidance is clearly separated. Concise enough for quick scanning.

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 (static analysis with security), the description covers purpose, limitations, usage patterns, and alternatives. Output schema exists, so return values need not be explained. Fully adequate for an agent to decide and invoke correctly.

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 coverage is 100% with clear descriptions for both parameters (code, checkSecurity). Description does not add parameter-specific semantics beyond the schema, which is sufficient. Baseline 3 is appropriate.

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 it performs static analysis of contract structure and patterns, distinguishing it from sibling tools like 'midnight-extract-contract-structure' (pre-compilation) and 'midnight-review-contract' (security review). It specifies what it does and does not do.

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 explicit when-to-use (understanding structure, security pattern analysis) and when-not-to-use (never claim works/compiles). Names alternative tools for other tasks. Gives call frequency guidance (once per contract, before changes).

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