-
-
Notifications
You must be signed in to change notification settings - Fork 72
Fix MCP get-items returning zero results due to empty filter values #349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stripping
falsemay silently discard intentional boolean filters.The current filter removes all
falsevalues, but users may legitimately want to query for items where a boolean field is false (e.g.,active = falseto list inactive products, orrecurring = falseto find one-time purchases). This fix would make those queries impossible.Consider one of these approaches:
null) for "not specified" and only strip thoseAdditionally,
nullvalues pass through this filter (null !== falseis true) and may also cause unexpected query behavior depending on how BerlinDB handles them.Proposed fix to also filter null while preserving intentional false
One approach is to filter only truly "empty" values while keeping explicit booleans. However, this requires distinguishing intent, which may need upstream schema changes:
$args = array_filter( $args, function ($value) { - return '' !== $value && false !== $value; + // Strip empty strings and null; keep false for intentional boolean filters + return '' !== $value && null !== $value; } );Note: This alone doesn't fully solve the LLM default problem for booleans. A more robust solution would be to remove
defaultvalues from boolean filter properties in the schema (lines 648-705) so LLMs don't auto-fill them.📝 Committable suggestion
🤖 Prompt for AI Agents