Skip to content

Commit 86016e9

Browse files
committed
Reject unknown params in t3_thread_read
The MCP server ignored unknown tool arguments and advertised additionalProperties: true, so paging with cursor/position/order was silently dropped and every read started at position 0. Marking the tool strict closes the schema and returns an error for unknown params.
1 parent 98beed1 commit 86016e9

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

‎apps/server/src/mcp/OrchestratorMcpToolkit.integration.test.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,6 +1416,12 @@ describe("orchestrator MCP toolkit", () => {
14161416
expect(threadListTool?.tool.annotations?.idempotentHint).toBe(true);
14171417
const threadReadTool = server.tools.find(({ tool }) => tool.name === "t3_thread_read");
14181418
expect(threadReadTool?.tool.annotations?.readOnlyHint).toBe(false);
1419+
expect(threadReadTool?.tool.inputSchema).toMatchObject({ additionalProperties: false });
1420+
const unknownPagingParamError = yield* invoke("t3_thread_read", {
1421+
threadId: parentThreadId,
1422+
cursor: 90,
1423+
}).pipe(Effect.flip);
1424+
expect(unknownPagingParamError.message).toContain("Expected no excess property");
14191425
const threadUpdateTool = server.tools.find(
14201426
({ tool }) => tool.name === "t3_thread_update",
14211427
);

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ const ThreadReadTool = Tool.make("t3_thread_read", {
200200
dependencies,
201201
})
202202
.annotate(Tool.Title, "Read a T3 thread")
203+
// Strict so a misspelled paging param fails instead of silently reading from position 0.
204+
.annotate(Tool.Strict, true)
203205
.annotate(Tool.Readonly, false)
204206
.annotate(Tool.Destructive, false)
205207
.annotate(Tool.Idempotent, true);

0 commit comments

Comments
 (0)