Show x/y format for MCP server tools badge

- Update ToolPoliciesGroup to display enabled/total count
- Badge shows 'x/y' when some tools are excluded
- Badge shows 'x' when all tools are enabled (x === y)
- Changed badge min-width to accommodate longer text

Generated with [Continue](https://continue.dev)

Co-Authored-By: Continue <noreply@continue.dev>
Co-authored-by: dallin <dallin@continue.dev>
This commit is contained in:
RomneyDa
2026-01-28 06:30:27 +00:00
parent cfd9bc4e31
commit 8140ec89a2

View File

@@ -39,10 +39,26 @@ export function ToolPoliciesGroup({
const toolGroupSettings = useAppSelector(
(state) => state.ui.toolGroupSettings,
);
const toolSettings = useAppSelector((state) => state.ui.toolSettings);
const isGroupEnabled = useMemo(() => {
return toolGroupSettings[groupName] !== "exclude";
}, [toolGroupSettings, groupName]);
const { enabledCount, totalCount } = useMemo(() => {
const total = tools.length;
const enabled = tools.filter(
(tool) => toolSettings[tool.function.name] !== "disabled",
).length;
return { enabledCount: enabled, totalCount: total };
}, [tools, toolSettings]);
const badgeText = useMemo(() => {
if (enabledCount === totalCount) {
return totalCount.toString();
}
return `${enabledCount}/${totalCount}`;
}, [enabledCount, totalCount]);
return (
<Card className="flex flex-1 flex-col p-0">
<div
@@ -60,8 +76,8 @@ export function ToolPoliciesGroup({
<WrenchScrewdriverIcon className="h-4 w-4 flex-shrink-0" />
)}
<span className="text-sm font-semibold">{displayName}</span>
<div className="flex h-5 w-5 items-center justify-center rounded-md bg-gray-600 px-0.5 text-xs font-medium text-white">
{tools.length}
<div className="flex h-5 min-w-5 items-center justify-center rounded-md bg-gray-600 px-1 text-xs font-medium text-white">
{badgeText}
</div>
</div>
</div>