# Overlays

> The overlay YAML reference — rename, hide, describe, add examples, pin, shape responses and add composite tools — plus versions, publishing and re-import.

> Pre-release: Neurouter v0.1 is in development; this page documents the v0.1 design.

Source: https://neurouter.com/docs/overlays · Last updated: 2026-11-26

An overlay changes how your API looks to agents without changing the spec. It acts on the **tool model**, so a re-imported spec keeps its curation. Each server has one overlay: a draft you edit (in the console or as a file) and immutable published versions.

## Selectors

Entries under `tools:` select tools by stable keys. They are applied from general to specific (`defaults`, then `"*"`, then `tag:`, then the specific keys, in file order within each class), so a specific entry overrides a bulk one:

| Selector | Example |
|---|---|
| Operation ID | `"operationId:getOrdersV2"` |
| Method and path | `"GET /orders/{id}"` |
| GraphQL field | `"graphql:Mutation.adjustStock"` |
| Tag (bulk) | `"tag:internal"` |
| Everything | `"*"` |

## Example

```yaml
overlay: 1
info: { title: "Acme Orders, curated" }
defaults:
  hidden: true                 # hide everything not explicitly shown
tools:
  "operationId:getOrdersV2":
    name: list_orders
    hidden: false
    pinned: true
    description: |
      List orders, newest first. Filter by status or customer_id.
    args:
      rename: { per_page: limit }
      hide: [expand]
      defaults: { per_page: 30 }
      describe: { status: "One of: open, paid, unpaid, refunded" }
    response:
      include: ["[].id", "[].status", "[].total", "[].customer_id", "[].created_at"]
      maxItems: 50
  "operationId:createRefund":
    name: create_refund
    hidden: false
    risk: { write: true, destructive: false }
    examples:
      - title: Refund 12.50 EUR (amount is in minor units)
        arguments: { order_id: ord_1042, amount: 1250, currency: EUR }
  "operationId:legacyExportOrders":
    hidden: true
  "tag:internal":
    hidden: true
```

The orders example is fictional.

## Tool fields

| Field | Effect |
|---|---|
| `name`, `title`, `description` | What the agent sees |
| `hidden` | Removed from `tools/list`, search and code-mode stubs; calls are refused as unknown |
| `pinned` | Always listed, even when discovery uses search |
| `deprecated` | Marked deprecated |
| `risk` | Override `write`, `destructive` and the other risk flags |
| `tags` | Added tags, usable in [policies](https://neurouter.com/docs/environments#policies) (e.g. `read-sensitive`, `external-write`) |
| `args.rename`, `args.hide`, `args.defaults`, `args.describe`, `args.enum`, `args.required` | Reshape the argument schema; hidden arguments are re-added with their defaults when the request is built |
| `response.include` / `response.exclude`, `flatten`, `maxItems`, `maxBytes`, `redact` | Shape responses (see below) |
| `examples` | Known-good argument sets, returned by `neurouter_get_examples` |
| `graphql.selection` | Replace the generated GraphQL selection set |

Hiding a required argument without a default is an error (`overlay_hides_required_arg`).

## Response shaping

Shaping runs in this order: `include` or `exclude` → `flatten` → `maxItems` → `redact` → `maxBytes`. Paths use a small JSONPath subset: `a.b`, `a[]`, `[].x`, `a[].b[].c` (no filters). When a list is cut or the size cap is exceeded, the agent gets the first page and a handle to read the rest with `neurouter_read_result`. `redact` paths are always replaced by `{"$redacted":"overlay"}`.

## Composite tools and profiles

`composites:` define new tools as short Python scripts that run through [code mode](https://neurouter.com/docs/code-mode); every inner call is still checked by the policy pipeline. `profiles:` name task-shaped subsets of tools; an API key can be limited to one profile.

```yaml
profiles:
  support: { tools: [list_orders, get_order, search_customers] }
```

## Draft, publish and versions

Console edits and file edits produce the same YAML (comments are kept). Publishing creates an immutable version and a build, pinned to `dev` and `qa` by default; `prod` is opt-in. Fix suggestions from evals are applied to the draft, never published silently. Export the YAML at any time to keep it in git.

When a server's `overlay:` is set in `neurouter.yaml`, the overlay is file-managed.
