Skip to content

fix(onboarding): fix broken tool-selection checkboxes and dedupe same-server picks - #2421

Open
entee28 wants to merge 6 commits into
kagent-dev:mainfrom
entee28:improve-tool-selection-onboarding-agent
Open

fix(onboarding): fix broken tool-selection checkboxes and dedupe same-server picks#2421
entee28 wants to merge 6 commits into
kagent-dev:mainfrom
entee28:improve-tool-selection-onboarding-agent

Conversation

@entee28

@entee28 entee28 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fixes tool-selection checkboxes in the onboarding wizard’s Step 3: Select Tools, which never visually reflected selection state and could never be un-checked. Root cause: toolResponseMatchesTool compared tool.mcpServer.name (namespace stripped by toolResponseToAgentTool) directly against toolResponse.server_name (the full namespace/name ref) — the strings never matched, so isToolSelected() was always false. Switched to serverNamesMatch(), the same helper SelectToolsDialog already uses for this exact mismatch.
  • Because isToolSelected was always false, handleToolToggle could never take its “remove” branch either — every click, even on an already-selected tool, just added another entry. Fixing the comparison alone stops re-adding the same tool, but doesn’t stop two different tools on the same server from ending up as two separate array entries, so handleToolToggle (and the initial two-default-tool preselection effect) now merge same-server picks into one Tool entry’s toolNames array — matching how SelectToolsDialog.handleAddItem already behaves in the regular create/edit flow. Both call sites share one mergeToolIntoServerEntry() helper so the merge behavior only needs to change in one place. toolNames is deduped via Set when merging, and the preselection effect now matches on tool.id directly rather than the display-name getter.
  • Reworked Step 4: Review Agent Configuration‘s “Selected Tools” badges as a required consequence of the merge above: previously each badge showed tool.mcpServer.name (the server name) once per array entry; after merging, that would’ve collapsed to a single, uninformative “kagent-tool-server” badge no matter how many tools were picked. Badges now flatMap over each entry’s toolNames (and show the agent name for Agent-type picks), keyed by stable, data-derived identifiers rather than array index.
  • Added a selected-state highlight (border/background) on tool rows in Step 3.

Closes #2411

…and improve review display

Signed-off-by: Thanh Nguyen <puffle.nnt@gmail.com>
…fic entries and prevent merging

Signed-off-by: Thanh Nguyen <puffle.nnt@gmail.com>
…ies for same MCP server

Signed-off-by: Thanh Nguyen <puffle.nnt@gmail.com>
@github-actions github-actions Bot added the bug Something isn't working label Aug 11, 2026
@entee28
entee28 marked this pull request as ready for review August 11, 2026 08:38
Copilot AI lite review requested due to automatic review settings August 11, 2026 08:38
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Aug 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes onboarding wizard tool selection behavior in the UI by correctly detecting selected MCP tools (even when server refs are namespaced) and by preventing duplicate same-server entries through server-level merging. This aligns onboarding’s tool-selection data shape with the existing create/edit flow and makes the review step accurately reflect the user’s selections.

Changes:

  • Fix selection-state detection by using serverNamesMatch() for MCP server comparisons.
  • Merge same-server tool picks into a single Tool entry with a deduped toolNames array (including for the initial default preselection).
  • Update Review Step badges to render one badge per selected tool name (and agent name for Agent-type picks), plus add selected-row highlighting in Step 3.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
ui/src/components/onboarding/steps/ToolSelectionStep.tsx Fixes selected-state logic and merges same-server tool picks; adds selected-row highlighting.
ui/src/components/onboarding/steps/ReviewStep.tsx Renders selected-tool badges per tool name (and agent name) to match merged selection shape.
ui/src/components/onboarding/steps/tests/ToolSelectionStep.test.tsx Adds tests to ensure same-server selections merge, deselect behaves correctly, and different servers don’t merge.
ui/src/components/onboarding/steps/tests/ReviewStep.test.tsx Adds tests validating badge rendering per selected tool and agent.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread ui/src/components/onboarding/steps/ToolSelectionStep.tsx Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Onboarding wizard's tool checkboxes never show as checked, and repeated clicks silently multiply MCP connections

3 participants