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

Screenshots or screen recordings

N/A - backend-only change.

How to set up and validate locally

  1. Enable the feature flags in the Rails console:

    Feature.enable(:mcp_client)
    Feature.enable(:mcp_catalog_agent_tools)
    Feature.enable(:workplan_score)
  2. Create a copy of the Planner agent in your AI Catalog and enable it for your project.

  3. Add the get work item and save work item mcp tools to the agent. Note: Select the tools marked as beta.

  4. Open existing work item in the project.

  5. Open Duo chat, and select your agent.

  6. Ask agent to fetch the readiness score and response should include null.

  7. Ask the agent to update the readiness score to 50.

  8. Again ask the agent to fetch the readiness score again.

  9. The response should include updated 50 readiness 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.

Edited by Naman Jagdish Gala

Merge request reports

Loading
Loading