Skip to main content
Glama

midnight-generate-contract

Generate Compact smart contracts from natural language requirements, specifying state variables, access control, and operations.

Instructions

🔮 AI-POWERED CONTRACT GENERATION

Generates Compact smart contracts from natural language requirements. Uses the client's LLM through MCP sampling to create contracts.

REQUIREMENTS FORMAT:

  • Describe what the contract should do

  • Specify state variables needed

  • Define access control requirements

  • List the operations/circuits needed

CONTRACT TYPES: • counter - Simple counter with increment/decrement • token - Token with transfers and balances • voting - Voting/governance mechanisms • custom - Free-form custom contract

EXAMPLE USAGE: "Create a token contract with private balances, mint/burn capabilities for admin, and transfer functionality between users"

⚠️ REQUIRES: Client with sampling capability (e.g., Claude Desktop)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
requirementsYesNatural language description of the contract requirements
contractTypeNoType of contract to generate
baseExampleNoExample contract code to use as a base

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesGenerated Compact contract code
explanationYesBrief explanation of what the contract does
warningsYesAny warnings or notes about the generated code
samplingAvailableYesWhether sampling capability was available
Behavior5/5

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

The description adds significant behavioral context beyond annotations: it uses the client's LLM through MCP sampling, requires sampling capability, and warns about prerequisites. It does not contradict 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?

The description is well-structured with clear sections (REQUIREMENTS FORMAT, CONTRACT TYPES, EXAMPLE USAGE, ⚠️ REQUIRES). Every sentence is informative and earns its place, though slightly lengthy.

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 and presence of output schema, the description covers requirements format, contract types, example, and prerequisites. It is sufficiently complete for an AI agent to understand and invoke the tool correctly.

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?

With 100% schema coverage, baseline is 3. The description adds value by explaining contract types, requirements format, and providing an example, which aids in understanding parameter usage beyond the 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?

The description clearly states 'Generates Compact smart contracts from natural language requirements.' It uses a specific verb ('Generates') and resource ('Compact smart contracts'), and distinguishes from sibling tools like midnight-analyze-contract or midnight-review-contract by focusing on generation.

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?

It provides clear context on when to use (natural language requirements), but lacks explicit guidance on when not to use or alternatives. It does mention required client capability and gives example usage, but does not compare to other 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/Olanetsoft/midnight-mcp'

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