From 2fb25a960426c02ad9bd16ae615db8621597cdf5 Mon Sep 17 00:00:00 2001 From: Lucas Winther Date: Mon, 7 Sep 2026 02:51:46 +0200 Subject: [PATCH] fix(wikis): refine projectId schema in searchWikiPagesShape --- src/tools/wikis.ts | 2 +- tests/tools.test.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tools/wikis.ts b/src/tools/wikis.ts index e17b07c..d13a9a8 100644 --- a/src/tools/wikis.ts +++ b/src/tools/wikis.ts @@ -48,7 +48,7 @@ export const searchWikiPagesShape = { .optional() .describe("Substring keyword to match in wiki page title"), projectId: z - .union([z.string(), z.number()]) + .union([z.number().int().positive(), z.string().min(1)]) .optional() .describe("Project ID or identifier to scope search"), limit: z diff --git a/tests/tools.test.ts b/tests/tools.test.ts index f98558b..8c3cebc 100644 --- a/tests/tools.test.ts +++ b/tests/tools.test.ts @@ -1549,6 +1549,9 @@ describe("Wikis Tools", () => { expect(() => schema.parse({ limit: 0 })).toThrow(); expect(() => schema.parse({ limit: -5 })).toThrow(); expect(() => schema.parse({ limit: 150 })).toThrow(); + expect(() => schema.parse({ projectId: "" })).toThrow(); + expect(() => schema.parse({ projectId: 0 })).toThrow(); + expect(() => schema.parse({ projectId: -1 })).toThrow(); }); test("handleSearchWikiPages catches errors and returns error response", async () => {