The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 23:30 UTC
fix(server): tell outside agents which MCP tools need a thread and that t3_thread_list takes allProjects (#26525)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Nov 11, 2026 at 05:46 UTC
d2c25950b4d9183ea342d5d5fc14c326b9e0172a
3 files changed
+32
-7
apps/server/src/mcp/OrchestratorMcpService.test.ts
+9
@@ -3622,6 +3622,15 @@ describe("OrchestratorMcpService thread list", () => {
3622
);
3623
}).pipe(Effect.provide(service)),
3624
);
3625
+
3626
+ it.effect("points a caller outside any thread at allProjects when it omits projectId", () =>
3627
+ Effect.gen(function* () {
3628
+ const mcp = yield* OrchestratorMcpService.OrchestratorMcpService;
3629
+ const error = yield* mcp.listThreads(client, {}).pipe(Effect.flip);
3630
+ assert.equal(error.code, "target_required");
3631
+ assert.include(error.message, "allProjects");
3632
+ }).pipe(Effect.provide(service)),
3633
+ );
3634
});
3635
3636
describe("OrchestratorMcpService thread stop", () => {
apps/server/src/mcp/OrchestratorMcpService.ts
+7
-7
@@ -1142,17 +1142,13 @@ const make = Effect.gen(function* () {
1142
const resolveProjectTarget = (
1143
parent: Pick<OrchestrationV2ThreadProjection, "thread"> | undefined,
1144
projectId: ProjectId | undefined,
1145
+ missingMessage = "Pass projectId: this MCP client is not running inside a T3 thread.",
1146
) =>
1147
projectId !== undefined
1148
? Effect.succeed(projectId)
1149
: parent !== undefined
1150
? Effect.succeed(parent.thread.projectId)
1150
- : Effect.fail(
1151
- failure(
1152
- "target_required",
1153
- "Pass projectId: this MCP client is not running inside a T3 thread.",
1154
- ),
1155
- );
1151
+ : Effect.fail(failure("target_required", missingMessage));
1152
1153
const loadTargetThread = Effect.fn("OrchestratorMcpService.loadTargetThread")(function* (
1154
threadId: ThreadId,
@@ -2964,7 +2960,11 @@ const make = Effect.gen(function* () {
2960
const { parent } = yield* loadCaller(scope, []);
2961
const projectId = input.allProjects
2962
? null
2967
- : yield* resolveProjectTarget(parent, input.projectId);
2963
+ : yield* resolveProjectTarget(
2964
+ parent,
2965
+ input.projectId,
2966
+ "Pass projectId, or allProjects: true for every project. This MCP client is not running inside a T3 thread.",
2967
+ );
2968
const projectThreads = yield* threadManagement
2969
.listProjectThreads({
2970
projectId: projectId ?? undefined,
docs/user/outside-agents.md
+16
@@ -80,6 +80,22 @@ policy. Approving without a code starts at **Read only**:
80
threads in every project. A thread it starts or steers cannot run with more
81
permissions than the mode you chose.
82
83
+## What outside agents can call
84
+
85
+Some tools only work for an agent running inside a T3 thread, because they act
86
+as that thread: subagents, secret requests, rendered HTML, the browser preview,
87
+devices, and worktree handoff. They still appear in an outside agent's tool
88
+list, but calling one returns an error saying it needs an agent running inside
89
+T3 Code.
90
+
91
+- To hand off work, start a thread with `t3_thread_launch`, then follow it with
92
+ `t3_thread_wait` or `t3_thread_read`, instead of `create_threads` or
93
+ `delegate_task`.
94
+- Tools that default to the caller's own project or thread need an explicit
95
+ `projectId` or `threadId`.
96
+- To list threads across projects, call `t3_thread_list` with
97
+ `allProjects: true`, or use `t3_thread_search`.
98
+
99
## Claude Code
100
101
```sh