Skip to content

Commit 3b5e459

Browse files
t3dotggclaude
andcommitted
test(server): check t3_thread_read limits in descriptions now that sizes clamp
Clamping removes maximum from the tool schema, so the description is the only place a model sees each page size limit. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 155a88b commit 3b5e459

1 file changed

Lines changed: 7 additions & 18 deletions

File tree

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

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,14 @@ import { Tool } from "effect/ai";
33

44
import { OrchestratorToolkit } from "./tools.ts";
55

6-
interface PropertySchema {
7-
readonly maximum?: number;
8-
readonly description?: string;
9-
readonly anyOf?: ReadonlyArray<PropertySchema>;
10-
}
11-
12-
// Codex shows models a TypeScript view of each tool that drops minimum, maximum and any
13-
// description inside anyOf, so an enforced bound must be stated on the property itself.
14-
it("states t3_thread_read numeric bounds in the parameter descriptions", () => {
6+
// Oversized page sizes clamp on decode, so the schema has no `maximum`; Codex also drops
7+
// bounds from its TypeScript view. The description is the only place a model sees a limit.
8+
it("states t3_thread_read page size limits in the parameter descriptions", () => {
159
const schema = Tool.getJsonSchema(OrchestratorToolkit.tools.t3_thread_read) as {
16-
readonly properties: Readonly<Record<string, PropertySchema>>;
10+
readonly properties: Readonly<Record<string, { readonly description?: string }>>;
1711
};
18-
const bounded = Object.entries(schema.properties).flatMap(([name, property]) =>
19-
[property, ...(property.anyOf ?? [])]
20-
.filter((member) => member.maximum !== undefined && member.maximum < Number.MAX_SAFE_INTEGER)
21-
.map((member) => [name, property.description, member.maximum] as const),
22-
);
23-
expect(bounded.map(([name]) => name)).toEqual(["limit", "runLimit", "maxCharsPerItem"]);
24-
for (const [name, description, maximum] of bounded) {
25-
expect(description, name).toContain(String(maximum));
12+
const limits = { limit: "100", runLimit: "50", maxCharsPerItem: "50000" };
13+
for (const [name, maximum] of Object.entries(limits)) {
14+
expect(schema.properties[name]?.description, name).toContain(maximum);
2615
}
2716
});

0 commit comments

Comments
 (0)