Add readiness_score support to MCP work item read and mutation tools
What does this MR do and why?
Expose the agent plan readiness_score (0-100) through the MCP tool layer so that MCP consumers (Duo Chat, Duo Agent Platform, external MCP clients) can both read and write it.
Read (get_work_item): Add a WorkItemWidgetAgentPlan inline fragment with readinessScore to the EE GraphQL query document. The field is already gated by the workplan_score feature flag at the GraphQL resolver level - it returns null when the flag is disabled, so no extra MCP-layer gating is needed.
Write (save_work_item): Fix the agent_plan_widget builder in SaveWorkItemCommon to include readinessScore alongside content. Previously the method short-circuited on the :agent_plan key, silently dropping a score-only update. Now it builds the widget hash from whichever of :agent_plan / :readiness_score are present and returns nil only when neither is given. Add readiness_score (integer, 0-100) to the EE input schema with a description noting the feature flag requirement.
The feature flag gating on write is handled by the existing WorkItems::Callbacks::AgentPlan callback, which checks workplan_score before persisting the score.
References
- Closes #619714 (closed)
- Parent epic: gitlab-org#23050
- GraphQL field: #611320 (closed)
- Scoring flow: #613998
Screenshots or screen recordings
N/A - backend-only change.
How to set up and validate locally
-
Enable the feature flags in the Rails console:
Feature.enable(:mcp_client) Feature.enable(:mcp_catalog_agent_tools) Feature.enable(:workplan_score) -
Create a copy of the Planner agent in your AI Catalog and enable it for your project.
-
Add the
get work itemandsave work itemmcp tools to the agent. Note: Select the tools marked asbeta. -
Open existing work item in the project.
-
Open Duo chat, and select your agent.
-
Ask agent to
fetch the readiness scoreand response should includenull. -
Ask the agent to
update the readiness score to 50. -
Again ask the agent to
fetch the readiness score again. -
The response should include updated
50readiness score.
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.