Merge pull request #9970 from continuedev/mcp-tools-badge-x-y-format
feat: indicate excluded tools in MCP server # tools badge
This commit is contained in:
commit
8acf42f530
1 changed files with 18 additions and 2 deletions
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue