> ## Documentation Index
> Fetch the complete documentation index at: https://docs.enagrams.com/llms.txt
> Use this file to discover all available pages before exploring further.

# publish

> Register or update a shared interface contract

## Overview

`publish` records a contract — an API response shape, a type definition, a function signature, or any interface that other agents depend on. Other agents see the contract in their next `sync` and get notified on changes.

Publishing a contract is how you tell the rest of the team "this is the shape I'm about to implement, please target it."

## Parameters

| Parameter     | Type   | Required | Description                                                         |
| ------------- | ------ | -------- | ------------------------------------------------------------------- |
| `name`        | string | Yes      | Contract name (e.g. `GET /api/scrape response`, `UserProfile type`) |
| `schema`      | string | Yes      | Contract definition as a JSON string                                |
| `description` | string | No       | Human-readable description                                          |

## Example

```json theme={null}
{
  "tool": "publish",
  "arguments": {
    "name": "GET /api/users/:id response",
    "schema": "{\"id\":\"string\",\"email\":\"string\",\"role\":\"'admin'|'member'\",\"createdAt\":\"string (ISO)\"}",
    "description": "Returned by the user detail endpoint. Role is a string literal, not enum."
  }
}
```

## When to Call `publish`

* Before implementing a new API endpoint — agree the shape first
* When adding a shared type other services will consume
* When changing an existing contract (re-publish with the same `name`)

Re-publishing the same `name` replaces the prior contract and surfaces a change notification in every agent's next `sync`.
