Skip to content

Commit a773dc3

Browse files
fix(server): t3_thread_organize rejects unknown arguments instead of archiving the caller (pingdotgg#26718)
Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent f48fb51 commit a773dc3

2 files changed

Lines changed: 43 additions & 0 deletions

File tree

‎apps/server/src/mcp/toolkits/core.test.ts‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,48 @@ it.effect("records only failed calls of tools that hand off no work", () => {
350350
);
351351
});
352352

353+
it.effect("rejects an unknown organize target instead of archiving the calling thread", () => {
354+
const dispatched: Array<unknown> = [];
355+
return Effect.gen(function* () {
356+
const server = yield* McpServer.McpServer;
357+
const outcome = yield* server
358+
.callTool({
359+
name: "t3_thread_organize",
360+
arguments: { action: "archive", threadIds: ["other-thread"] },
361+
})
362+
.pipe(
363+
Effect.provideService(McpInvocationContext.McpInvocationContext, scope),
364+
Effect.provideService(McpSchema.McpServerClient, client),
365+
Effect.result,
366+
);
367+
expect(dispatched).toEqual([]);
368+
expect(outcome).toMatchObject({
369+
_tag: "Failure",
370+
failure: { message: expect.stringContaining("Expected no excess property") },
371+
});
372+
}).pipe(
373+
Effect.provide(
374+
layerThreadToolkit.pipe(
375+
Layer.provideMerge(McpServer.McpServer.layer),
376+
Layer.provide(NodeCrypto.layer),
377+
Layer.provide(
378+
Layer.mock(ThreadManagement.ThreadManagementService)({
379+
getThreadShell: (id) => Effect.succeed(McpToolAccessTestkit.liveThreadShell(id)),
380+
getProjectThreadRecords: ({ threadId: id }) =>
381+
Effect.succeed(
382+
McpToolAccessTestkit.idleThreadProjection(McpToolAccessTestkit.liveThreadShell(id)),
383+
),
384+
dispatch: (command) => {
385+
dispatched.push(command);
386+
return Effect.succeed({ sequence: 1 } as never);
387+
},
388+
}),
389+
),
390+
),
391+
),
392+
);
393+
});
394+
353395
it.effect("keeps unexpected handler defects private through the production registration", () =>
354396
Effect.gen(function* () {
355397
const server = yield* McpServer.McpServer;

‎apps/server/src/mcp/toolkits/thread/tools.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ const ThreadOrganizeTool = Tool.make("t3_thread_organize", {
6161
],
6262
})
6363
.annotate(Tool.Title, "Organize a thread")
64+
.annotate(Tool.Strict, true)
6465
.annotate(Tool.Destructive, true);
6566

6667
const commandTool = {

0 commit comments

Comments
 (0)