Add search and scoping filters to saved view MCP tool
What does this MR do and why?
Adds support for search and scoping filters in GetSavedViewWorkItemsTool, covering the second iteration of filter support for the saved view MCP tool. These filters are critical because silently ignoring search or fullPath returns a much broader result set than the user expects.
This MR targets the !227911 (merged) branch (orchestrator service).
Newly supported filters
| Filter | GraphQL Variable | Type | Description |
|---|---|---|---|
search |
$search |
String |
Free-text search across work items |
in |
$in |
[IssuableSearchableField!] |
Scope search to title, description, or both |
hierarchyFilters |
$hierarchyFilters |
HierarchyFilterInput |
Parent scoping with parentIds, parentWildcardId, includeDescendantWorkItems |
fullPath |
Overrides $fullPath |
ID |
Scopes results to a sub-group or project within the namespace |
Technical details
search and in: Straightforward pass-through mappings added to the filter_mapping hash and the GraphQL query variables/arguments.
hierarchyFilters: Pass-through of the HierarchyFilterInput object. The saved view stores hierarchy filters as an object with parentIds (array of work item GIDs), parentWildcardId, and includeDescendantWorkItems.
fullPath: This filter is special. Unlike other filters that are arguments to the workItems(...) field, fullPath changes which namespace is queried at the top level (namespace(fullPath: ...)). When a saved view has a fullPath filter (e.g., user scoped the view to a sub-group), the tool overrides the fullPath variable before building the query. This is handled separately from the filter_mapping to avoid it being passed as a workItems argument.
Changes
get_saved_view_work_items_tool.rb: Addedsearch,in,hierarchyFiltersto the GraphQL query andfilter_mapping. Added special handling forfullPathto override the namespace scope.get_saved_view_work_items_tool_spec.rb: Added unit test contexts for search/in, hierarchyFilters, fullPath override, and updated unsupported filters test (removedsearchsince it's now supported).graphql_get_saved_view_work_items_service_spec.rb: Added integration tests for search/in filters (verifies search variables are passed and matching work items are returned), hierarchyFilters (verifies parentIds are passed as GIDs and child work items are returned), and fullPath scoping to both subgroups and projects (verifies the namespace fullPath is overridden and no unsupported filter warnings are emitted).
How to set up and validate locally
Test using MCP inspector with a saved view that has search or group scoping filters applied.
References
- Part of #592440
- Depends on !227911 (merged)
- Iteration 2 of the filter coverage plan
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.