Add a work_item_types facet to the get_project MCP tool

What does this MR do and why?

Adds an include parameter to the get_project MCP tool with one facet, work_item_types. Passing include: ["work_item_types"] returns each work item type available in the project (global ID, name, icon name, and enabled widget types) alongside the existing project metadata.

An agent creating a work item needs to know which type names the project accepts and which widgets each type supports, otherwise save_work_item rejects the call. Work item types are scoped to one project, so they fit the include pattern get_pipeline already uses rather than a standalone tool. This extends the existing get_project tool, so no Tool Proposal was raised.

Without the facet the response is unchanged, so the tool stays on 0.1.0. get_work_item_types is untouched, since it is still the only way to read group-level types.

Closes #606643 (closed)

References

  • Precedent for the facet pattern: app/services/mcp/tools/pipelines/get_pipeline_tool.rb
  • Tool docs: doc/user/model_context_protocol/mcp_server_tools.md

Screenshots or screen recordings

Before After
Screenshot_2026-11-03_at_1.43.13_PM Screenshot_2026-11-03_at_1.38.53_PM

How to set up and validate locally

  1. In GDK, run the tool directly against a seeded project, once without the facet (unchanged path) and once with it:

    bin/rails runner '                                                                                                                  
       user = User.find_by(username: "root")
       svc = Mcp::Tools::Projects::GetProjectService.new(name: "get_project")
       svc.set_cred(current_user: user)
       base = { project_id: "gitlab-org/gitlab-test" }
     
       puts JSON.pretty_generate(
         without_include: svc.execute(request: nil, params: { arguments: base })[:structuredContent],
         with_include:    svc.execute(request: nil, params: { arguments: base.merge(include: ["work_item_types"]) })[:structuredContent]
       )
     '

    Expected: the first line lists the existing project keys only, with no work_item_types, so callers that do not pass include are unaffected. The second line prints one work item type with its id, name, icon_name, and widget_types.

  2. Confirm the schema advertises the facet:

    bin/rails runner 'puts Mcp::Tools::Projects::GetProjectService.new(name: "get_project").input_schema[:properties][:include].inspect'

    Expected: an array property with enum: ["work_item_types"] and maxItems: 1.

  3. Run the specs:

    bin/rspec spec/services/mcp/tools/projects/get_project_service_spec.rb \
              spec/services/mcp/tools/projects/get_project_tool_spec.rb \
              spec/services/mcp/tools/schema_defaults_spec.rb \
              ee/spec/lib/ai/tool_rules/governable_tools_container_spec.rb

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.

Merge request reports

Loading
Loading