Skip to content

webui: fix tool selector toggle/counter, key tools by stable identity#24065

Merged
allozaur merged 2 commits into
ggml-org:masterfrom
ServeurpersoCom:ui/refactor-tools-selector
Jun 4, 2026
Merged

webui: fix tool selector toggle/counter, key tools by stable identity#24065
allozaur merged 2 commits into
ggml-org:masterfrom
ServeurpersoCom:ui/refactor-tools-selector

Conversation

@ServeurpersoCom
Copy link
Copy Markdown
Contributor

@ServeurpersoCom ServeurpersoCom commented Jun 3, 2026

Overview

Refactor and simplify the tool selector logic, builtin and MCP.
Two visual states for every checkbox, matching the internal state, and a plain Select-All for categories. Dropped the tristate since the n/total count already shows partial selection

Additional information

The disabled set was keyed by the bare function name, so duplicate names in a group counted twice and toggled together, and the same name across groups bled between counters. On top of that each row nested a checkbox button inside the row button, which double-fired the toggle on a direct click and was invalid HTML that only broke on some browsers. The fix is to give every tool a stable key (builtin:name, mcp-serverId:name, custom:name) and route the disabled set, counts, toggles and group state through it, all derived from one canonical deduped list. The checkboxes become presentational so the row owns the single handler, and the enabled-tools and lookup paths are merged down to one each.

Disabled selection resets once (new storage key, no migration), quick to reconfigure. Around 50 lines removed.

Closes #22796, supersedes #23276.

Video

ToolSelector.mp4

Requirements

Key the disabled set, counts and toggles by a stable per-tool key
instead of bare function name, deduped from one canonical list. Per-tool
checkboxes become presentational (single row handler, no nested button),
category checkboxes drop the tristate (n/total carries partial). One
getEnabledToolsForLLM keeps normalized MCP schemas and dedupes by name.
@ServeurpersoCom
Copy link
Copy Markdown
Contributor Author

Thanks @MaxKruse for the repro and the first fix.
Can you test it and see if it suits you?

@MaxKruse
Copy link
Copy Markdown

MaxKruse commented Jun 3, 2026

@ServeurpersoCom All good on my end! Thx!

@ServeurpersoCom ServeurpersoCom requested a review from allozaur June 3, 2026 09:55
@allozaur allozaur requested a review from ggerganov June 3, 2026 09:57
@ServeurpersoCom
Copy link
Copy Markdown
Contributor Author

ServeurpersoCom commented Jun 3, 2026

I still have one small commit to make for linter

@allozaur allozaur merged commit 4586479 into ggml-org:master Jun 4, 2026
6 checks passed
gabe-l-hart added a commit to gabe-l-hart/llama.cpp that referenced this pull request Jun 4, 2026
* origin/master: (57 commits)
server : disable on-device spec checkpoints (ggml-org#24108)
arg: fix double mtp downloads (ggml-org#24128)
webui: [a11y] fix keyboard navigation issues in chat interface and sidebar (ggml-org#23132)
Move duplicated imatrix code into single common imatrix-loader.cpp (ggml-org#22445)
ui: Fixed packages (ggml-org#24119)
ui: added single line reasoning preview (ggml-org#23601)
return filter to save memory (ggml-org#24125)
convert: Fix Gemma 4 Unified conversion (ggml-org#24118)
ggml: vectorize ggml_vec_dot_q4_1_q8_1 with WASM SIMD128 (ggml-org#22209)
server: avoid unnecessary checkpoint restore when new tokens are present (ggml-org#24110)
agents: refactor, include more guidelines (ggml-org#24111)
webui: fix tool selector toggle/counter, key tools by stable identity (ggml-org#24065)
build : use umbrella Headers directory for XCFramework module map (ggml-org#23974)
server : add header to tools/server/server-http.h (ggml-org#24089)
cmake: skip cvector-generator and export-lora when CPU backend is disabled (ggml-org#24053)
fix(mtmd): handle Gemma 4 audio projector embedding size (ggml-org#24091)
readme : add status badges (ggml-org#24104)
tests : refactor test-save-load-state to accept token input (ggml-org#24073)
metal : reduce rset heartbeat from 500ms -> 5ms (ggml-org#24074)
ggml-webgpu: FlashAttention refactor + standardize quantization support (ggml-org#23834)
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Misc. bug: webui: Builtin-Tool selector not selecting correctly in all cases

4 participants