Skip to main content
Glama

contract_publish

Publish an interface contract before implementation, including paths that will consume it. Republishing creates a new version and notifies consumers; use expected_version to prevent overwrites.

Instructions

Publish the shape of an interface (an endpoint, function, type, event or CLI) before either side implements it, with the paths that will consume it. Publishing an existing name creates a new version and sends its consumers a change notice by itself, so do not also call notice_publish. Omitting consumers on a republish keeps the list, and expected_version refuses the write with conflict if another agent published first. To read contracts use contract_get or contract_list.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kindYesOne of `http`, `function`, `type`, `event`, `cli`, `other`.
nameYesUnique contract name, for example `POST /api/sessions` or `State::claim`.
agentYesYour stable agent name.
notesNoFree-text notes stored with this version.
shapeYesThe interface shape as JSON: signatures, request and response types, errors.
consumersNoPaths expected to depend on this contract.
expected_versionNoRefuse unless the contract is at this version now (0 = absent).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
statusYesok. conflict: expected_version was set and the contract is at another version. invalid: bad input.
messageNoHuman-readable detail, on most outcomes other than ok.
contractNoid, name, kind, consumers, current (version, shape, notes, published_by, published_at), history.
notice_idNoThe change notice emitted to consumers of a republished contract.
published_byNoOn conflict: who published that version.
current_versionNoOn conflict: the version the contract is at.
previous_versionNoThe version this one replaced; absent or null on a first publish.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed9 schema fields changedv1.1.2
    • addedInput schema / properties / agent / description
      Added value: +"Your stable agent name."
    • addedInput schema / properties / consumers / description
      Added value: +"Paths expected to depend on this contract."
    • addedInput schema / properties / expected_version / description
      Added value: +"Refuse unless the contract is at this version now (0 = absent)."
    • addedInput schema / properties / kind / description
      Added value: +"One of `http`, `function`, `type`, `event`, `cli`, `other`."
    • addedInput schema / properties / kind / enum
      Added value: +[
      +  "http",
      +  "function",
      +  "type",
      +  "event",
      +  "cli",
      +  "other"
      +]
    • addedInput schema / properties / name / description
      Added value: +"Unique contract name, for example `POST /api/sessions` or `State::claim`."
    • addedInput schema / properties / notes / description
      Added value: +"Free-text notes stored with this version."
    • addedInput schema / properties / shape / description
      Added value: +"The interface shape as JSON: signatures, request and response types, errors."
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "description": "Any result may also carry lost, inbox, inbox_more and persist_error; see guide.",
      +  "properties": {
      +    "contract": {
      +      "description": "id, name, kind, consumers, current (version, shape, notes, published_by, published_at), history.",
      +      "type": "object"
      +    },
      +    "current_version": {
      +      "description": "On conflict: the version the contract is at.",
      +      "type": "integer"
      +    },
      +    "message": {
      +      "description": "Human-readable detail, on most outcomes other than ok.",
      +      "type": "string"
      +    },
      +    "notice_id": {
      +      "description": "The change notice emitted to consumers of a republished contract."
      +    },
      +    "previous_version": {
      +      "description": "The version this one replaced; absent or null on a first publish."
      +    },
      +    "published_by": {
      +      "description": "On conflict: who published that version."
      +    },
      +    "status": {
      +      "description": "ok. conflict: expected_version was set and the contract is at another version. invalid: bad input.",
      +      "enum": [
      +        "ok",
      +        "conflict",
      +        "not_found",
      +        "none",
      +        "invalid",
      +        "cancelled"
      +      ],
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "status"
      +  ],
      +  "type": "object"
      +}
  2. First observedv1.1.1

TDQS

A4.9/5.0
Behavior5/5

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

Annotations only provide destructiveHint=false, so the description carries the burden and does well: it discloses that republishing an existing name creates a new version, automatically sends change notices to consumers, preserves the consumer list when omitted, and refuses writes via expected_version on concurrent publication.

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?

Three dense sentences with no filler. The primary action is front-loaded, and each clause adds a distinct behavioral or usage fact: side effects, caller exclusions, preservation semantics, concurrency guard, and read alternatives.

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 7-parameter publish tool with an output schema, the description covers the key agent-facing concerns: side effects, duplicate-notice prevention, concurrency conflict, optional consumer behavior, and where to read contracts. Nothing essential for correct invocation is missing.

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 is 3. The description adds real value beyond the schema by explaining the semantics of consumers ('omitting keeps the list') and expected_version ('refuses the write with conflict if another agent published first'), elevating it above a mere schema restatement.

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 states a specific verb and resource: publish the shape of an interface (endpoint, function, type, event, CLI) before implementation, with consumer paths. It clearly differentiates from siblings by naming contract_get, contract_list, and notice_publish as distinct tools.

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?

It gives explicit when-to-use context ('before either side implements it'), explicitly warns not to also call notice_publish, and directs read operations to contract_get or contract_list. It also explains republish and conflict semantics, so an agent knows exactly when to use this tool and when not to.

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