Skip to main content
Glama
@odatano/nightgate-mcp

@odatano/nightgate-mcp

Official
by ODATANO

call_contract

Call a circuit on an installed lineage contract, with the transaction built, proven, and signed server-side and sponsored so the caller needs neither NIGHT nor DUST.

Instructions

Call a circuit on any contract whose lineage package is installed next to this server (laid out like @odatano/contract-: contract.json, the compiled class, the proving files). The call is built, proven and signed here from the caller seed and a sponsor pays, so the caller holds neither NIGHT nor DUST. Arguments are JSON in circuit order; tagged values: {"$bytes":""}, {"$uint":""}, and {"$coin":{"tokenType","amount"}} for a shielded coin the circuit receives, funded from this wallet, the one get_swap_wallet shows (a gateway key syncs it through the gateway, a direct instance needs NIGHTGATE_INDEXER_HTTP_URL and _WS_URL; the tool waits up to 20 s for its sync, a first sync from genesis takes about 5 minutes). {"$night":""} is a NIGHT amount the circuit takes from this wallet (receiveUnshielded, a deposit or a stake): the wallet syncs its NIGHT coins and pays them in, the sponsor adds only the fee; set payUnshielded when the amount is no argument. Needs allowUnshieldedOffers on the grant; one pay-in runs at a time. A payout the circuit makes to this wallet (sendUnshielded, a claim or a refund) needs nothing extra. A call that funds anything is bound and goes through the serial sponsor channel, one without through the parallel one. Witnesses come from the package when its contract.json names a witnesses module (createWitnesses gets a secret derived from the seed for that package; the private state they return is kept once the call landed). The contract has to be sponsorable (its address and circuit on the sponsor's policy). The answer waits for the block; a call the chain refused gives its coins back. The tool waits until the job settled (about 1 minute) and returns { status, txHash, transactionHash, result }. failed: next says what to do. If the call was cut off or came back pending, run it again with the same arguments: it picks up the job it started and submits nothing new (the answer says deduplicated). With an idempotencyKey that also holds after a restart of this server. A second, separate call with the same arguments needs a new idempotencyKey.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "package": "<package>",
      "contractAddress": "<contractAddress>",
      "circuit": "<circuit>"
    },
    "name": "call_contract"
  }
}

Input Schema

NameRequiredDescriptionDefault
argsNoCircuit arguments in order, with the tagged values described above
circuitYesThe circuit to call
packageYesThe installed lineage package, for example @meridian/contract-m402
payUnshieldedNoThe circuit takes unshielded tokens from this wallet; implied by a $night argument
idempotencyKeyNoDedupes retries; an identical call without a new key returns the first job
contractAddressYesThe deployment to call

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.21.0
    • changedInput schema / properties / idempotencyKey / description
      Previous value: -"Dedupes retries"New value: +"Dedupes retries; an identical call without a new key returns the first job"
    • addedInput schema / properties / payUnshielded
      Added value: +{
      +  "description": "The circuit takes unshielded tokens from this wallet; implied by a $night argument",
      +  "type": "boolean"
      +}
  2. Addedv0.20.3

TDQS

A4/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so unusually well: it discloses that the caller needs neither NIGHT nor DUST, that the sponsor pays, that $night pay-ins mutate the wallet and need allowUnshieldedOffers, that only one pay-in runs at a time, the serial vs parallel sponsor channel distinction, the ~20 s sync wait (5 min from genesis), and that the tool blocks about a minute for settlement. It also states the failure model (refused calls return coins) and the exact return shape { status, txHash, transactionHash, result }.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

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

The purpose is front-loaded in sentence one, but the remainder is a single dense block riddled with nested parentheticals about wallet sync, env vars, sponsor channels, witnesses and dedupe. Nearly every fact earns its place, yet the lack of paragraph breaks or ordering by caller concern makes it hard to scan and slows extraction of the retry rule, which is buried near the end.

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?

For a six-parameter, no-output-schema mutation tool with stateful wallet side effects, this is close to complete: it covers prerequisites, sponsorship, witness derivation, argument encoding, retry/idempotency, settlement timing and return shape. The only omission is any mapping to sibling tools, which is a usage-guidance gap rather than a missing behavior.

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 the baseline would be 3, but the description adds real meaning the schema only gestures at: the tagged-value grammar ({"$bytes"}, {"$uint"}, {"$coin"}, {"$night"}), that args are in circuit order, that $night implies payUnshielded, and that idempotencyKey dedupes retries and survives a server restart. These are operational semantics not recoverable from the field descriptions alone.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: 'Call a circuit on any contract whose lineage package is installed next to this server', and scopes it with the package layout (contract.json, compiled class, proving files). The action and object are unambiguous, but it never contrasts itself with siblings like submit_vault_call or build_sponsorable_transaction, so an agent must already know which entry point fits its case.

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

Usage Guidelines3/5

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

Prerequisites are spelled out (contract must be sponsorable per the sponsor's policy, allowUnshieldedOffers on the grant, NIGHTGATE_INDEXER_HTTP_URL/_WS_URL for direct instances), which implies when this tool applies. However there is no explicit when-to-use versus alternatives or when-not guidance, and no routing statement against the other call/sponsor tools in the catalog.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.