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):

  1. GetSavedViewTool (fetch saved view metadata) - !226995 (merged)
  2. GetSavedViewWorkItemsTool (fetch work items with filters) - !226996 (merged)
  3. This MR - Orchestrator service + tool registration

Key changes

  • New Mcp::Tools::WorkItems::GraphqlGetSavedViewWorkItemsService class that orchestrates two GraphQL tools:
    1. First fetches the saved view metadata (name, description, filters, sort) via GetSavedViewTool
    2. Then queries work items with the saved view's filters applied via GetSavedViewWorkItemsTool
  • Tool registration in the MCP tools manager, making get_saved_view_work_items available 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 a warnings field 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:

  1. Executes GetSavedViewTool to retrieve the saved view's filters and sort configuration
  2. Passes those filters to GetSavedViewWorkItemsTool which maps them to GraphQL query variables
  3. Combines both results into a single response with savedView metadata and workItems list

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:

  1. GetSavedViewWorkItemsTool compares incoming filter keys against its filter_mapping and tracks any unrecognized keys with present values via an unsupported_filters accessor
  2. GraphqlGetSavedViewWorkItemsService reads unsupported_filters from the tool after execution and, if any exist, appends a warnings array 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

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.

Edited by Naman Jagdish Gala

Merge request reports

Loading