Enable filters parameter with flattened agent-friendly schema#32
Open
themightychris wants to merge 1 commit into
Open
Enable filters parameter with flattened agent-friendly schema#32themightychris wants to merge 1 commit into
themightychris wants to merge 1 commit into
Conversation
Previously, the filters parameter was explicitly excluded from the MCP
tool schema. This change enables filter support with a properly structured
schema that flattens the complex FilterExpression oneOf into a single
object with all possible fields - following the existing PropertyValue
pattern in the codebase.
The flattened schema includes:
- operator: "and" | "or" for combining conditions
- conditions: array of filter items with:
- property_key: the field to filter on
- condition: eq/ne/gt/lt/empty/nempty/in/contains/etc
- type-specific value fields (text/number/checkbox/date/objects/etc)
- filters: nested expressions for complex boolean logic
Tested working:
- Checkbox filters: {"conditions": [{"property_key": "done", "condition": "eq", "checkbox": false}]}
- Existence filters: {"conditions": [{"property_key": "links", "condition": "nempty"}]}
Note: Object ID filters (condition: "in"/"all" with objects array) return
400 from the API - this appears to be an API limitation, not MCP.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
milichev
approved these changes
Mar 9, 2026
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.
Summary
This PR enables the
filtersparameter for search endpoints with a properly structured schema that's optimized for LLM agents.Previously, the
filtersparameter was explicitly excluded from the MCP tool schema with TODO comments. This change:PropertyValuepattern in the codebaseApproach
Rather than exposing the complex recursive
FilterExpressionwith 12oneOfvariants, we flatten it into a single object with all possible fields as optional properties. This mirrors how the codebase already handlesPropertyValueschemas and is much easier for LLMs to understand and use correctly.Schema Structure
{ "operator": "and" | "or", "conditions": [{ "property_key": "done", "condition": "eq", "checkbox": false }], "filters": [/* nested expressions */] }Tested Working
{"conditions": [{"property_key": "done", "condition": "eq", "checkbox": false}]}{"conditions": [{"property_key": "links", "condition": "nempty"}]}Note
Object ID filters (
condition: "in"/"all"withobjectsarray) return 400 from the API - this appears to be an API-side limitation, not related to this MCP change.🤖 Generated with Claude Code