mirror of
https://github.com/davidkaya/aryx.git
synced 2026-08-04 02:48:44 +02:00
fix: show MCP tools in all provider groups when shared
When multiple MCP servers expose the same tool names (e.g., several kusto-mcp instances), each server's group now shows its tools instead of only the first server getting the tools and others showing 0/0. Deduplicate the effectiveAutoApprovedCount to avoid double-counting shared tools in the pill header. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -131,15 +131,17 @@ export function ChatPane({
|
||||
);
|
||||
const effectiveAutoApprovedCount = useMemo(() => {
|
||||
const groups = groupApprovalToolsByProvider(approvalTools, toolingSettings);
|
||||
let count = 0;
|
||||
const counted = new Set<string>();
|
||||
for (const group of groups) {
|
||||
if (group.serverApprovalKey && effectiveAutoApproved.has(group.serverApprovalKey)) {
|
||||
count += group.tools.length;
|
||||
for (const tool of group.tools) counted.add(tool.id);
|
||||
} else {
|
||||
count += group.tools.filter((t) => effectiveAutoApproved.has(t.id)).length;
|
||||
for (const tool of group.tools) {
|
||||
if (effectiveAutoApproved.has(tool.id)) counted.add(tool.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
return counted.size;
|
||||
}, [approvalTools, effectiveAutoApproved, toolingSettings]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -306,6 +306,22 @@ export function groupApprovalToolsByProvider(
|
||||
const groups = new Map<string, ApprovalToolGroup>();
|
||||
|
||||
for (const tool of tools) {
|
||||
// Place MCP tools in every provider group they belong to, so each server
|
||||
// shows its own tools even when multiple servers share the same tool names.
|
||||
if (tool.kind === 'mcp' && tool.providerIds.length > 1) {
|
||||
for (const providerId of tool.providerIds) {
|
||||
const groupId = `mcp:${providerId}`;
|
||||
let group = groups.get(groupId);
|
||||
if (!group) {
|
||||
const label = serverNames.get(providerId) ?? providerId;
|
||||
group = { id: groupId, label, kind: 'mcp', tools: [] };
|
||||
groups.set(groupId, group);
|
||||
}
|
||||
group.tools.push(tool);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
const groupKey = resolveApprovalToolGroupKey(tool, serverNames, profileNames);
|
||||
let group = groups.get(groupKey.id);
|
||||
if (!group) {
|
||||
|
||||
Reference in New Issue
Block a user