Repository navigation
feat(web): sort the Tools list by displayed label (#2782) - #2798
Merged
Merged
Conversation
Rows in the Tools sidebar now sort alphabetically by the label they show (title, else name), case-insensitively and with numeric digit runs, so a 20-30 tool list can be scanned. Row keys are still stamped from source position before filtering and sorting, so selection and duplicate-name handling (#1957, #2001) are unaffected. Excluded tools sort the same way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: cliffhall <cliff@futurescale.com>
2 tasks done
There was a problem hiding this comment.
🟡 Changes recommended
Excluded rows sort by title but display only names, so their visible ordering can remain nonalphabetical.
1 open issue
What changed in this PR
Adds alphabetical sorting to the web Tools sidebar for #2782, while preserving source-position row keys used to select duplicate-name tools.
Changes:
- Adds a label comparator with case-insensitive, numeric-aware ordering.
- Sorts regular and excluded tools after filtering.
- Adds tests for ordering, filtered results, and selection identity.
| File | Description |
|---|---|
clients/web/src/utils/toolUtils.ts |
Adds the displayed-label comparator. |
clients/web/src/utils/toolUtils.test.ts |
Tests label precedence, case handling, and numeric ordering. |
clients/web/src/components/groups/ToolControls/ToolControls.tsx |
Sorts filtered rows while retaining source-position keys. |
clients/web/src/components/groups/ToolControls/ToolControls.test.tsx |
Tests rendered order and selection after sorting. |
Review effort: Balanced
Excluded rows render only tool.name, so sorting them by the resolved title could leave the visible list out of order. Expose the collator as compareToolLabels and sort excluded rows by name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: cliffhall <cliff@futurescale.com>
Member
Author
|
Copilot review loop closed — round 2 came back clean.
|
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Closes #2782
What changed
The Tools sidebar used to list tools in whatever order the server returned from
tools/list. It now sorts them alphabetically by the label each row shows: thetitlewhen the tool has one, otherwise thename.compareToolsByLabel(clients/web/src/utils/toolUtils.ts): a pure comparator built onresolveDisplayLabeland anIntl.Collatorwithsensitivity: "base"andnumeric: true. Sorting ignores case and compares numbers by value, sotool_2comes beforetool_10. Labels that differ only in case count as equal, and becauseArray.prototype.sortis stable, they keep the server's order.ToolControls: sorts after filtering. The listed tools and the "Excluded (SEP-2243)" section are both sorted.Selection is unaffected
Each row key is still taken from the tool's position in the server's original list, before filtering and sorting. So
toolRowKey,findToolByRowKeyand the duplicate-name handling (#1957, #2001) behave exactly as before. A new test clicks a tool that moved from source index 3 to the top of the list and checks that it still reports3:git_commit.Tests
toolUtils.test.ts: sorts by title when present, otherwise by name; ignores case; compares numbers by value; equal labels compare as 0.ToolControls.test.tsx: rows render in sorted order; the order holds while a search narrows the list; a moved row reports its source-position key; excluded tools are sorted too.npm run local:gatepasses.Screenshots
Both screenshots use a test server that returns 10 tools in shuffled order (1280×900).
Before (server order):
After (sorted):
🤖 Generated with Claude Code