include: work_item_types on get_project tool
Note
Before picking up this work: this issue extends the get_project MCP tool. Please follow the Adding a new tool guidance first. That includes creating an MCP Tool Proposal, using verb_object naming (get_ / list_ / save_ / delete_), and the shared resource-identification input base classes.
Problem Statement / Use Case
Agents need to discover which work item types exist in a namespace — and, critically, which widgets each type supports — before calling save_work_item (whose type_name is required on create and whose widget params are rejected for unsupported types). The shipped get_work_item_types returns exactly this: the list of system-defined and custom types for a group/project, each with its global ID, name, icon, and enabled widget types.
Approach: work item types are scoped to one parent object, so they fold into that object's get_ tool as an include facet rather than a standalone tool. This issue adds include: ["work_item_types"] to get_project. Group-level types (for example Epic) need a get_group tool, which doesn't exist yet.
Scope and Non-Goals
- In scope: an
include: ["work_item_types"]facet onget_projectreturning each type's global ID, name, icon, and enabled widget types. - Non-goals: renaming or removing
get_work_item_types; group-level types; reading a single work item (get_work_item), listing/filtering work items (list_work_items), mutations (save_work_item,save_work_item_note), linking (link_work_items). - Follow-ups: the same facet on a future
get_grouptool. Only then canget_work_item_typesbe retired.
Data Shape and Context Engineering
Bounded output — one entry per type in the namespace. Each entry is a compact type reference (global ID, name, icon, enabled widget types) so the model can pre-validate save_work_item payloads and avoid setting fields the type does not support. No pagination needed (type count is small).
- Input schema (example):
{
"tool": "get_project",
"parameters": {
"url": "string (optional)",
"project_id": "string (optional; provide exactly one of url or project_id)",
"include": "array of enum (optional; one of: work_item_types; maxItems: 1)"
}
}- Output schema (JSON example):
The existing get_project fields stay as they are; work_item_types is added only when requested. widget_types is flattened from widgetDefinitions[].type.
{
"id": 278964,
"path_with_namespace": "gitlab-org/gitlab",
"default_branch": "master",
"visibility": "public",
"web_url": "https://gitlab.com/gitlab-org/gitlab",
"work_item_types": [
{
"id": "gid://gitlab/WorkItems::Type/1",
"name": "Issue",
"icon_name": "issue-type-issue",
"widget_types": ["ASSIGNEES", "LABELS", "DESCRIPTION", "HIERARCHY"]
}
]
}Backward compatibility
Keep the shipped get_work_item_types unchanged. It is the only way to read group-level types until a get_group facet exists, so it must not be removed under #622712 (closed) before then.
The include parameter is optional and additive, and the default response doesn't change, so get_project stays on version 0.1.0 (same as the facets added to get_merge_request, get_pipeline, and get_work_item).
Implementation plan
Model the facet on get_pipeline (app/services/mcp/tools/pipelines/get_pipeline_tool.rb and get_pipeline_service.rb).
app/graphql/queries/mcp/projects/get_project.query.graphql: add$includeWorkItemTypes: Boolean = falseandworkItemTypes @include(if: $includeWorkItemTypes) { nodes { id name iconName widgetDefinitions { type } } }underproject.Project.workItemTypesalready exists in the GraphQL API.app/services/mcp/tools/projects/get_project_tool.rb: add aFACETS = { includeWorkItemTypes: 'work_item_types' }map, set the flags inbuild_variables, and map the nodes intowork_item_typesinproject_datawhen present.app/services/mcp/tools/projects/get_project_service.rb: addinclude(array,items: { enum: GetProjectTool::FACETS.values },maxItems: 1) and one sentence to the description: passinclude: ["work_item_types"]to also return the project's work item types and their enabled widgets, for use beforesave_work_item.
Tests
spec/services/mcp/tools/projects/get_project_tool_spec.rb: facet requested and not requested; widget types flattened; project not found.spec/services/mcp/tools/projects/get_project_service_spec.rb: input schema includesincludewith the enum andmaxItems.
Docs
doc/user/model_context_protocol/mcp_server_tools.md: addincludeto theget_projectparameter table with a history line; in theget_work_item_typesentry, point project-level callers to the facet.doc/development/duo_agent_platform/mcp/_index.md: addwork_item_typesto the list of validincludevalues.