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 () => {