Add MCP orchestrator service for saved view work items
What does this MR do and why?
Introduces GraphqlGetSavedViewWorkItemsService, the orchestrator service that chains GetSavedViewTool and GetSavedViewWorkItemsTool to fetch a saved view's metadata and its filtered work items list. Also registers the get_saved_view_work_items tool in the MCP tools manager.
This is the third of three MRs that break down !226663 (closed):
-
GetSavedViewTool(fetch saved view metadata) - !226995 (merged) -
GetSavedViewWorkItemsTool(fetch work items with filters) - !226996 (merged) - This MR - Orchestrator service + tool registration
Key changes
- New
Mcp::Tools::WorkItems::GraphqlGetSavedViewWorkItemsServiceclass that orchestrates two GraphQL tools:- First fetches the saved view metadata (name, description, filters, sort) via
GetSavedViewTool - Then queries work items with the saved view's filters applied via
GetSavedViewWorkItemsTool
- First fetches the saved view metadata (name, description, filters, sort) via
- Tool registration in the MCP tools manager, making
get_saved_view_work_itemsavailable as a read-only tool - Input schema validation for namespace identification (URL, group_id, project_id), saved view ID, and pagination controls
-
Unsupported filter warnings: When a saved view contains filters not yet supported by the tool (e.g.,
healthStatusFilter,iterationId,search), the response includes awarningsfield so the agent can inform the user that results may be broader than expected - Comprehensive test coverage for the service class
Technical details
The service performs a two-step orchestration:
- Executes
GetSavedViewToolto retrieve the saved view's filters and sort configuration - Passes those filters to
GetSavedViewWorkItemsToolwhich maps them to GraphQL query variables - Combines both results into a single response with
savedViewmetadata andworkItemslist
If either step fails, the error is returned immediately without proceeding to the next step.
Unsupported filter detection
Not all saved view filters are supported in this iteration (see filter coverage note). Rather than silently dropping unsupported filters and returning broader results, the tool now:
-
GetSavedViewWorkItemsToolcompares incoming filter keys against itsfilter_mappingand tracks any unrecognized keys with present values via anunsupported_filtersaccessor -
GraphqlGetSavedViewWorkItemsServicereadsunsupported_filtersfrom the tool after execution and, if any exist, appends awarningsarray to the combined response
Example response with warnings:
{
"savedView": { "name": "My View", "filters": { "labelName": ["bug"], "healthStatusFilter": "onTrack" } },
"workItems": { "nodes": [...], "pageInfo": {...} },
"warnings": [
{
"type": "unsupported_filters",
"message": "The following saved view filters were not applied and results may be broader than expected: healthStatusFilter",
"filters": ["healthStatusFilter"]
}
]
}
This is self-healing: as new filters are added to the filter_mapping in future iterations, they automatically stop appearing in warnings.
How to set up and validate locally
You can test get_saved_view_work_items tool using MCP inspector.
Example call:
{
"name": "get_saved_view_work_items",
"arguments": {
"group_id": "gitlab-org",
"saved_view_id": "gid://gitlab/WorkItems::SavedViews::SavedView/123"
}
}
References
- Part of #592440
- Split from !226663 (closed)
- Depends on !226995 (merged) and !226996 (merged) (both merged)
- Implementation follows the MCP GraphQL Integration design document
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.