Skip to main content
Glama

midnight_call_contract

Execute circuit calls on deployed Midnight smart contracts: public reads, private ZK-proof operations, or state-changing transactions. Supports simulated calls without submission.

Instructions

Execute a circuit call on a deployed Midnight smart contract.

Circuit Types:

  • Public circuits: Read-only operations that don't modify state

  • Private circuits: Operations with private witnesses and ZK proofs

  • State-changing circuits: Modify ledger state (requires wallet)

Call Process:

  1. Load contract at specified address

  2. Prepare circuit arguments

  3. Generate ZK proof (if required)

  4. Submit transaction

  5. Return result or state changes

Privacy Features:

  • Private inputs are never revealed on-chain

  • ZK proofs validate computation without exposing data

  • Private state is stored locally with private_state_id

Example:

midnight_call_contract({
  contract_address: "0x123...",
  circuit_name: "transfer",
  arguments: {
    to: "0xabc...",
    amount: 100
  }
})

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contract_addressNoAddress of the deployed contract
circuit_nameNoName of the circuit to call
argumentsNo
private_state_idNo
networkNoTarget network
wallet_seedNo
simulateNoSimulate the call without submitting transaction
Behavior4/5

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

Given no annotations, the description fully discloses the call process (load contract, prepare args, generate proof, submit), privacy features (private inputs hidden, ZK proofs), and that state-changing requires wallet. It also mentions simulation via the simulate parameter. However, it does not cover error handling, rate limits, or prerequisites like network connection.

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?

Concise and well-structured with bullet points for circuit types, numbered call process, privacy features, and a clear example. Every sentence adds value, no redundancy. Approximately 150 words, appropriate for the tool's complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers purpose, circuit types, process, privacy, and example. Mentions return values (result or state changes). Lacks details on error scenarios, network-specific usage, or parameter constraints. With 7 params and no output schema, this is adequate but could be more complete (e.g., simulate behavior details).

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?

Adds meaning beyond schema by explaining circuit types and the rationale behind parameters like arguments and private_state_id. The example shows how to structure contract_address, circuit_name, and arguments. However, parameters private_state_id, wallet_seed, and simulate are only mentioned in schema without detailed description, and schema coverage is 57%.

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 'Execute a circuit call on a deployed Midnight smart contract.' Distinguishes circuit types (public, private, state-changing) and implicitly differentiates from sibling tools like midnight_compile_contract or midnight_deploy_contract by focusing on calling an existing contract. The example reinforces the action.

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 explicit guidance on when to use each circuit type: public for read-only, private for private witnesses, state-changing for modifications (requires wallet). However, it does not explicitly exclude alternatives or state when not to use this tool (e.g., for deploying contracts). Clear context but no direct exclusions.

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/DaJo-Code/midnight-nextjs-mcp'

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