@zenera/cli 1.3.3 → 1.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ask.d.ts +5 -5
- package/dist/ask.js +56 -18
- package/dist/catalog.d.ts +1 -1
- package/dist/catalog.js +11 -5
- package/dist/commands/init.js +8 -9
- package/dist/commands/inspect.js +12 -5
- package/dist/commands/key.js +2 -2
- package/dist/commands/models.js +9 -6
- package/dist/liveness.js +3 -2
- package/dist/modelref.d.ts +11 -6
- package/dist/modelref.js +23 -23
- package/dist/scaffold.js +4 -7
- package/dist/trace.js +1 -0
- package/dist/validate.js +31 -5
- package/package.json +6 -6
- package/templates/editor/.github/copilot-instructions.md +44 -14
- package/templates/editor/.github/skills/add-mcp/SKILL.md +40 -0
- package/templates/editor/.github/skills/zen-cli/references/keys.md +1 -1
- package/templates/editor/.github/skills/zen-cli/references/models.md +8 -8
- package/templates/editor/.github/skills/zen-cli/references/rag.md +1 -1
- package/templates/editor/.github/skills/zen-mcp/SKILL.md +139 -0
- package/templates/editor/.github/skills/zen-mcp/references/discovery.md +119 -0
- package/templates/editor/.github/skills/zen-mcp/references/install.md +148 -0
- package/templates/editor/.github/skills/zen-mcp/references/memory-cache.md +71 -0
- package/templates/editor/.github/skills/zen-mcp/references/runtime-skill.md +95 -0
- package/templates/editor/.github/skills/zen-memory/SKILL.md +2 -2
- package/templates/editor/.github/skills/zen-memory-warmup/SKILL.md +3 -3
- package/templates/editor/.github/skills/zen-rag-docs/SKILL.md +6 -6
- package/templates/editor/.github/skills/zen-rag-schema/SKILL.md +5 -5
- package/templates/parts/memory-terms.yaml.tmpl +1 -1
- package/templates/parts/models.yaml.tmpl +1 -1
- package/templates/project/scripts/_setup.sh +1 -1
|
@@ -49,6 +49,7 @@ the editor skill for each one - `zen-memory` for a `memory:` block,
|
|
|
49
49
|
`zen-sandbox` for sandbox configuration or shell tools, `zen-rag-schema` or
|
|
50
50
|
`zen-rag-docs` for an index, `zen-code-python` for an agent that writes or runs
|
|
51
51
|
code, `zen-topology` for `handoffs:` or `fork:` on any agent,
|
|
52
|
+
`zen-mcp` for `mcp:*` or any `mcp_*` tool on any agent,
|
|
52
53
|
`zen-sandbox-capacity` before any `zen run batch`
|
|
53
54
|
(except under `zen-finetune`, which sets its own concurrency),
|
|
54
55
|
`zen-cli` always. A capability that is already
|
|
@@ -553,7 +554,7 @@ providers:
|
|
|
553
554
|
apiKey: ${ACME_OPENAI_KEY}
|
|
554
555
|
|
|
555
556
|
embeddings:
|
|
556
|
-
small: openai
|
|
557
|
+
small: openai/text-embedding-3-small # a shorthand string...
|
|
557
558
|
large: # ...or the object form
|
|
558
559
|
provider: house
|
|
559
560
|
model: text-embedding-3-large
|
|
@@ -575,7 +576,7 @@ embedding: small
|
|
|
575
576
|
Four things differ from `models:` and are worth knowing before you write one:
|
|
576
577
|
|
|
577
578
|
- **No `api:` field.** `/v1/responses` has no embeddings endpoint, so naming an
|
|
578
|
-
api means nothing on any protocol. The shorthand is `
|
|
579
|
+
api means nothing on any protocol. The shorthand is `provider/model`.
|
|
579
580
|
- **`kind: anthropic` has no embeddings API at all.** Anthropic publishes none
|
|
580
581
|
and points at third parties; an `embeddings:` entry on an Anthropic provider
|
|
581
582
|
fails at load. Use another provider - the connection need not be the one the
|
|
@@ -851,6 +852,11 @@ Three rules follow:
|
|
|
851
852
|
Skills can own tools too - `tools:` in a skill's frontmatter (§3.4) names tools
|
|
852
853
|
that refuse to run until that skill is active.
|
|
853
854
|
|
|
855
|
+
A project running in Zenera also has `mcp:*` - external services such as GitHub
|
|
856
|
+
or Linear, called as the signed-in user. Those tools work only in the app's
|
|
857
|
+
chats and Test tab, and they need a runtime skill installed in `agents/skills`.
|
|
858
|
+
Load `zen-mcp` before granting or reviewing them.
|
|
859
|
+
|
|
854
860
|
### 3.6 The file tools (`files:*`, alias `workspace:*`)
|
|
855
861
|
|
|
856
862
|
`zen run` builds this set for you, rooted at the session's workspace directory.
|
|
@@ -1559,13 +1565,20 @@ agents:
|
|
|
1559
1565
|
### 7.3 Shorthand
|
|
1560
1566
|
|
|
1561
1567
|
```
|
|
1562
|
-
|
|
1568
|
+
provider/id
|
|
1563
1569
|
```
|
|
1564
1570
|
|
|
1565
|
-
`
|
|
1571
|
+
`openai/gpt-5-mini` · `vertex/gemini-3.5-flash` · `vertex/anthropic/claude-opus-5` ·
|
|
1572
|
+
`openrouter/anthropic/claude-sonnet-4.5`
|
|
1573
|
+
|
|
1574
|
+
The first segment is a provider _name_ - a built-in kind or a `providers:`
|
|
1575
|
+
entry - and everything after the first slash is the id exactly as that provider
|
|
1576
|
+
spells it, slashes and colons included. It is also how a Bifrost gateway names a
|
|
1577
|
+
model, so the ref written here is the one the gateway logs.
|
|
1566
1578
|
|
|
1567
|
-
|
|
1568
|
-
`openai
|
|
1579
|
+
On Vertex a model from another publisher keeps its publisher:
|
|
1580
|
+
`vertex/anthropic/claude-opus-5`, `vertex/openai/gpt-oss-120b-maas`. Google's own
|
|
1581
|
+
models need none.
|
|
1569
1582
|
|
|
1570
1583
|
**Always write the prefix.** The first segment is a provider _name_, not a vendor
|
|
1571
1584
|
hint - nothing reads `gemini-3.5-flash` and infers Google. An unprefixed id goes
|
|
@@ -1574,10 +1587,26 @@ otherwise, so a bare `gemini-3.5-flash` asks OpenAI for a Google model and fails
|
|
|
1574
1587
|
with `OPENAI_API_KEY is not set`. The message names the provider it resolved to;
|
|
1575
1588
|
read it as "the prefix is missing", not "the key is missing".
|
|
1576
1589
|
|
|
1590
|
+
Two older spellings are still read, and `zen validate` names the ref to write
|
|
1591
|
+
instead:
|
|
1592
|
+
|
|
1593
|
+
- `provider[/api]:id` - `openai:gpt-4o`, `openai/responses:o3`. Still the only
|
|
1594
|
+
shorthand that names an api, and the way to write an id the slash form would
|
|
1595
|
+
misread: a fine-tuned `openai:ft:gpt-4o:acme::a1b2`.
|
|
1596
|
+
- a bare id, which goes to the default provider - see below.
|
|
1597
|
+
|
|
1598
|
+
One ref reads two ways. On a default provider whose own ids contain slashes -
|
|
1599
|
+
OpenRouter, Vertex, `openai-compatible`, anything with a base url of its own -
|
|
1600
|
+
`anthropic/claude-sonnet-4.5` is that provider's id, as it always was, not a
|
|
1601
|
+
model of Anthropic's. `zen validate` warns, and asks for
|
|
1602
|
+
`openrouter/anthropic/claude-sonnet-4.5` so the next reader cannot take it the
|
|
1603
|
+
other way. To reach Anthropic itself from such a project, write
|
|
1604
|
+
`anthropic:claude-sonnet-4.5`: the colon form is never read two ways.
|
|
1605
|
+
|
|
1577
1606
|
Anything the shorthand cannot express (keys, base urls, `api:`, reasoning knobs)
|
|
1578
1607
|
needs the object form. The object form does **not** re-parse a shorthand: its
|
|
1579
1608
|
`model:` is the bare id and the provider goes in `provider:` beside it. Writing
|
|
1580
|
-
`model: openai
|
|
1609
|
+
`model: openai/gpt-5.4-mini` there sends that whole string to the API.
|
|
1581
1610
|
|
|
1582
1611
|
Resolution order for any `model:` value: `zen run --model` → this file's
|
|
1583
1612
|
`models:` → the shorthand parser. Two agents naming `balanced` share one model
|
|
@@ -1623,20 +1652,20 @@ entry is only worth writing when it adds something:
|
|
|
1623
1652
|
```yaml
|
|
1624
1653
|
agents:
|
|
1625
1654
|
- name: triage
|
|
1626
|
-
model: openrouter
|
|
1655
|
+
model: openrouter/anthropic/claude-sonnet-4.5
|
|
1627
1656
|
```
|
|
1628
1657
|
|
|
1629
1658
|
**Model ids** are `vendor/model` and may carry a variant suffix after a colon -
|
|
1630
1659
|
`:free`, `:nitro` (throughput-routed), `:floor` (price-routed), `:online` (web
|
|
1631
|
-
search). Both survive the shorthand, because only the _first_
|
|
1660
|
+
search). Both survive the shorthand, because only the _first_ slash separates:
|
|
1632
1661
|
|
|
1633
1662
|
| Ref | Provider | Model |
|
|
1634
1663
|
| -------------------------------- | ------------ | --------------------- |
|
|
1635
|
-
| `openrouter
|
|
1636
|
-
| `openrouter
|
|
1664
|
+
| `openrouter/openai/gpt-5.4-nano` | `openrouter` | `openai/gpt-5.4-nano` |
|
|
1665
|
+
| `openrouter/z-ai/glm-5.2:free` | `openrouter` | `z-ai/glm-5.2:free` |
|
|
1637
1666
|
|
|
1638
|
-
The `vendor/`
|
|
1639
|
-
first
|
|
1667
|
+
The `vendor/` after `openrouter/` is part of the _id_, not a provider name: what
|
|
1668
|
+
precedes the first slash is the provider, and nothing after it is read as one.
|
|
1640
1669
|
|
|
1641
1670
|
**No api to choose.** This kind speaks one protocol, its own, so `api: responses`
|
|
1642
1671
|
and `openrouter/responses:…` are both a load error ("has one api, so … means
|
|
@@ -1796,7 +1825,7 @@ up (§7.8).
|
|
|
1796
1825
|
|
|
1797
1826
|
- **A model id with no provider prefix** - `gemini-3.5-flash` resolves to the
|
|
1798
1827
|
default provider, not to Google, and the failure reads as a missing OpenAI key.
|
|
1799
|
-
Write `google
|
|
1828
|
+
Write `google/gemini-3.5-flash` - §7.3.
|
|
1800
1829
|
- **OpenAI reasoning without `api: responses`** - chat completions rejects
|
|
1801
1830
|
`reasoningEffort` alongside function tools with a `400`, and exposes no
|
|
1802
1831
|
reasoning summary even without tools - §7.6.
|
|
@@ -2027,6 +2056,7 @@ candidates; these are the judgements to make about each one)**
|
|
|
2027
2056
|
| Answers from stale knowledge of the world | Grant `web_search` + `web_read`, and say when - §3.8 |
|
|
2028
2057
|
| Cites a page it only saw the excerpt of | A prompt line: `web_read` before quoting - §3.8 |
|
|
2029
2058
|
| Every web call refuses | No Exa key: `zen key add exa` - `zen check` warns - §3.8 |
|
|
2059
|
+
| Every MCP call says it is not available | Run it in the app chat or Test tab - zen-mcp |
|
|
2030
2060
|
| A model or embedder refuses every call | `zen models test <ref>` - if `blocked`, `zen models ls` - §8 |
|
|
2031
2061
|
| Answers instead of routing | Router prompt prohibition; check `handoffs:` |
|
|
2032
2062
|
| Routes to the wrong specialist | The target agents' `description:` fields |
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: add-mcp
|
|
3
|
+
description: Give this project's agents external services (GitHub, Linear, Notion, ...) through the MCP tools.
|
|
4
|
+
argument-hint: '[which services, and what the agents should do with them]'
|
|
5
|
+
disable-model-invocation: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Add MCP to this project: grant the `mcp:*` tools, install the runtime skill that
|
|
9
|
+
teaches agents to use them, and add a skill for each recurring job.
|
|
10
|
+
|
|
11
|
+
Load the `zen-mcp` skill first. It holds the rules and the files this command
|
|
12
|
+
copies. If the project has a `memory:` block, also load `zen-memory`. If any
|
|
13
|
+
agent will hand MCP data to code it runs, also load `zen-code-python`.
|
|
14
|
+
|
|
15
|
+
1. **Ask** which servers are enabled for this project in Project settings → MCP
|
|
16
|
+
servers, whether any is limited to some tools, and what jobs the agents
|
|
17
|
+
should do, if I have not already said. The project files cannot answer this.
|
|
18
|
+
2. **Pick the agents** that act on external services. Add `mcp:*` to their
|
|
19
|
+
`tools:` in `agents.yaml` with a short comment saying which services they use,
|
|
20
|
+
and `-mcp_call` for any that must only look
|
|
21
|
+
(`zen-mcp` → `references/install.md` §2).
|
|
22
|
+
3. **Install the runtime skill.** Copy
|
|
23
|
+
`.github/skills/zen-mcp/references/runtime-skill.md` to
|
|
24
|
+
`agents/skills/mcp_tools/SKILL.md`. Fill in its _Servers_ section with the
|
|
25
|
+
confirmed servers, or delete the section. Delete its _Memory_ section if
|
|
26
|
+
there is no `memory:` block. Remove the `<!-- ... -->` editor notes.
|
|
27
|
+
4. **Bind it.** For each agent from step 2, add `mcp_tools` to `skills.allow`
|
|
28
|
+
if the agent has an allow list, and to `preload` if MCP is its main job.
|
|
29
|
+
5. **Add a workflow skill** under `agents/skills/<job>/SKILL.md` for each
|
|
30
|
+
recurring job from step 1: prerequisite first, then server, tool, argument
|
|
31
|
+
shape, what to ask before writing, and what to do when the route is refused
|
|
32
|
+
(`references/install.md` §4). Bind each one like `mcp_tools`.
|
|
33
|
+
6. **Add a prompt line** to each agent from step 2 saying when to reach for the
|
|
34
|
+
services and to load `mcp_tools` first, unless it is preloaded.
|
|
35
|
+
7. Run `zen check`. If it reports `unknown tool "mcp:*"`, this is not a Zenera
|
|
36
|
+
environment. Say so instead of removing the grant.
|
|
37
|
+
8. Tell me to try it in the Test tab: the first request per service shows a
|
|
38
|
+
connect card. A terminal `zen run` cannot call MCP.
|
|
39
|
+
|
|
40
|
+
Report the agents changed, the skills added, and what `zen check` said.
|
|
@@ -66,7 +66,7 @@ zen key mode direct # back to vendor keys
|
|
|
66
66
|
In `bifrost` mode a run exports `BIFROST_API_KEY` and `BIFROST_BASE_URL` and
|
|
67
67
|
**withholds every vendor key**. The runtime then sends every model and every
|
|
68
68
|
embedding through the gateway, each in its own vendor's protocol, and
|
|
69
|
-
`agents.yaml` does not change: `vertex
|
|
69
|
+
`agents.yaml` does not change: `vertex/gemini-3.5-flash` reaches
|
|
70
70
|
`<url>/genai` as `vertex/gemini-3.5-flash`, `anthropic:*` reaches
|
|
71
71
|
`<url>/anthropic`, `openai:*` and `openrouter:*` reach `<url>/openai`.
|
|
72
72
|
Declared providers are rerouted too. `zen check` then reports
|
|
@@ -52,7 +52,7 @@ it was - `--json` carries `source` per model and `origin` per provider.
|
|
|
52
52
|
After `zen key mode bifrost`, every listing is **what the gateway serves**,
|
|
53
53
|
not what the vendors do: one `GET <url>/v1/models`, split by its
|
|
54
54
|
`<upstream>/<id>` names back into refs (`vertex/gemini-3.5-flash` lists as
|
|
55
|
-
`vertex
|
|
55
|
+
`vertex/gemini-3.5-flash`). Upstreams no zen provider names (bedrock, groq, ...)
|
|
56
56
|
are left out, and there is no built-in fallback list. Each command says so on
|
|
57
57
|
stderr with a `⇄ bifrost mode` line, `browse` carries the same badge on every
|
|
58
58
|
screen, and `--json` adds a `gateway` field. `zen models` then does go to the
|
|
@@ -63,8 +63,8 @@ gateway too. The full guide is
|
|
|
63
63
|
## Testing a model
|
|
64
64
|
|
|
65
65
|
```
|
|
66
|
-
zen models test openai
|
|
67
|
-
zen models test vertex
|
|
66
|
+
zen models test openai/gpt-4o-mini
|
|
67
|
+
zen models test vertex/gemini-embedding-001 --embedding
|
|
68
68
|
```
|
|
69
69
|
|
|
70
70
|
The role is taken from the flag, else from what the provider says the model is
|
|
@@ -90,9 +90,9 @@ not parse.
|
|
|
90
90
|
This is what the command is for.
|
|
91
91
|
|
|
92
92
|
```
|
|
93
|
-
$ zen models test vertex
|
|
94
|
-
vertex
|
|
95
|
-
fix vertex
|
|
93
|
+
$ zen models test vertex/gemini-embedding-001
|
|
94
|
+
vertex/gemini-embedding-001 blocked Vertex AI API has not been used in project my-proj …
|
|
95
|
+
fix vertex/gemini-embedding-001 gcloud services enable aiplatform.googleapis.com --project my-proj
|
|
96
96
|
error 1 of 1 did not answer
|
|
97
97
|
see what else there is: zen models ls --embeddings
|
|
98
98
|
```
|
|
@@ -102,8 +102,8 @@ account serves, test the one you want, and put its ref where the old one was.
|
|
|
102
102
|
|
|
103
103
|
```
|
|
104
104
|
$ zen models ls --embeddings
|
|
105
|
-
$ zen models test openai
|
|
106
|
-
openai
|
|
105
|
+
$ zen models test openai/text-embedding-3-small
|
|
106
|
+
openai/text-embedding-3-small answers 412ms 1536 dims
|
|
107
107
|
```
|
|
108
108
|
|
|
109
109
|
Test one model, not the whole list - each test is a billable call.
|
|
@@ -31,7 +31,7 @@ zen rag schema index <spec...> [--embedding <ref>] [-o <dir>] [--batch <n>]
|
|
|
31
31
|
| `--quiet` | - | No narration |
|
|
32
32
|
|
|
33
33
|
```
|
|
34
|
-
zen rag schema index openapi.yaml --embedding openai
|
|
34
|
+
zen rag schema index openapi.yaml --embedding openai/text-embedding-3-small
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
Unlike the gym, `$ref`s are **bundled, not dereferenced**: component names are
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: zen-mcp
|
|
3
|
+
description: 'MCP servers (GitHub, Linear, Notion, ...) in a Zenera project - the `mcp:*` tool group (`mcp_servers`, `mcp_tools`, `mcp_describe`, `mcp_call`) that Zenera provides, where those tools work and where they only refuse, how to grant them in `agents.yaml`, how to install the runtime `mcp_tools` skill and per-workflow skills into `agents/skills`, how an agent discovers, searches and calls a tool, the connect-your-account pause, result limits, and caching tool routes in memory. Load before adding, reviewing or debugging `mcp:*` or any `mcp_*` tool in a project, or a skill or prompt that tells an agent to use an external service through MCP.'
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# MCP tools in a project
|
|
8
|
+
|
|
9
|
+
External services - GitHub, Linear, Notion, Slack, Sentry and the other MCP
|
|
10
|
+
servers an administrator has set up - reach an agent as **four generic tools** in group
|
|
11
|
+
`mcp`. A project does not declare servers, URLs or credentials. It grants the
|
|
12
|
+
group and teaches its agents how to use it.
|
|
13
|
+
|
|
14
|
+
| Tool | Arguments | Returns |
|
|
15
|
+
| -------------- | ----------------------------- | ---------------------------------------------------------------------------------- |
|
|
16
|
+
| `mcp_servers` | none | `{ servers: [{ server, tools }] }`: the servers this run can use, with tool counts |
|
|
17
|
+
| `mcp_tools` | `server` | `{ tools: [{ name, description }] }`: one-line descriptions |
|
|
18
|
+
| `mcp_describe` | `server`, `tool` | `{ name, description, inputSchema }`: full text and JSON schema |
|
|
19
|
+
| `mcp_call` | `server`, `tool`, `arguments` | `{ isError, content, structuredContent? }`, or a connect request |
|
|
20
|
+
|
|
21
|
+
Detail on each reply, the errors and the limits is in
|
|
22
|
+
[references/discovery.md](./references/discovery.md).
|
|
23
|
+
|
|
24
|
+
## 1. Where they come from, and who decides what is in them
|
|
25
|
+
|
|
26
|
+
- **The tools are Zenera's, not the project's.** Every project running in
|
|
27
|
+
Zenera has them. Nothing goes in `agents.yaml` except the grant, and nothing
|
|
28
|
+
goes in `.env`.
|
|
29
|
+
- **Which servers exist** is up to the Zenera administrator. **Which of them this
|
|
30
|
+
project may use**, and optionally which of their tools, is set by a project
|
|
31
|
+
editor in the app under _Project settings → MCP servers_. You cannot see or
|
|
32
|
+
change either from the project files. Ask the user which servers are enabled
|
|
33
|
+
before naming one in a skill, or write the skill so it discovers them
|
|
34
|
+
(`mcp_servers`) instead of assuming.
|
|
35
|
+
- **Each call acts as the signed-in user.** Most servers use per-user OAuth.
|
|
36
|
+
The first call to a server the user has not connected **pauses the run**. The
|
|
37
|
+
chat shows a Connect / Not now card, and the same call resumes with the result
|
|
38
|
+
once the user connects, or fails with an error if they decline. With an older
|
|
39
|
+
host, the result is `{ auth_required: true, connect_url, message }` instead,
|
|
40
|
+
and the agent must give the user the link and stop. An agent never needs
|
|
41
|
+
`current_user` to use MCP: identity travels with the run.
|
|
42
|
+
|
|
43
|
+
## 2. Where they work, and where they only refuse
|
|
44
|
+
|
|
45
|
+
| Run | MCP |
|
|
46
|
+
| ---------------------------------------------------- | -------------------------------------------------------------------------- |
|
|
47
|
+
| A chat in the Zenera app; the editor's Test tab | Works, as the signed-in user |
|
|
48
|
+
| `zen run`, `zen meta`, batches, datasets, gym, a job | Tools are present; every call returns _"MCP is not available in this run"_ |
|
|
49
|
+
| Code in the sandbox (`run_command`, a skill script) | Never: the sandbox has no access to the services |
|
|
50
|
+
|
|
51
|
+
Consequences you must design for:
|
|
52
|
+
|
|
53
|
+
- **You cannot exercise MCP from the terminal.** Check behaviour in the Test
|
|
54
|
+
tab. A dataset case or rubric that depends on an MCP result fails for
|
|
55
|
+
reasons unrelated to the change you are testing.
|
|
56
|
+
- **A script cannot fetch from a service.** The agent calls `mcp_call`, then
|
|
57
|
+
writes what it needs into `/workspace` with the file tools, and the script
|
|
58
|
+
reads it from there.
|
|
59
|
+
- **Outside Zenera, `mcp:*` does not exist.** There, `zen check` and `zen run`
|
|
60
|
+
fail with `unknown tool "mcp:*"`. That is the environment, not the project:
|
|
61
|
+
do not remove the grant. Check the project in Zenera instead.
|
|
62
|
+
|
|
63
|
+
## 3. Obligations `zen check` does not report
|
|
64
|
+
|
|
65
|
+
A project that grants `mcp:*` is not finished until all of these hold:
|
|
66
|
+
|
|
67
|
+
1. **Grant the group only to the agents that act on external services.** Use
|
|
68
|
+
`tools: [mcp:*, ...]`. Grant the group, not a hand-picked subset, because the
|
|
69
|
+
four tools are one procedure and an agent missing `mcp_describe` guesses
|
|
70
|
+
arguments. A router or a summariser does not get it.
|
|
71
|
+
2. **Install the runtime skill.** Copy
|
|
72
|
+
[references/runtime-skill.md](./references/runtime-skill.md) to
|
|
73
|
+
`agents/skills/mcp_tools/SKILL.md` unchanged in substance. It is the only
|
|
74
|
+
thing that teaches a running agent the discover → describe → call order,
|
|
75
|
+
how to search, how to handle the connect pause and truncation, and the memory
|
|
76
|
+
rules. Bind it to every agent holding `mcp:*`: add it to `skills.allow`, and
|
|
77
|
+
to `preload` when MCP is that agent's main job. How to do this:
|
|
78
|
+
[references/install.md](./references/install.md).
|
|
79
|
+
3. **One project skill per recurring workflow** that names the server, the tool
|
|
80
|
+
route and the argument shape, for example `agents/skills/linear_triage/`.
|
|
81
|
+
Name only servers the user has confirmed are enabled, and tell the agent to
|
|
82
|
+
fall back to discovery when the named tool is refused. See
|
|
83
|
+
[references/install.md §4](./references/install.md#4-workflow-skills).
|
|
84
|
+
4. **A prompt line saying when to reach for it.** For example: _"For anything
|
|
85
|
+
about the user's issues, pull requests or tickets, use the MCP tools - load
|
|
86
|
+
`mcp_tools` first."_ A grant the prompt never mentions is used at the
|
|
87
|
+
model's discretion.
|
|
88
|
+
5. **Memory policy for MCP**, if the project has `memory:`: cache routes, never
|
|
89
|
+
results. See [references/memory-cache.md](./references/memory-cache.md). It
|
|
90
|
+
goes in the `mcp_tools` skill (already there) and, for project-specific
|
|
91
|
+
policy, `agents/memory-policy-instructions.md`.
|
|
92
|
+
6. **No `mcp_*` in a skill's frontmatter `tools:`.** An agent-level grant of the
|
|
93
|
+
same name wins and is never gated, so the line does nothing except mislead
|
|
94
|
+
the next reader. Gate by binding the skill, not the tool.
|
|
95
|
+
7. **No credentials or connect URLs anywhere in the project.** Zenera gives each
|
|
96
|
+
run its access. A connect URL belongs to one user's sign-in and expires.
|
|
97
|
+
|
|
98
|
+
There is no `requires: [mcp]` for house rules. The vocabulary is closed (see
|
|
99
|
+
`zen-instructions`), so MCP guidance lives in the skill, not in
|
|
100
|
+
`agents/*instructions.md`.
|
|
101
|
+
|
|
102
|
+
## 4. Review checklist
|
|
103
|
+
|
|
104
|
+
- [ ] Every agent with `mcp:*` has `mcp_tools` reachable: in `allow`, or the
|
|
105
|
+
catalog is unrestricted. If MCP is its main job, the skill is also in `preload`.
|
|
106
|
+
- [ ] `agents/skills/mcp_tools/SKILL.md` exists and still has the discovery,
|
|
107
|
+
search, connect and memory sections from the runtime template.
|
|
108
|
+
- [ ] Workflow skills name servers the user confirmed. Each says what to do when
|
|
109
|
+
the server or tool is refused, and none hard-codes an id that belongs to
|
|
110
|
+
one user (a team, repo or workspace of theirs).
|
|
111
|
+
- [ ] No prompt, skill or dataset expects MCP to work in `zen run` or a batch.
|
|
112
|
+
- [ ] No sandbox script expected to call a service itself.
|
|
113
|
+
- [ ] With `memory:`, nothing tells the agent to commit tool results, user
|
|
114
|
+
data or whole tool lists.
|
|
115
|
+
- [ ] `zen check` passes in Zenera; behaviour checked in the Test tab.
|
|
116
|
+
|
|
117
|
+
## 5. When it goes wrong
|
|
118
|
+
|
|
119
|
+
| Symptom | Cause and fix |
|
|
120
|
+
| --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
|
|
121
|
+
| `unknown tool "mcp:*"` at load | Not a Zenera environment - §2. Not a project error |
|
|
122
|
+
| Every call: _"MCP is not available in this run"_ | A terminal, batch or job run. Use the chat or Test tab |
|
|
123
|
+
| `<server> is not enabled for this project (enabled: ...)` | Enable it in Project settings → MCP servers, or change the skill to a listed server |
|
|
124
|
+
| `<server>'s tool <tool> is not enabled for this project` | The editor restricted that server's tools. Enable the tool or route around it |
|
|
125
|
+
| Agent guesses arguments, call fails validation | It skipped `mcp_describe`. Check the runtime skill is loaded, or preload it |
|
|
126
|
+
| Result ends with `truncated: true` and a `note` | Over 60,000 characters. Ask for less: filters, fields, smaller pages - discovery.md §5 |
|
|
127
|
+
| Run sits waiting after a call | The user has not connected the service. The card is in the chat; nothing to fix in the project |
|
|
128
|
+
| Agent pastes a link and stops | Older host without pause support: `auth_required` + `connect_url`. Correct behaviour |
|
|
129
|
+
| Agent re-lists every server's tools every turn | The runtime skill's search procedure is missing, or memory routes are not committed |
|
|
130
|
+
| Agent acts on a recalled route that no longer exists | Memory was trusted over the server. The skill must say to re-describe on any refusal - memory-cache.md |
|
|
131
|
+
|
|
132
|
+
## References
|
|
133
|
+
|
|
134
|
+
| File | Read when |
|
|
135
|
+
| ------------------------------------------------------------ | -------------------------------------------------------------------------------- |
|
|
136
|
+
| [references/install.md](./references/install.md) | Adding MCP to a project: `tools:`, skill install and binding, workflow skills |
|
|
137
|
+
| [references/discovery.md](./references/discovery.md) | How a run finds servers and tools, searches, calls, and reads replies and errors |
|
|
138
|
+
| [references/memory-cache.md](./references/memory-cache.md) | The project has `memory:`, or an agent re-discovers the same tools every run |
|
|
139
|
+
| [references/runtime-skill.md](./references/runtime-skill.md) | The text to copy to `agents/skills/mcp_tools/SKILL.md` |
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# How a run finds and calls MCP tools
|
|
2
|
+
|
|
3
|
+
This file describes what a running agent sees, so you can write skills and
|
|
4
|
+
prompts that match it. The agent-facing version of the procedure is
|
|
5
|
+
[runtime-skill.md](./runtime-skill.md).
|
|
6
|
+
|
|
7
|
+
Every call is checked against the project's server selection and made as the
|
|
8
|
+
signed-in user. Nothing about this is configurable from the project.
|
|
9
|
+
|
|
10
|
+
## 1. `mcp_servers` - what this run can use
|
|
11
|
+
|
|
12
|
+
No arguments.
|
|
13
|
+
|
|
14
|
+
```json
|
|
15
|
+
{
|
|
16
|
+
"servers": [
|
|
17
|
+
{ "server": "github", "tools": 41 },
|
|
18
|
+
{ "server": "linear", "tools": 23 }
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The servers enabled for the project, and for each the number of tools the
|
|
24
|
+
project allows. This is the authority: a server not listed is refused by every
|
|
25
|
+
other call. It is cheap. Call it once per run, before naming a server that
|
|
26
|
+
memory or a skill did not supply.
|
|
27
|
+
|
|
28
|
+
## 2. `mcp_tools` - one server's tools
|
|
29
|
+
|
|
30
|
+
`{ "server": "linear" }`
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{ "tools": [{ "name": "list_issues", "description": "List issues in the user's workspace..." }] }
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The name and the **first line** of each description (up to 200 characters). Only
|
|
37
|
+
tools the project allows are listed. The list is kept for the rest of the
|
|
38
|
+
run, so a second call in the same run is cheap. Across runs nothing is kept
|
|
39
|
+
unless memory keeps it.
|
|
40
|
+
|
|
41
|
+
## 3. Searching for a tool
|
|
42
|
+
|
|
43
|
+
There is no search endpoint. Searching is the agent reading `mcp_tools` output,
|
|
44
|
+
so the cost is the size of the listings it pulls into context. The procedure
|
|
45
|
+
that keeps that small:
|
|
46
|
+
|
|
47
|
+
1. **Memory first**, if the project has it. Auto-recall often surfaces a stored
|
|
48
|
+
route before any call. Otherwise use `memory_grep` with the service or verb
|
|
49
|
+
(`linear`, `create_issue`) for an exact hit, or `memory_search` with the
|
|
50
|
+
user's question.
|
|
51
|
+
2. **A workflow skill** that names the tool. If one matches, use its route.
|
|
52
|
+
3. **`mcp_servers`**, then `mcp_tools` **only for the servers whose name fits
|
|
53
|
+
the request**: GitHub for pull requests, Linear for issues. Do not list
|
|
54
|
+
every server.
|
|
55
|
+
4. **Match on verb and object** in the names and one-line descriptions:
|
|
56
|
+
`list_`/`search_`/`get_` to read, `create_`/`update_`/`delete_` to write,
|
|
57
|
+
followed by the object (`issue`, `pull_request`, `page`). Prefer a `search_*`
|
|
58
|
+
tool with a query argument over `list_*` and filtering in the model.
|
|
59
|
+
5. **Describe only the chosen tool**, never every candidate.
|
|
60
|
+
6. If nothing fits after one server's list, try the next plausible server.
|
|
61
|
+
After that, tell the user the enabled servers do not offer it. Do not invent
|
|
62
|
+
a tool name.
|
|
63
|
+
|
|
64
|
+
## 4. `mcp_describe` - read before calling
|
|
65
|
+
|
|
66
|
+
`{ "server": "linear", "tool": "list_issues" }`
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"name": "list_issues",
|
|
71
|
+
"description": "...full text...",
|
|
72
|
+
"inputSchema": { "type": "object", "properties": {}, "required": [] }
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Required before the first call of a tool in a run. The schema is the only source
|
|
77
|
+
for argument names, enums, pagination fields and which fields are required. A
|
|
78
|
+
skill or memory naming an argument shape is a hint, and the schema decides.
|
|
79
|
+
|
|
80
|
+
## 5. `mcp_call` - the call
|
|
81
|
+
|
|
82
|
+
`{ "server": "linear", "tool": "list_issues", "arguments": { "limit": 25 } }`
|
|
83
|
+
|
|
84
|
+
| Reply | Meaning and what the agent does |
|
|
85
|
+
| -------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
|
|
86
|
+
| `{ isError: false, content: [...], structuredContent? }` | Success. Prefer `structuredContent` when present: it is the typed result |
|
|
87
|
+
| `{ isError: true, content: [...] }` | The upstream tool failed: bad argument, not found, permission. Read the text, fix arguments once, then report |
|
|
88
|
+
| `{ ..., truncated: true, note }` | The result exceeded 60,000 characters and was cut. Call again asking for less: a filter, fewer fields, a smaller page size |
|
|
89
|
+
| Run pauses, then the result | The user had not connected the service. They connected from the card, and the call ran |
|
|
90
|
+
| Error after a pause | The user chose _Not now_. Continue without that service and say what is missing |
|
|
91
|
+
| `{ auth_required: true, server, connect_url, message }` | Older host. Give the user `connect_url` as a link, say what it is for, stop. Retry when they say they have connected |
|
|
92
|
+
|
|
93
|
+
**Calls take up to 120 seconds** before they time out. A slow upstream
|
|
94
|
+
looks like a long tool call, not a hang.
|
|
95
|
+
|
|
96
|
+
## 6. Errors
|
|
97
|
+
|
|
98
|
+
These are thrown, and reach the model as an error result:
|
|
99
|
+
|
|
100
|
+
| Message | Means |
|
|
101
|
+
| ---------------------------------------------------------- | ------------------------------------------------------------------------- |
|
|
102
|
+
| `MCP is not available in this run: ...` | Not a chat or Test-tab run. Say MCP is unavailable here; do not retry |
|
|
103
|
+
| `<server> is not enabled for this project (enabled: a, b)` | Use a listed server, or tell the user an editor must enable it |
|
|
104
|
+
| `<server>'s tool <tool> is not enabled for this project` | The server is on, but this tool is excluded. Find another route or say so |
|
|
105
|
+
| `MCP gateway: ...` | The service failed. Retry once, then report |
|
|
106
|
+
| `MCP broker unreachable: ...` | MCP is briefly unavailable. Retry once, then report |
|
|
107
|
+
|
|
108
|
+
A refusal of a server or tool that **memory or a skill named** means the route is
|
|
109
|
+
stale. Re-discover from step 1, and if memory is on, supersede the old route
|
|
110
|
+
(see [memory-cache.md](./memory-cache.md)).
|
|
111
|
+
|
|
112
|
+
## 7. Writes
|
|
113
|
+
|
|
114
|
+
Every allowed tool can be called, whether it reads or writes.
|
|
115
|
+
Whether an agent may change something upstream is decided by the project:
|
|
116
|
+
|
|
117
|
+
- in the prompt or skill (_"ask before creating, editing or deleting anything"_),
|
|
118
|
+
- or by taking `mcp_call` away from agents that must only look (`-mcp_call`),
|
|
119
|
+
- or by the project editor excluding the write tools in Project settings.
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# Installing MCP in a target project
|
|
2
|
+
|
|
3
|
+
Four edits, in this order, followed by `zen check` and a Test-tab run. Every path
|
|
4
|
+
is relative to the project root, the directory with `agents.yaml`.
|
|
5
|
+
|
|
6
|
+
## 1. Find out what is enabled
|
|
7
|
+
|
|
8
|
+
The project files do not say which MCP servers the project may use. That is set
|
|
9
|
+
in the app (_Project settings → MCP servers_), and the editor cannot read it.
|
|
10
|
+
Ask the user:
|
|
11
|
+
|
|
12
|
+
- which servers are enabled (as named there: `github`, `linear`, `notion`, ...),
|
|
13
|
+
- whether any server is limited to some of its tools,
|
|
14
|
+
- which jobs the agents should do with them.
|
|
15
|
+
|
|
16
|
+
If they do not know, install only the generic skill (step 3). It discovers
|
|
17
|
+
servers at run time, so the project works whatever is enabled later.
|
|
18
|
+
|
|
19
|
+
## 2. Grant the tools in `agents.yaml`
|
|
20
|
+
|
|
21
|
+
Add the group to each agent that acts on an external service, and to no other:
|
|
22
|
+
|
|
23
|
+
```yaml
|
|
24
|
+
agents:
|
|
25
|
+
- name: assistant
|
|
26
|
+
tools: [files:*, mcp:*] # mcp: GitHub and Linear as the signed-in user
|
|
27
|
+
skills:
|
|
28
|
+
allow: [mcp_tools, linear_triage, house_style]
|
|
29
|
+
preload: [mcp_tools] # MCP is this agent's main job
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
- **Grant `mcp:*`, not single tools.** `mcp_servers`, `mcp_tools`,
|
|
33
|
+
`mcp_describe` and `mcp_call` are one procedure. `mcp:mcp_call` alone leaves
|
|
34
|
+
the agent guessing arguments.
|
|
35
|
+
- **Take `mcp_call` away for read-only reviewers**: `tools: [mcp:*, -mcp_call]`
|
|
36
|
+
lets an agent see what exists without acting on it. MCP cannot tell a read
|
|
37
|
+
from a write, so this is the only way to keep an agent from changing
|
|
38
|
+
anything upstream.
|
|
39
|
+
- **Handoffs.** A router that only routes does not get `mcp:*`. Hand off to the
|
|
40
|
+
agent that has it, and say so in that agent's `description:`.
|
|
41
|
+
- **`skills:`**. If the agent has an `allow:` list, `mcp_tools` must be in it.
|
|
42
|
+
A `preload` entry must also be in `allow`. Leave `preload` out when the agent
|
|
43
|
+
only sometimes reaches an external service: the index line costs one line,
|
|
44
|
+
and preloading costs the whole skill on every call.
|
|
45
|
+
|
|
46
|
+
## 3. Install the runtime skill
|
|
47
|
+
|
|
48
|
+
Copy the template into the project's catalog. The folder name is the skill name:
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
mkdir -p agents/skills/mcp_tools
|
|
52
|
+
cp .github/skills/zen-mcp/references/runtime-skill.md agents/skills/mcp_tools/SKILL.md
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Then edit **only** what is project-specific in the copy:
|
|
56
|
+
|
|
57
|
+
- The **Servers** section: list the servers the user confirmed, with one line on
|
|
58
|
+
what each is for here. Leave the section out if none were confirmed, so the
|
|
59
|
+
agent discovers them.
|
|
60
|
+
- The **Memory** section: delete it if the project has no `memory:` block,
|
|
61
|
+
since an agent without the memory tools cannot follow it. Keep it otherwise.
|
|
62
|
+
- Remove the two `<!-- ... -->` editor notes.
|
|
63
|
+
- Nothing else. The discovery order, search procedure and connect handling
|
|
64
|
+
describe how the platform behaves, not this project.
|
|
65
|
+
|
|
66
|
+
Why copy and not reference: `.github/` is the editor's tree, and a running agent
|
|
67
|
+
cannot read it. `zen init` and `zen open` also rewrite `.github/`, so the copy in
|
|
68
|
+
`agents/skills/` is the one the project owns. To pick up a newer template later,
|
|
69
|
+
compare the two files and merge by hand.
|
|
70
|
+
|
|
71
|
+
### Skills from somewhere else
|
|
72
|
+
|
|
73
|
+
`skills:` at the top of `agents.yaml` accepts a list, so a team can keep shared
|
|
74
|
+
MCP skills in one directory and use them in several projects:
|
|
75
|
+
|
|
76
|
+
```yaml
|
|
77
|
+
skills:
|
|
78
|
+
- agents/skills
|
|
79
|
+
- ../shared/mcp-skills # mcp_tools, github_review, linear_triage
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
With several directories the catalog is mounted at `/skills/<folder>` per
|
|
83
|
+
directory, not at `/skills`. Check the path a skill writes for its own files
|
|
84
|
+
(§3.4.1 in `copilot-instructions.md`). A directory outside the project is not
|
|
85
|
+
packaged into a release, so copy the skills in before `zen server build`.
|
|
86
|
+
|
|
87
|
+
## 4. Workflow skills
|
|
88
|
+
|
|
89
|
+
A recurring job gets its own skill, so the agent goes straight to the right tool
|
|
90
|
+
instead of discovering it every time. One folder per job:
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
agents/skills/linear_triage/SKILL.md
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
```markdown
|
|
97
|
+
---
|
|
98
|
+
description: Triage the user's open Linear issues - list, group by state and priority, propose next steps.
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
Needs `mcp:*` and the `mcp_tools` skill. Without them, say MCP is not
|
|
102
|
+
available here and stop.
|
|
103
|
+
|
|
104
|
+
1. `mcp_call` server `linear`, tool `list_issues`, arguments
|
|
105
|
+
`{ "assignee": "me", "state": "open", "limit": 50 }`.
|
|
106
|
+
Before the first call in a run, `mcp_describe` it to confirm the arguments.
|
|
107
|
+
2. Group by state, then priority. Do not fetch each issue again: the list has
|
|
108
|
+
what triage needs.
|
|
109
|
+
3. Propose next steps. Change nothing in Linear unless the user asks.
|
|
110
|
+
|
|
111
|
+
If `linear` or `list_issues` is refused as not enabled, tell the user which one
|
|
112
|
+
and that a project editor enables it in Project settings → MCP servers. Do not
|
|
113
|
+
try a different server.
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
The server, tool and arguments above are an illustration. Write the ones the
|
|
117
|
+
user confirmed, and leave argument details to `mcp_describe` when unsure.
|
|
118
|
+
|
|
119
|
+
Rules for these skills:
|
|
120
|
+
|
|
121
|
+
- **State the prerequisite first** (`mcp:*`, `mcp_tools`) and what to do without
|
|
122
|
+
it. The catalog is readable by every agent, including ones not granted the
|
|
123
|
+
skill.
|
|
124
|
+
- **Name the tool and argument shape, but still describe once per run.** Tools
|
|
125
|
+
change upstream, and one `mcp_describe` is cheap insurance.
|
|
126
|
+
- **Writes need consent.** Any step that creates, updates or deletes something
|
|
127
|
+
upstream (a comment, an issue, a merge) asks the user first, unless the user's
|
|
128
|
+
request was itself that write.
|
|
129
|
+
- **No user-specific ids.** A team id, repo or workspace belongs to one user.
|
|
130
|
+
The skill tells the agent how to find it (`list_teams`, or memory), not the
|
|
131
|
+
value itself.
|
|
132
|
+
- **Bind it** in `skills.allow` of the agents that hold `mcp:*`.
|
|
133
|
+
|
|
134
|
+
## 5. Check
|
|
135
|
+
|
|
136
|
+
```sh
|
|
137
|
+
zen check
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
- `unknown tool "mcp:*"` means this is not a Zenera environment. Keep the grant
|
|
141
|
+
and check the project in Zenera.
|
|
142
|
+
- `skills.allow` / `preload` naming something absent means the folder name and
|
|
143
|
+
the binding differ.
|
|
144
|
+
|
|
145
|
+
Then open the editor's **Test tab** and ask for something that needs the server.
|
|
146
|
+
Expect one connect card the first time per service; after that, the answer. A
|
|
147
|
+
`zen run` from the terminal only proves the project loads: every MCP call there
|
|
148
|
+
returns _"MCP is not available in this run"_.
|