mirror of
https://github.com/outline/outline.git
synced 2026-11-26 23:50:14 +03:00
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:
1 parent
0369a20a1c
commit
0150cd0f72
2 files changed
+24
No files matched your search
@@ -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({
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in new issue
Block a user