Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/review/src/review-api/agent-client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@ it("serves MCP framing without stdout diagnostics and returns host errors as too
});
const list = await request(2, "tools/list", {});
ListToolsResultSchema.parse(list.result);
// The Anthropic API rejects these at the top level of a tool input schema.
expect(
list.result.tools.filter((tool: AuthoringTool) =>
["anyOf", "oneOf", "allOf"].some((key) => key in tool.inputSchema),
),
).toEqual([]);
expect(
list.result.tools.find(
(tool: AuthoringTool) => tool.name === "session_edit",
Expand Down
17 changes: 15 additions & 2 deletions packages/review/src/review-api/authoring-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@ export function authoringTools(
const review = { reviewId: id };
const version = z.number().int().nonnegative().optional();

// Anthropic rejects a top-level union, so publish one object; the host validates the union.
const [image, trace, map] = uploadSchema.options;

const uploadInput = z
.strictObject({
...image.shape,
...trace.shape,
...map.shape,
kind: z.enum(["image", "trace", "map"]),
})
.partial()
.required({ id: true, repositoryId: true, kind: true });

const read = (name: keyof typeof readQuerySchemas) =>
z.strictObject({ ...review, ...readQuerySchemas[name].shape });

Expand Down Expand Up @@ -162,8 +175,8 @@ export function authoringTools(
),
tool(
"upload",
"Retain an image, trace or software map for use in a review. Reusing an upload ID requires identical content; rejected uploads are not saved.",
uploadSchema,
'Retain an image, trace or software map for use in a review. kind:"image" takes base64; kind:"trace" takes trace; kind:"map" takes pins, side and model. Reusing an upload ID requires identical content; rejected uploads are not saved.',
uploadInput,
"POST",
"/resources",
),
Expand Down
Loading