fix: Reject personalOwnerId without publish in the MCP update tool

Matches the REST validation instead of silently dropping the parameter.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Tom MoorandClaude Fable 5 committed 2026-08-17 12:12:56 -04:00
1 parent 0369a20a1c
commit 0150cd0f72
2 files changed
+24

No files matched your search

+19
View File
@@ -1047,6 +1047,25 @@ describe("update_document - personal", () => {
expect(membership).not.toBeNull();
});
it("rejects personalOwnerId without publish", async () => {
const { user, accessToken } = await buildOAuthUser();
const document = await buildDraftDocument({
teamId: user.teamId,
userId: user.id,
});
const res = await callMcpTool(server, accessToken, "update_document", {
id: document.id,
title: "Updated",
personalOwnerId: "me",
});
expect(res?.result?.isError).toBe(true);
const reloaded = await Document.unscoped().findByPk(document.id);
expect(reloaded!.personalOwnerId).toBeNull();
expect(reloaded!.publishedAt).toBeNull();
});
it("rejects personalOwnerId on an already published document", async () => {
const { user, accessToken } = await buildOAuthUser();
const collection = await buildCollection({
+5
View File
@@ -713,6 +713,11 @@ export function documentTools(server: McpServer, scopes: string[]) {
);
assertDocumentLocation({ ...input, personalOwnerId });
if (personalOwnerId && !input.publish) {
throw ValidationError(
"publish is required when personalOwnerId is set"
);
}
let destination;