diff --git a/.changeset/lucky-candles-reply.md b/.changeset/lucky-candles-reply.md new file mode 100644 index 000000000..01db7fd83 --- /dev/null +++ b/.changeset/lucky-candles-reply.md @@ -0,0 +1,5 @@ +--- +"deepagents": patch +--- + +fix: add default value to grep tool glob schema for strict mode compatibility diff --git a/libs/deepagents/src/middleware/fs.test.ts b/libs/deepagents/src/middleware/fs.test.ts index a23ab0a71..3f8af8b4b 100644 --- a/libs/deepagents/src/middleware/fs.test.ts +++ b/libs/deepagents/src/middleware/fs.test.ts @@ -817,6 +817,25 @@ describe("createFilesystemMiddleware", () => { expect(parsed.file_path).toBe("/app/test.c"); expect(parsed.content).toBe(""); }); + + it("all tool schema properties should be included in the required array", () => { + const middleware = createFilesystemMiddleware({ + backend: () => createMockBackend(), + }); + + for (const t of middleware.tools!) { + const jsonSchema = (t as any).schema.toJSONSchema(); + const properties = Object.keys(jsonSchema.properties ?? {}); + const required = jsonSchema.required ?? []; + + for (const prop of properties) { + expect( + required, + `tool "${(t as any).name}" is missing "${prop}" in required`, + ).toContain(prop); + } + } + }); }); describe("tool result truncation integration", () => { diff --git a/libs/deepagents/src/middleware/fs.ts b/libs/deepagents/src/middleware/fs.ts index 5a7e77525..f95626af5 100644 --- a/libs/deepagents/src/middleware/fs.ts +++ b/libs/deepagents/src/middleware/fs.ts @@ -897,6 +897,7 @@ function createGrepTool( .string() .optional() .nullable() + .default(null) .describe("Optional glob pattern to filter files (e.g., '*.py')"), }), },