@introspection-ai/recipes 0.48.0 → 0.50.0
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/api/mcp.d.ts +1 -0
- package/dist/api/mcp.d.ts.map +1 -1
- package/dist/api/mcp.js +1 -0
- package/dist/api/mcp.js.map +1 -1
- package/dist/channels/tools.d.ts.map +1 -1
- package/dist/channels/tools.js +2 -17
- package/dist/channels/tools.js.map +1 -1
- package/dist/command-parameters.d.ts +10 -0
- package/dist/command-parameters.d.ts.map +1 -0
- package/dist/command-parameters.js +25 -0
- package/dist/command-parameters.js.map +1 -0
- package/dist/connector-tools.d.ts +1 -1
- package/dist/connector-tools.d.ts.map +1 -1
- package/dist/connector-tools.js +12 -1
- package/dist/connector-tools.js.map +1 -1
- package/dist/documents/module.js +1 -1
- package/dist/documents/module.js.map +1 -1
- package/dist/documents/profile.d.ts +1 -1
- package/dist/documents/profile.js +1 -1
- package/dist/extensions.d.ts +1 -1
- package/dist/extensions.d.ts.map +1 -1
- package/dist/extensions.js +23 -2
- package/dist/extensions.js.map +1 -1
- package/dist/introspection-open.d.ts +46 -0
- package/dist/introspection-open.d.ts.map +1 -0
- package/dist/introspection-open.js +278 -0
- package/dist/introspection-open.js.map +1 -0
- package/dist/mcp/index.d.ts +37 -0
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +14 -4
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/pi-client.d.ts +97 -0
- package/dist/mcp/pi-client.d.ts.map +1 -0
- package/dist/mcp/pi-client.js +342 -0
- package/dist/mcp/pi-client.js.map +1 -0
- package/dist/mcp/policy.d.ts +2 -0
- package/dist/mcp/policy.d.ts.map +1 -1
- package/dist/mcp/policy.js +6 -0
- package/dist/mcp/policy.js.map +1 -1
- package/dist/mcp-chunks/{chunk-3M4OCQR5.js → chunk-PO2SOBEN.js} +1 -0
- package/dist/mcp-daemon.js +1 -1
- package/dist/mcp-run-worker.js +1 -1
- package/dist/open.d.ts +82 -0
- package/dist/open.d.ts.map +1 -0
- package/dist/open.js +152 -0
- package/dist/open.js.map +1 -0
- package/dist/pi-extension.d.ts.map +1 -1
- package/dist/pi-extension.js +99 -8
- package/dist/pi-extension.js.map +1 -1
- package/dist/productivity/content.d.ts +25 -0
- package/dist/productivity/content.d.ts.map +1 -0
- package/dist/productivity/content.js +94 -0
- package/dist/productivity/content.js.map +1 -0
- package/dist/productivity/handles.d.ts +72 -0
- package/dist/productivity/handles.d.ts.map +1 -0
- package/dist/productivity/handles.js +111 -0
- package/dist/productivity/handles.js.map +1 -0
- package/dist/productivity/http.d.ts +35 -0
- package/dist/productivity/http.d.ts.map +1 -0
- package/dist/productivity/http.js +216 -0
- package/dist/productivity/http.js.map +1 -0
- package/dist/productivity/index.d.ts +11 -0
- package/dist/productivity/index.d.ts.map +1 -0
- package/dist/productivity/index.js +7 -0
- package/dist/productivity/index.js.map +1 -0
- package/dist/productivity/module.d.ts +63 -0
- package/dist/productivity/module.d.ts.map +1 -0
- package/dist/productivity/module.js +121 -0
- package/dist/productivity/module.js.map +1 -0
- package/dist/productivity/paging.d.ts +32 -0
- package/dist/productivity/paging.d.ts.map +1 -0
- package/dist/productivity/paging.js +42 -0
- package/dist/productivity/paging.js.map +1 -0
- package/dist/productivity/tools.d.ts +40 -0
- package/dist/productivity/tools.d.ts.map +1 -0
- package/dist/productivity/tools.js +969 -0
- package/dist/productivity/tools.js.map +1 -0
- package/dist/productivity/types.d.ts +538 -0
- package/dist/productivity/types.d.ts.map +1 -0
- package/dist/productivity/types.js +119 -0
- package/dist/productivity/types.js.map +1 -0
- package/dist/recipe/agent.d.ts +6 -1
- package/dist/recipe/agent.d.ts.map +1 -1
- package/dist/recipe/agent.js +48 -7
- package/dist/recipe/agent.js.map +1 -1
- package/dist/recipe/companions.d.ts.map +1 -1
- package/dist/recipe/companions.js +5 -4
- package/dist/recipe/companions.js.map +1 -1
- package/dist/recipe/manifest.generated.d.ts +3 -1
- package/dist/recipe/manifest.generated.d.ts.map +1 -1
- package/dist/recipe/manifest.generated.js +4 -2
- package/dist/recipe/manifest.generated.js.map +1 -1
- package/dist/recipe/package.d.ts +12 -0
- package/dist/recipe/package.d.ts.map +1 -1
- package/dist/recipe/package.js +93 -0
- package/dist/recipe/package.js.map +1 -1
- package/dist/review.d.ts +1 -0
- package/dist/review.d.ts.map +1 -1
- package/dist/review.js +1 -0
- package/dist/review.js.map +1 -1
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +175 -15
- package/dist/session.js.map +1 -1
- package/dist/skill-progress.d.ts.map +1 -1
- package/dist/skill-progress.js +5 -1
- package/dist/skill-progress.js.map +1 -1
- package/dist/tool-search.d.ts +2 -2
- package/dist/tool-search.d.ts.map +1 -1
- package/dist/tool-search.js +4 -2
- package/dist/tool-search.js.map +1 -1
- package/docs/{index.md → README.md} +9 -3
- package/docs/{slack.md → channels/slack.md} +1 -1
- package/docs/{documents.md → documents/README.md} +4 -4
- package/docs/interactions.md +90 -31
- package/docs/mcp-configuration.md +76 -2
- package/docs/productivity/README.md +360 -0
- package/docs/productivity/google.md +226 -0
- package/docs/productivity/microsoft.md +143 -0
- package/docs/recipe-format.md +40 -16
- package/docs/recipe-judges.md +8 -4
- package/package.json +14 -8
- package/skills/README.md +12 -0
- package/skills/productivity/SKILL.md +76 -0
- /package/docs/{channels.md → channels/README.md} +0 -0
- /package/{documents → skills/documents}/SKILL.md +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Slack channel connector
|
|
2
2
|
|
|
3
3
|
`@introspection-ai/recipe-channel-slack` is the Slack adapter for the
|
|
4
|
-
[channel tools](
|
|
4
|
+
[channel tools](README.md). It supplies Slack Web API transport and a
|
|
5
5
|
capability descriptor. The `channels` tool and its command schemas are
|
|
6
6
|
provider-neutral, so a Recipe written against it is not written against Slack.
|
|
7
7
|
|
|
@@ -6,7 +6,7 @@ discriminator, shaped identically for every format. Each format is a package
|
|
|
6
6
|
that supplies the mechanics and a capability descriptor; the commands, their
|
|
7
7
|
schemas and the rules about where files may be written live in the host.
|
|
8
8
|
|
|
9
|
-
Two properties follow, as for [channels](channels.md):
|
|
9
|
+
Two properties follow, as for [channels](../channels/README.md):
|
|
10
10
|
|
|
11
11
|
- **A command a format cannot support is absent for that format, not
|
|
12
12
|
failing.** Each format package declares what it supports, and the tool
|
|
@@ -342,7 +342,7 @@ The Word and PDF helpers are small Python programs. Each format package
|
|
|
342
342
|
declares its own `pi.runtime.python` environment, locked by the package's
|
|
343
343
|
`python/uv.lock`: paper-docx for Word, pypdfium2 and pillow for PDF. The host
|
|
344
344
|
prepares that environment for the installed package, as it does every
|
|
345
|
-
package's (see [Runtime requirements](recipe-format.md#runtime-requirements)),
|
|
345
|
+
package's (see [Runtime requirements](../recipe-format.md#runtime-requirements)),
|
|
346
346
|
and passes its interpreter to the adapter. A Recipe declaring `pi.documents`
|
|
347
347
|
declares and locks none of these packages itself; its own
|
|
348
348
|
`pi.runtime.python`, if any, stays its shell environment. The helpers use
|
|
@@ -350,7 +350,7 @@ declares and locks none of these packages itself; its own
|
|
|
350
350
|
interpreter the host passes, then `VIRTUAL_ENV`, then `python3`. An extension
|
|
351
351
|
that needs one of these interpreters itself reads it with
|
|
352
352
|
`packagePython("@introspection-ai/recipe-documents-docx")` on its session
|
|
353
|
-
context (see [Package declarations](recipe-format.md#package-declarations)). Package
|
|
353
|
+
context (see [Package declarations](../recipe-format.md#package-declarations)). Package
|
|
354
354
|
environments are synced without extras, so PDF `tables: true` needs
|
|
355
355
|
pdfplumber from an environment synced with `--extra tables` and named by
|
|
356
356
|
`RECIPE_DOCUMENTS_PYTHON`.
|
|
@@ -398,7 +398,7 @@ the same object, for a format that depends on Recipes anyway.
|
|
|
398
398
|
|
|
399
399
|
`createAdapter` also receives `python`: the interpreter of the environment the
|
|
400
400
|
format package's own `pi.runtime.python` declares, which the host prepares
|
|
401
|
-
(see [Runtime requirements](recipe-format.md#runtime-requirements)). It is
|
|
401
|
+
(see [Runtime requirements](../recipe-format.md#runtime-requirements)). It is
|
|
402
402
|
absent when the package declares none; an adapter that ignores it keeps
|
|
403
403
|
working.
|
|
404
404
|
|
package/docs/interactions.md
CHANGED
|
@@ -21,7 +21,7 @@ that agent; agents that do not list it never see it.
|
|
|
21
21
|
```yaml
|
|
22
22
|
name: agent
|
|
23
23
|
ai:
|
|
24
|
-
model: <provider>/<model>
|
|
24
|
+
model: <provider>/<model> # one Pi has credentials for: pi --list-models
|
|
25
25
|
tools: [read, bash, ask_user_question]
|
|
26
26
|
```
|
|
27
27
|
|
|
@@ -51,12 +51,12 @@ approvals, and prefer the tool over asking in plain text).
|
|
|
51
51
|
|
|
52
52
|
How each host renders it:
|
|
53
53
|
|
|
54
|
-
| Host
|
|
55
|
-
|
|
|
56
|
-
| Pi terminal (TUI) and RPC
|
|
57
|
-
| Pause/resume host (`PI_INTERRUPT_RESUME`)
|
|
58
|
-
| Headless (`PI_ASK_USER_AUTO_APPROVE`) and child agents | Nothing is shown; every question declines.
|
|
59
|
-
| No channel
|
|
54
|
+
| Host | Rendering | Result the model sees |
|
|
55
|
+
| ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
56
|
+
| Pi terminal (TUI) and RPC | One dialog per question, in order. Options are numbered (numbers the model put in labels are stripped), with descriptions after the label, and a last option, `Something else — I'll type it`, opens a text input. `multiSelect` uses the toggle list in the TUI and a toggle-then-`Done` selector over RPC. | One line per question, `<header>: <answer>` (several answers joined with `, `), and `details.questions` / `details.answers` with each answer. |
|
|
57
|
+
| Pause/resume host (`PI_INTERRUPT_RESUME`) | The tool returns the `details.interrupt` request from `askUserQuestion()` with bare option labels and their descriptions, `metadata.header` and `metadata.question`; the host renders its own option list and free-text answer. | The host's resume envelope, for example `Answer: Email link`. |
|
|
58
|
+
| Headless (`PI_ASK_USER_AUTO_APPROVE`) and child agents | Nothing is shown; every question declines. | `<header>: (no answer)` per question, then an instruction to proceed with best judgment. |
|
|
59
|
+
| No channel | Nothing is shown. | The unavailable envelope, telling the model to ask in its reply. |
|
|
60
60
|
|
|
61
61
|
The built-in tool reads `PI_INTERRUPT_RESUME` and `PI_ASK_USER_AUTO_APPROVE`
|
|
62
62
|
from the session's environment, the `env` passed to `createAgentSession()` or
|
|
@@ -79,6 +79,64 @@ host's tool as the only way to ask. Write, for example: "Ask with the host's
|
|
|
79
79
|
question tool (`ask_user_question` here, `AskUserQuestion` in Claude Code);
|
|
80
80
|
otherwise ask with numbered options in text."
|
|
81
81
|
|
|
82
|
+
## The built-in `introspection_open` tool
|
|
83
|
+
|
|
84
|
+
List `introspection_open` in an agent's `tools` and the agent can ask the
|
|
85
|
+
person to open an Introspection page and, with `wait: true`, continue with
|
|
86
|
+
what they did. The agent names a target, never a URL; each host builds its own
|
|
87
|
+
link.
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
introspection_open({
|
|
91
|
+
target:
|
|
92
|
+
| { kind: "integration"; provider: string } // github, slack: project admin installs it
|
|
93
|
+
| { kind: "connector"; provider: string } // an admin adds the project's OAuth client
|
|
94
|
+
| { kind: "connection"; provider: string } // the person's own account
|
|
95
|
+
| { kind: "sso"; provider: string } // google, entra: an org admin sets up sign-in
|
|
96
|
+
| { kind: "binding"; runtime: string; name: string; environment?: string }
|
|
97
|
+
| { kind: "runtime"; runtime: string }
|
|
98
|
+
| { kind: "task"; task: string }
|
|
99
|
+
| { kind: "repository"; provider: "github"; name: string; template?: string },
|
|
100
|
+
reason: string, // one line the card shows
|
|
101
|
+
wait?: boolean, // default false
|
|
102
|
+
})
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
With `wait: true` it is an interaction like the others: `reason` is
|
|
106
|
+
`input_required`, the interrupt carries no `options`, and its metadata is
|
|
107
|
+
`{ kind: "introspection_open", target, action }` (`action` is the button
|
|
108
|
+
label, e.g. `Install GitHub`). A host with no renderer for this kind still
|
|
109
|
+
shows a plain question, which stays usable. The answers use the existing
|
|
110
|
+
envelopes:
|
|
111
|
+
|
|
112
|
+
| Outcome | Resume | The model sees |
|
|
113
|
+
| ----------------------------------------- | ---------------------------------------------------------------- | ------------------------- |
|
|
114
|
+
| Connected | `{ status: "resolved", payload: { answer: "connected" } }` | `Answer: connected` |
|
|
115
|
+
| Came back from a `runtime` or `task` page | `{ status: "resolved", payload: { answer: "returned" } }` | `Answer: returned` |
|
|
116
|
+
| The provider failed | `{ status: "resolved", payload: { answer: "failed: <error>" } }` | `Answer: failed: <error>` |
|
|
117
|
+
| Not now | `{ status: "cancelled" }` | the declined envelope |
|
|
118
|
+
| Reply in chat | `{ status: "cancelled", payload: { dismissed: true } }` | the dismissed text |
|
|
119
|
+
|
|
120
|
+
The answer is what the person did, not proof: the agent reads the real state
|
|
121
|
+
before it says something is connected.
|
|
122
|
+
|
|
123
|
+
| Host | With `wait: true` |
|
|
124
|
+
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
125
|
+
| Pi terminal (TUI) and RPC | Runs the Introspection CLI (`INTROSPECTION_CLI`, else `introspection` on `PATH`) until it returns: `connectors authorize <provider> --subject user` for a `connection`, `open --integrations <provider> --wait` for an `integration`, `open --runtime <runtime> --wait` for a `binding` or `runtime`, `open --task <task> --wait` for a `task`, `open --repository --name <name> [--template <owner/repo>] --wait` for a `repository`. Exit 0 answers `connected` (`returned` for a page); another exit answers `failed:` with the CLI's last error line. A `connector` or `sso` target, or a missing CLI, shows a Done / Not now dialog instead. The wait lasts up to an hour. |
|
|
126
|
+
| Pause/resume host | The interrupt above; the host renders it and resumes with the answer. |
|
|
127
|
+
| Headless and child agents | Declined. |
|
|
128
|
+
| No channel | The unavailable envelope. |
|
|
129
|
+
|
|
130
|
+
Without `wait`, nothing pauses: Pi's terminal opens a `runtime`, `task` or
|
|
131
|
+
`binding` page, or starts an `integration` install, through the CLI, and the
|
|
132
|
+
result says the person has not acted yet; elsewhere the result tells the model
|
|
133
|
+
to ask in its reply.
|
|
134
|
+
|
|
135
|
+
The target helpers (`parseIntrospectionOpenTarget`,
|
|
136
|
+
`introspectionOpenTargetOf`, `introspectionOpenAction`,
|
|
137
|
+
`INTROSPECTION_OPEN_ANSWER`) are exported from
|
|
138
|
+
`@introspection-ai/recipes/review`, which a browser can import.
|
|
139
|
+
|
|
82
140
|
## Writing your own interaction tool
|
|
83
141
|
|
|
84
142
|
```ts
|
|
@@ -106,7 +164,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
106
164
|
options: params.options,
|
|
107
165
|
selection: params.multiple ? "multiple" : "single",
|
|
108
166
|
},
|
|
109
|
-
{ toolCallId, ctx, signal }
|
|
167
|
+
{ toolCallId, ctx, signal },
|
|
110
168
|
);
|
|
111
169
|
},
|
|
112
170
|
});
|
|
@@ -151,16 +209,16 @@ A host that supports pause/resume treats
|
|
|
151
209
|
`details.interrupt.outcome.type === "awaiting_user"` as a pause request.
|
|
152
210
|
Hosts generate their own pause state from this record.
|
|
153
211
|
|
|
154
|
-
| Field
|
|
155
|
-
|
|
|
156
|
-
| `reason`
|
|
157
|
-
| `message`
|
|
158
|
-
| `options`
|
|
159
|
-
| `selection` | Optional answer cardinality: `single` (default) or `multiple`
|
|
160
|
-
| `metadata`
|
|
161
|
-
| `display`
|
|
162
|
-
| `expiresAt` | Optional ISO-8601 instant after which the host may auto-decline
|
|
163
|
-
| `outcome`
|
|
212
|
+
| Field | Meaning |
|
|
213
|
+
| ----------- | --------------------------------------------------------------------------- |
|
|
214
|
+
| `reason` | Open string; well-known: `input_required`, `confirmation`, `tool_call` |
|
|
215
|
+
| `message` | Concise human-readable prompt |
|
|
216
|
+
| `options` | Optional structured answer suggestions: `{ label, value?, description? }[]` |
|
|
217
|
+
| `selection` | Optional answer cardinality: `single` (default) or `multiple` |
|
|
218
|
+
| `metadata` | Renderer or tool hints (`kind`, `header`, source tool parameters, …) |
|
|
219
|
+
| `display` | Optional structured display copy for richer local or remote UI |
|
|
220
|
+
| `expiresAt` | Optional ISO-8601 instant after which the host may auto-decline |
|
|
221
|
+
| `outcome` | Local result, or `{ type: "awaiting_user" }` when the host must pause |
|
|
164
222
|
|
|
165
223
|
Question options are suggestions, not a closed enum. Local Pi shows them in a
|
|
166
224
|
selector plus an `Other` input path. Multi-select TUI questions use Space or
|
|
@@ -239,10 +297,11 @@ await askUserApproval(
|
|
|
239
297
|
},
|
|
240
298
|
],
|
|
241
299
|
metadata: {
|
|
242
|
-
proposal:
|
|
300
|
+
proposal:
|
|
301
|
+
"Target senior product leaders in Sydney with B2B SaaS or marketplace experience.",
|
|
243
302
|
},
|
|
244
303
|
},
|
|
245
|
-
{ toolCallId, ctx, signal }
|
|
304
|
+
{ toolCallId, ctx, signal },
|
|
246
305
|
);
|
|
247
306
|
```
|
|
248
307
|
|
|
@@ -259,16 +318,16 @@ host must synthesize identical text for the same outcome,
|
|
|
259
318
|
so Recipe tools cannot tell where the answer came from. Do not reword these
|
|
260
319
|
without a coordinated protocol change across all hosts.
|
|
261
320
|
|
|
262
|
-
| Outcome
|
|
263
|
-
|
|
|
264
|
-
| Answered
|
|
265
|
-
| Multiple answers
|
|
266
|
-
| Approved
|
|
267
|
-
| Approved with feedback
|
|
268
|
-
| Revision requested
|
|
269
|
-
| Revision requested with feedback | `Revision requested. Feedback: <feedback>`
|
|
270
|
-
| Declined
|
|
271
|
-
| Pending host resume
|
|
321
|
+
| Outcome | Envelope |
|
|
322
|
+
| -------------------------------- | ----------------------------------------------------------- |
|
|
323
|
+
| Answered | `Answer: <answer>` |
|
|
324
|
+
| Multiple answers | `Answers: ["<answer>","<answer>"]` |
|
|
325
|
+
| Approved | `Approved.` |
|
|
326
|
+
| Approved with feedback | `Approved. Feedback: <feedback>` |
|
|
327
|
+
| Revision requested | `Revision requested.` |
|
|
328
|
+
| Revision requested with feedback | `Revision requested. Feedback: <feedback>` |
|
|
329
|
+
| Declined | `User declined to answer. Proceed with your best judgment.` |
|
|
330
|
+
| Pending host resume | `Awaiting user response.` |
|
|
272
331
|
|
|
273
332
|
Declines are **not** tool errors — the model is expected to proceed with its
|
|
274
333
|
best judgment.
|
|
@@ -283,7 +342,7 @@ best judgment.
|
|
|
283
342
|
- **Never format envelopes yourself.** Return the helper result as-is; envelope
|
|
284
343
|
authorship must not split across layers.
|
|
285
344
|
- **Thread the tool's `signal`** into the helper and check for aborts after any
|
|
286
|
-
custom dialog (`undefined` from a dialog means dismissal
|
|
345
|
+
custom dialog (`undefined` from a dialog means dismissal _or_ abort — only
|
|
287
346
|
the signal distinguishes them).
|
|
288
347
|
- **Custom UIs are enhancements.** A richer TUI walk goes through the
|
|
289
348
|
`interactive` option; remote hosts can adapt `metadata` and `display`.
|
|
@@ -48,8 +48,9 @@ including tools a server may add later; patterns such as `search_*` are invalid.
|
|
|
48
48
|
`"required": true` must resolve to a bound endpoint at session materialization
|
|
49
49
|
or the session fails closed rather than starting without the capability.
|
|
50
50
|
|
|
51
|
-
In `mode: tools`, a required server must also be
|
|
52
|
-
|
|
51
|
+
In `mode: tools` and `mode: codemode`, a required server must also be
|
|
52
|
+
discovered when the session starts: `codemode` waits up to
|
|
53
|
+
`PI_RECIPES_MCP_CONNECT_TIMEOUT_MS` (default 30 seconds) for it to connect. A session skips that check for a server only when both of these hold:
|
|
53
54
|
|
|
54
55
|
- the server's declaration sets `"discovery": "defer"` (default `"require"`),
|
|
55
56
|
so the Recipe chooses which servers may be skipped and an unmarked one is
|
|
@@ -115,12 +116,74 @@ change in the session, so loaded tools survive resume. It never grants access
|
|
|
115
116
|
beyond the Recipe manifest and agent policy. Recipes also registers `mcp_search` as a
|
|
116
117
|
compatibility alias when MCP tools are deferred.
|
|
117
118
|
|
|
119
|
+
`mode: codemode` runs the agent's MCP servers on Pi's own MCP support, inside
|
|
120
|
+
the Pi process, with no `mcp` command and no daemon. The model sees a `codemode`
|
|
121
|
+
tool, and its scripts call each authorized tool as
|
|
122
|
+
`tools.mcp__<server>__<tool>(args)`, finding tools with `searchTools()` and
|
|
123
|
+
getting the whole MCP result back. `eager` tools are also declared to the model
|
|
124
|
+
directly:
|
|
125
|
+
|
|
126
|
+
```yaml
|
|
127
|
+
mcp:
|
|
128
|
+
mode: codemode
|
|
129
|
+
servers:
|
|
130
|
+
contacts:
|
|
131
|
+
include: ["*"]
|
|
132
|
+
eager:
|
|
133
|
+
- search_contacts
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Tools outside the authorized set cannot be called, from a script or otherwise.
|
|
137
|
+
`defer` is invalid in codemode, since every tool but the `eager` ones is already
|
|
138
|
+
off the model's declarations.
|
|
139
|
+
|
|
118
140
|
`defer` and `eager` are invalid in CLI mode. An omitted agent `mcp` block
|
|
119
141
|
inherits its base policy. Once a child declares `mcp`, the complete block
|
|
120
142
|
replaces the inherited policy; restate its mode, servers, authorization, and
|
|
121
143
|
activation selectors. This makes external capability changes reviewable at the
|
|
122
144
|
derived agent. Every resolved agent owns its mode independently.
|
|
123
145
|
|
|
146
|
+
### Keep a server behind a tool
|
|
147
|
+
|
|
148
|
+
A server can sit behind one of the agent's own tools, so the model sees that
|
|
149
|
+
one stable tool and the Recipe can change or compare the providers behind it.
|
|
150
|
+
The productivity tools (`mail`, `calendar`, `drive`) work this way:
|
|
151
|
+
|
|
152
|
+
```yaml
|
|
153
|
+
tools: [mail]
|
|
154
|
+
mcp:
|
|
155
|
+
mode: cli
|
|
156
|
+
servers:
|
|
157
|
+
gmail:
|
|
158
|
+
include: ["*"]
|
|
159
|
+
behind: [mail]
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
`behind` lists the tools allowed to call the server: each must be in the
|
|
163
|
+
agent's `tools`, and the list is never empty. Its tools are reachable only from
|
|
164
|
+
inside a call of one of those tools, through `ctx.executeTool(mcpToolName(server,
|
|
165
|
+
tool), args)`, and a call from inside a codemode script the tool runs counts.
|
|
166
|
+
Recipes refuses every other call before it reaches the server: one the model
|
|
167
|
+
makes, one from a codemode script, and one from any other tool, each with a
|
|
168
|
+
result that names the tool to call instead.
|
|
169
|
+
|
|
170
|
+
Whatever the agent's mode, such a server runs on Pi's own MCP client, as in
|
|
171
|
+
codemode, and stays out of the `mcp` command and the tools-mode daemon. The
|
|
172
|
+
model is not told about it: its tools are not declared, codemode does not list
|
|
173
|
+
them, `tool_search` does not find them, and Pi's list of MCP servers in the
|
|
174
|
+
system prompt leaves it out. `required` and discovery behave as in codemode: a
|
|
175
|
+
required server must connect before the first turn, and a call through the
|
|
176
|
+
front tool waits for one still connecting. `defer` and `eager` are invalid
|
|
177
|
+
with `behind`.
|
|
178
|
+
|
|
179
|
+
What Pi cannot hide: a codemode script can still see the tools' names through
|
|
180
|
+
`searchTools()`, `describeTool()` and `ALL_TOOLS`, though calling one is
|
|
181
|
+
refused. The record of the front tool's nested calls (`nestedCalls` on its
|
|
182
|
+
result) stays in the session file and is never sent to the model. The guard
|
|
183
|
+
holds calls inside the Pi process; it is no network boundary, so a sandbox
|
|
184
|
+
that must not reach the server's endpoint at all needs that enforced by the
|
|
185
|
+
host's egress and credential rules.
|
|
186
|
+
|
|
124
187
|
## 3. Supply endpoint configuration
|
|
125
188
|
|
|
126
189
|
A referenced MCP manifest can carry a portable configured endpoint and catalog.
|
|
@@ -198,6 +261,17 @@ own registered tool catalog and active set. The MCP daemon and mcporter config
|
|
|
198
261
|
remain private to those wrappers; shell tools do not receive an `mcp` command,
|
|
199
262
|
`MCPORTER_CONFIG`, or MCP session path.
|
|
200
263
|
|
|
264
|
+
In codemode, Pi's MCP support connects each server in the background when the
|
|
265
|
+
session starts and keeps no state outside the session: no `mcp.json` is read
|
|
266
|
+
and no OAuth credential is stored. A Recipe extension calls an MCP tool with
|
|
267
|
+
`ctx.executeTool(mcpToolName(server, tool), args)`, `mcpToolName` coming from
|
|
268
|
+
`@introspection-ai/recipes/mcp`. Each Recipe extension tool waits for servers
|
|
269
|
+
still connecting before it runs; a tool that calls no MCP tool can declare
|
|
270
|
+
`reachesTools: () => []` to skip the wait, or name the servers it reaches
|
|
271
|
+
(`() => ["mcp__contacts"]`). Every call, a script's nested ones included, passes
|
|
272
|
+
through Pi's `tool_call` and `tool_result` hooks. A binding that authenticates
|
|
273
|
+
with an OAuth flow is not supported in codemode; bind it with a header.
|
|
274
|
+
|
|
201
275
|
Pi receives each tool's MCP input schema. If the server declares
|
|
202
276
|
`outputSchema`, Recipes retains and validates it locally against successful
|
|
203
277
|
`structuredContent`; providers do not currently receive it as a tool
|