Enable filters parameter with flattened agent-friendly schema - #32
Enable filters parameter with flattened agent-friendly schema#32themightychris wants to merge 3 commits 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>
|
Thanks for this — I rechecked it against current Current MCP now keeps all tools registered (50 tools locally, including create/update/search), but Before merge, could this be rebased or cherry-picked onto current
I would keep generic |
Adds the `files: string[]` value field from FilesFilterItem, the one FilterItem variant missing from the flattened FilterExpression schema. Regenerates scripts/tools.json from the 2025-11-08 spec. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Pins the flattened filters schema for search-space and search-global against the checked-in spec: operator enum, full 13-value condition enum, all type-specific value fields, required keys, and nested filters. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Thanks @Tsopic — all four points addressed:
Agreed on keeping generic |
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