Skip to main content
Glama

instantiate_contract

Execute a registered contract end-to-end: validate inputs, resolve sources/sinks, run assembly steps, and write results back, returning outputs or structured errors.

Instructions

Execute a registered contract end-to-end. Zod-validates inputs against the contract's inputZodSchema (additionalProperties:false rejects typos). Resolves source/sink overrides per D-A4b default chain (explicit → config → contract literal → error if required); sinks are MemorySink-only per D-A4c (MEM-05 invariant un-bypassable). Runs each assembly step through verbDispatcher with template resolution + named-binding accumulation. write_back routes through DeliveryAdapter.write() (MEM-05 chokepoint). Returns the Q-OUTPUT bundle {steps, write_back} on success OR a structured InstantiateError envelope (12 sealed reasons per ADR-006 §Decision 7). Omit vault on single-vault setups; multi-vault setups require it (returns ambiguous_vault otherwise).

Input Schema

NameRequiredDescriptionDefault
nameYesRegistered contract name
vaultNoVault name; omit on single-vault setups
inputsNoContract inputs; validated against the contract's inputZodSchema
sink_overridesNoOverride declared sink handles by handle name. Targets MUST resolve through MemorySinkRegistry (D-A4c).
source_overridesNoOverride declared source handles by handle name

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.0.0-rc.5

TDQS

A4/5.0
Behavior5/5

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

Annotations only cover safety flags (readOnly=false, openWorld=true, idempotent=false, destructive=false); the description adds substantial non-obvious behavior: Zod validation against the contract schema, the D-A4b override resolution chain, MemorySink-only sinks enforced by the MEM-05 invariant, write_back routed through DeliveryAdapter.write(), and a structured InstantiateError envelope with 12 sealed reasons.

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 core action is front-loaded in the first sentence, but the rest is one dense run-on paragraph laden with internal references (D-A4b, D-A4c, MEM-05, ADR-006 §Decision 7) that an agent without domain context must parse. Much of it earns its place, but the jargon and length dilute scannability.

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?

No output schema exists, and the description compensates by describing the return bundle {steps, write_back} and the failure envelope. It also covers the vault ambiguity error, though it does not enumerate the 12 InstantiateError reasons, leaving a small gap for a complex mutation tool.

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 description coverage is 100%, so the schema already documents all five parameters — baseline 3. The description adds only marginal value beyond the schema (typo rejection via additionalProperties:false, sink override constraints, and the vault ambiguity rule, the latter of which is arguably behavioral rather than parameter semantics).

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?

Opens with a specific verb+resource: 'Execute a registered contract end-to-end.' An agent can distinguish this from describe_contract and register_contracts_as_tools without opening schemas, since this is the execution/run tool rather than a metadata or registration tool.

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?

Gives one concrete usage rule (omit `vault` on single-vault setups; required otherwise, returns `ambiguous_vault`), which is real guidance. But it never states when to use this tool versus siblings like describe_contract or compile_brief, so the run-vs-inspect choice is only implied.

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