Skip to content

fix: add default value to grep tool glob schema for strict mode compatibility#422

Merged
Christian Bromann (christian-bromann) merged 3 commits intolangchain-ai:mainfrom
JadenKim-dev:fix/grep-tool-schema-default
Apr 4, 2026
Merged

fix: add default value to grep tool glob schema for strict mode compatibility#422
Christian Bromann (christian-bromann) merged 3 commits intolangchain-ai:mainfrom
JadenKim-dev:fix/grep-tool-schema-default

Conversation

@JadenKim-dev
Copy link
Copy Markdown
Contributor

Summary

  • The grep tool's glob field was defined with .optional().nullable() but without .default(),
    causing it to be excluded from the JSON schema required array.
  • This violates OpenAI's strict mode requirement that all properties must be listed in required,
    resulting in a 400 error when using providerStrategy with OpenAI models.
  • Added .default(null) to the glob field and a test verifying all tool schema properties
    are included in required.

Fixes #401

Test plan

  • Existing fs.test.ts tests pass (54 tests)
  • New test verifies all tool schema properties are in the required array
  • Confirmed the fix produces correct JSON schema output (glob included in required)
  • Confirmed the old schema (without .default(null)) would fail the new test

…tibility

The grep tool's `glob` field was defined with `.optional().nullable()` but
without `.default()`, causing it to be excluded from the JSON schema
`required` array. This violates OpenAI's strict mode requirement that all
properties must be listed in `required`.

Fixes langchain-ai#401
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 2, 2026

🦋 Changeset detected

Latest commit: 1961aa2

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Added a default value to the grep tool glob schema to ensure compatibility with strict mode.
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 3, 2026

Open in StackBlitz

npm i https://pkg.pr.new/deepagents-acp@422
npm i https://pkg.pr.new/deepagents@422
npm i https://pkg.pr.new/@langchain/sandbox-standard-tests@422

commit: a384766

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot use structured outputs with Openai & providerStrategy

2 participants