pi-subagents 0.5.3 → 0.6.1
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/CHANGELOG.md +5 -1
- package/README.md +24 -1
- package/agents.ts +16 -2
- package/execution.ts +9 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## [
|
|
3
|
+
## [0.6.0] - 2026-02-02
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- **MCP direct tools for subagents** - Agents can request specific MCP tools as first-class tools via `mcp:` prefix in frontmatter: `tools: read, bash, mcp:chrome-devtools` or `tools: read, bash, mcp:github/search_repositories`. Requires pi-mcp-adapter.
|
|
7
|
+
- **`MCP_DIRECT_TOOLS` env var** - Subagent processes receive their direct tool config via environment variable. Agents without `mcp:` items get a `__none__` sentinel to prevent config leaking from the parent process.
|
|
4
8
|
|
|
5
9
|
## [0.5.3] - 2026-02-01
|
|
6
10
|
|
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ Use `agentScope` parameter to control discovery: `"user"` (default), `"project"`
|
|
|
39
39
|
---
|
|
40
40
|
name: scout
|
|
41
41
|
description: Fast codebase recon
|
|
42
|
-
tools: read, grep, find, ls, bash
|
|
42
|
+
tools: read, grep, find, ls, bash, mcp:chrome-devtools
|
|
43
43
|
model: claude-haiku-4-5
|
|
44
44
|
skill: safe-bash, chrome-devtools # comma-separated skills to inject
|
|
45
45
|
output: context.md # writes to {chain_dir}/context.md
|
|
@@ -51,6 +51,29 @@ interactive: true # (parsed but not enforced in v1)
|
|
|
51
51
|
Your system prompt goes here (the markdown body after frontmatter).
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
+
**MCP Tools**
|
|
55
|
+
|
|
56
|
+
Agents can use MCP server tools directly (requires the [pi-mcp-adapter](https://github.com/nicobailon/pi-mcp-adapter) extension). Add `mcp:` prefixed entries to the `tools` field:
|
|
57
|
+
|
|
58
|
+
```yaml
|
|
59
|
+
# All tools from a server
|
|
60
|
+
tools: read, bash, mcp:chrome-devtools
|
|
61
|
+
|
|
62
|
+
# Specific tools from a server
|
|
63
|
+
tools: read, bash, mcp:github/search_repositories, mcp:github/get_file_contents
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
| Syntax | Effect |
|
|
67
|
+
|--------|--------|
|
|
68
|
+
| `mcp:server-name` | All tools from that MCP server |
|
|
69
|
+
| `mcp:server-name/tool_name` | One specific tool |
|
|
70
|
+
|
|
71
|
+
The `mcp:` items are additive — they don't affect which builtins the agent gets. `tools: mcp:chrome-devtools` (with no regular tools listed) gives the agent all default builtins plus chrome-devtools tools. To restrict builtins, list them explicitly: `tools: read, bash, mcp:chrome-devtools`.
|
|
72
|
+
|
|
73
|
+
Subagents only get direct MCP tools when `mcp:` items are explicitly listed. Even if your `mcp.json` has `directTools: true` globally, a subagent without `mcp:` in its frontmatter won't get any direct tools — keeping it lean. The `mcp` proxy tool is still available for discovery if needed.
|
|
74
|
+
|
|
75
|
+
The MCP adapter's metadata cache must be populated for direct tools to work. On the first session with a new MCP server, tools will only be available through the `mcp` proxy. Restart Pi after the first session and direct tools become available.
|
|
76
|
+
|
|
54
77
|
**Resolution priority:** step override > agent frontmatter > disabled
|
|
55
78
|
|
|
56
79
|
## Features (beyond base)
|
package/agents.ts
CHANGED
|
@@ -12,6 +12,7 @@ export interface AgentConfig {
|
|
|
12
12
|
name: string;
|
|
13
13
|
description: string;
|
|
14
14
|
tools?: string[];
|
|
15
|
+
mcpDirectTools?: string[];
|
|
15
16
|
model?: string;
|
|
16
17
|
systemPrompt: string;
|
|
17
18
|
source: "user" | "project";
|
|
@@ -91,11 +92,23 @@ function loadAgentsFromDir(dir: string, source: "user" | "project"): AgentConfig
|
|
|
91
92
|
continue;
|
|
92
93
|
}
|
|
93
94
|
|
|
94
|
-
const
|
|
95
|
+
const rawTools = frontmatter.tools
|
|
95
96
|
?.split(",")
|
|
96
97
|
.map((t) => t.trim())
|
|
97
98
|
.filter(Boolean);
|
|
98
99
|
|
|
100
|
+
const mcpDirectTools: string[] = [];
|
|
101
|
+
const tools: string[] = [];
|
|
102
|
+
if (rawTools) {
|
|
103
|
+
for (const tool of rawTools) {
|
|
104
|
+
if (tool.startsWith("mcp:")) {
|
|
105
|
+
mcpDirectTools.push(tool.slice(4));
|
|
106
|
+
} else {
|
|
107
|
+
tools.push(tool);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
99
112
|
// Parse defaultReads as comma-separated list (like tools)
|
|
100
113
|
const defaultReads = frontmatter.defaultReads
|
|
101
114
|
?.split(",")
|
|
@@ -111,7 +124,8 @@ function loadAgentsFromDir(dir: string, source: "user" | "project"): AgentConfig
|
|
|
111
124
|
agents.push({
|
|
112
125
|
name: frontmatter.name,
|
|
113
126
|
description: frontmatter.description,
|
|
114
|
-
tools: tools
|
|
127
|
+
tools: tools.length > 0 ? tools : undefined,
|
|
128
|
+
mcpDirectTools: mcpDirectTools.length > 0 ? mcpDirectTools : undefined,
|
|
115
129
|
model: frontmatter.model,
|
|
116
130
|
systemPrompt: body,
|
|
117
131
|
source,
|
package/execution.ts
CHANGED
|
@@ -144,8 +144,16 @@ export async function runSync(
|
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
+
const spawnEnv = { ...process.env };
|
|
148
|
+
const mcpDirect = agent.mcpDirectTools;
|
|
149
|
+
if (mcpDirect?.length) {
|
|
150
|
+
spawnEnv.MCP_DIRECT_TOOLS = mcpDirect.join(",");
|
|
151
|
+
} else {
|
|
152
|
+
spawnEnv.MCP_DIRECT_TOOLS = "__none__";
|
|
153
|
+
}
|
|
154
|
+
|
|
147
155
|
const exitCode = await new Promise<number>((resolve) => {
|
|
148
|
-
const proc = spawn("pi", args, { cwd: cwd ?? runtimeCwd, stdio: ["ignore", "pipe", "pipe"] });
|
|
156
|
+
const proc = spawn("pi", args, { cwd: cwd ?? runtimeCwd, env: spawnEnv, stdio: ["ignore", "pipe", "pipe"] });
|
|
149
157
|
let buf = "";
|
|
150
158
|
|
|
151
159
|
// Throttled update mechanism - consolidates all updates
|
package/package.json
CHANGED