Repository navigation
Let schema tools filter on whether a column is set - #718
Merged
Merged
Conversation
A nil filter value is dropped as "no filter", which is right: models send
null for every optional parameter they leave out. It also left no way to
ask for the records where a column is null (tickets with no assignee,
requests not yet approved), so hosts taught their models sentinel ranges
such as {"after": "2000-01-01"} to mean "is set", with nothing at all for
"is not set" on a foreign key.
A filter now takes {"present": false} (IS NULL) or {"present": true}
(IS NOT NULL), alone or beside a range bound, on any filterable column.
An enum accepts it though it takes no comparison. The schema offers it in
the range object of nullable date, time and number columns, which covers
foreign keys, rather than wrapping every nullable string and enum in an
object form. Anything but true or false is rejected, not guessed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PCEJHpsHnAd9GSQRbkvYDH
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PCEJHpsHnAd9GSQRbkvYDH
CHANGELOG: keep the presence filter under Added and the 1.9.9 fixes under Fixed in one Unreleased section. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PCEJHngWphRQ7ArmDnYMmf
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
SchemaToolsdrops anullfilter value as "no filter". That's right, because models sendnullfor every optional parameter they leave out. But it also means a model can't ask for the records where a column is null: tickets with no assignee, requests not yet approved, posts never published. Host apps have been working around it in their instructions with sentinel ranges, such as telling the model that{"after": "2000-01-01"}on a timestamp means "is set". For "is not set" on a foreign key there is no workaround at all.What
A filter can now take a
presentkey in its object form:true/false(or"true"/"false"). Anything else comes back as{ error: ... }rather than being guessed into one of the two, the same way an unknown comparison is already handled.""counts as present. That case is only reachable by calling the tool directly, since the schema never offerspresenton strings.Not changed
Making
nullmean IS NULL would turn every omitted optional parameter into a filter, sonullstill means no filter. Existing filters and schemas are unchanged, except that nullable range columns gain one boolean property.Tests
test/schema_tools_test.rb: null, not null, with a bound and an equality filter, string operands, a rejected operand, a string column and an enum, and where it is offered. The advertised-operators test now includespresent.test/schema_tools_test.rb: 64 runs, 0 failures. The engine and generator schema-tools tests (MCP, registration, roster, project): 64 runs, 0 failures.RubyLLMIntegrationTestcases, which fail locally with placeholder keys; CI runs them with real keys.Docs:
docs/actions/tools.md,CHANGELOG.mdunder[Unreleased], anddocs/work/schema-tools-presence-filter/.🤖 Generated with Claude Code
https://claude.ai/code/session_01PCEJHpsHnAd9GSQRbkvYDH