Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 21, 2025

The Tools & Integrations panel and Active Tools indicator become difficult to use with 20+ tools, making navigation cumbersome and reducing available chat input space.

Changes

Collapsible Server Sections

  • Each server now has a chevron icon to toggle collapse/expand state
  • Collapsed servers show only name, description, and item count
  • Expanded servers show full tool/prompt list (existing behavior)
  • State tracked per-server, allowing mixed collapsed/expanded views

Compact Active Tools Display

  • Shows first 3 active tools by default when >3 are enabled
  • "+N more" button expands to show all tools
  • "Show less" button returns to compact view

Test MCP Server (many_tools_demo)

  • Created test server with 64 dynamically generated tools to validate UI improvements
  • Categories: data (10), analytics (10), file (8), network (8), system (8), database (8), security (6), report (6)
  • Added to config/overrides/mcp.json for testing extreme cases

Implementation

ToolsPanel.jsx:

const [collapsedServers, setCollapsedServers] = useState(new Set())

// In server rendering:
<button onClick={() => toggleServerCollapse(server.server)}>
  {isCollapsed ? <ChevronRight /> : <ChevronDown />}
</button>
{!isCollapsed && (
  // Tools and prompts display
)}

EnabledToolsIndicator.jsx:

const COMPACT_THRESHOLD = 3
const shouldShowCompact = allTools.length > COMPACT_THRESHOLD
const displayTools = shouldShowCompact && !isExpanded 
  ? allTools.slice(0, COMPACT_THRESHOLD) 
  : allTools

Screenshots

Before - 16 Tools:

After - 64-Tool Server Expanded:

After - 64-Tool Server Collapsed:

Active Tools - Compact View (65 tools, +62 more):

[!WARNING]

Original prompt

This section details on the original issue you should resolve

<filter_complete></filter_complete>

<issue_title>servers with large numbers of mcp tools makes the ui difficult to use</issue_title>
<issue_description>The crowding of the tools and integrations panel.

Also, if load many tools (20+) then the chat bar is crowded.

</issue_description>

Comments on the Issue (you are @copilot in this section)

Original prompt

This section details on the original issue you should resolve

<issue_title>servers with large numbers of mcp tools makes the ui difficult to use</issue_title>
<issue_description>The crowding of the tools and integrations panel.

Also, if load many tools (20+) then the chat bar is crowded.

</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Fix UI crowding in tools and integrations panel Add collapsible servers and compact tool display to reduce UI crowding Nov 21, 2025
Copilot AI requested a review from garland3 November 21, 2025 23:58
Copilot finished work on behalf of garland3 November 21, 2025 23:58
@garland3
Copy link
Collaborator

You should make a new mcp server with 50+ tools. perhaps use some loop strategy to not need to hard code each one. Add to the mpc.json. Then take a screen shot to replicate the problem.
This will help with understanding if the bugs are fixed.

@garland3
Copy link
Collaborator

@copilot You should make a new mcp server with 50+ tools. perhaps use some loop strategy to not need to hard code each one. Add to the mpc.json. Then take a screen shot to replicate the problem.
This will help with understanding if the bugs are fixed.

Copy link
Contributor Author

Copilot AI commented Nov 22, 2025

@copilot You should make a new mcp server with 50+ tools. perhaps use some loop strategy to not need to hard code each one. Add to the mpc.json. Then take a screen shot to replicate the problem.
This ...

Created a test MCP server with 64 tools and added it to mcp.json (commit 3ce3cbc).

With 64-tool server expanded - Shows the problem without collapsing:
Expanded 64 tools

With 64-tool server collapsed - Demonstrates the fix:
Collapsed 64 tools

Active Tools with 65 enabled - Shows compact view (+62 more):
Active tools compact

The collapsible servers and compact Active Tools indicator both work well with large tool counts.

Copilot finished work on behalf of garland3 November 22, 2025 00:15
@garland3
Copy link
Collaborator

garland3 commented Nov 22, 2025

image confirmed this is working. @sahiltyagi4

@github-actions
Copy link

🔒 Security Scan Results

Security Scan Summary

Scan Results

Python SAST (Bandit)

⚠️ Security issues found in Python code

Recommendations

  • Review all SARIF files uploaded to GitHub Security tab
  • Address high and critical severity vulnerabilities immediately
  • Run npm audit fix and pip-audit locally to fix dependencies
  • Consider implementing additional security controls

…t threshold

- Added many_tools_demo (64 tools demo) to config/defaults/mcp.json to make it available by default for testing UI scalability with large tool sets
- Removed it from config/overrides/mcp.json
- Increased COMPACT_THRESHOLD from 3 to 5 in EnabledToolsIndicator.jsx to better accommodate displaying many tools in compact view when collapsed
@garland3 garland3 marked this pull request as ready for review November 22, 2025 04:12
Copilot AI review requested due to automatic review settings November 22, 2025 04:12
@garland3 garland3 merged commit a4a5f0f into main Nov 22, 2025
6 checks passed
@garland3 garland3 deleted the copilot/improve-ui-for-tools-panel branch November 22, 2025 04:13
Copilot finished reviewing on behalf of garland3 November 22, 2025 04:14
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses UI crowding issues when working with many MCP tools by introducing collapsible server sections and compact active tools display. The changes allow users to manage 20+ tools more effectively by reducing visual clutter in both the Tools & Integrations panel and the chat input area.

Key Changes:

  • Collapsible server sections with per-server expand/collapse state tracking
  • Compact active tools indicator showing first 5 tools with "+N more" expansion
  • Test MCP server (many_tools_demo) with 64 tools to validate UI scalability

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
frontend/src/components/ToolsPanel.jsx Adds collapsible server functionality with chevron icons, item counts, and conditional tool/prompt rendering based on collapse state
frontend/src/components/EnabledToolsIndicator.jsx Implements compact display mode showing first 5 active tools with expandable "+N more" button
backend/mcp/many_tools_demo/main.py Creates test server with 64 dynamically generated tools across 8 categories for UI stress testing
config/defaults/mcp.json Registers many_tools_demo server with compliance level and descriptive metadata
config/overrides/mcp.json Formatting cleanup (extra blank line removed)
Comments suppressed due to low confidence (2)

frontend/src/components/ToolsPanel.jsx:22

  • Unused variable setSinglePrompt.
  setSinglePrompt,

frontend/src/components/ToolsPanel.jsx:99

  • Unused variable selectedPromptInfo.
  const selectedPromptInfo = (() => {

Comment on lines +27 to +46
for category, count, description_base in TOOL_CATEGORIES:
for i in range(1, count + 1):
tool_name = f"{category}_operation_{i}"
tool_description = f"{description_base} - Operation {i}"

# Use exec to create properly named functions
exec(f"""
@mcp.tool()
def {tool_name}(input_data: str = "default") -> str:
'''
{tool_description}
Args:
input_data: Input data to process
Returns:
str: Result of the operation
'''
return f"Executed {tool_name} with input: {{input_data}}"
""")
Copy link

Copilot AI Nov 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using exec() to dynamically create functions is a security risk and violates codebase security practices. The code-executor server explicitly forbids exec() for safety reasons (see backend/mcp/code-executor/main.py line 191).

Instead, define a factory function that creates closures or use partial functions. For example:

def create_tool_function(category: str, i: int, description_base: str):
    def tool_func(input_data: str = "default") -> str:
        f'''
        {description_base} - Operation {i}
        
        Args:
            input_data: Input data to process
            
        Returns:
            str: Result of the operation
        '''
        tool_name = f"{category}_operation_{i}"
        return f"Executed {tool_name} with input: {input_data}"
    
    tool_func.__name__ = f"{category}_operation_{i}"
    tool_func.__doc__ = f"{description_base} - Operation {i}\n\nArgs:\n    input_data: Input data to process\n\nReturns:\n    str: Result of the operation"
    return tool_func

for category, count, description_base in TOOL_CATEGORIES:
    for i in range(1, count + 1):
        tool_func = create_tool_function(category, i, description_base)
        mcp.tool()(tool_func)

This approach is safer and more maintainable.

Suggested change
for category, count, description_base in TOOL_CATEGORIES:
for i in range(1, count + 1):
tool_name = f"{category}_operation_{i}"
tool_description = f"{description_base} - Operation {i}"
# Use exec to create properly named functions
exec(f"""
@mcp.tool()
def {tool_name}(input_data: str = "default") -> str:
'''
{tool_description}
Args:
input_data: Input data to process
Returns:
str: Result of the operation
'''
return f"Executed {tool_name} with input: {{input_data}}"
""")
def create_tool_function(category: str, i: int, description_base: str):
tool_name = f"{category}_operation_{i}"
tool_description = f"{description_base} - Operation {i}"
def tool_func(input_data: str = "default") -> str:
'''
{tool_description}
Args:
input_data: Input data to process
Returns:
str: Result of the operation
'''
return f"Executed {tool_name} with input: {input_data}"
tool_func.__name__ = tool_name
tool_func.__doc__ = f"{tool_description}\n\nArgs:\n input_data: Input data to process\n\nReturns:\n str: Result of the operation"
return tool_func
for category, count, description_base in TOOL_CATEGORIES:
for i in range(1, count + 1):
tool_func = create_tool_function(category, i, description_base)
mcp.tool()(tool_func)

Copilot uses AI. Check for mistakes.
if (allTools.length === 0) return null

// Threshold for showing compact view
const COMPACT_THRESHOLD = 5
Copy link

Copilot AI Nov 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The COMPACT_THRESHOLD value is inconsistent with the PR description. The description states "Shows first 3 active tools by default when >3 are enabled" but the code uses COMPACT_THRESHOLD = 5.

Please update either the code to use 3 or the PR description to match the actual implementation of 5.

Suggested change
const COMPACT_THRESHOLD = 5
const COMPACT_THRESHOLD = 3

Copilot uses AI. Check for mistakes.
import { X, Trash2, Search, Plus, Wrench, Shield, Info } from 'lucide-react'
import { X, Trash2, Search, Plus, Wrench, Shield, Info, ChevronDown, ChevronRight } from 'lucide-react'
import { useNavigate } from 'react-router-dom'
import { useState, useEffect } from 'react'
Copy link

Copilot AI Nov 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import useEffect.

Suggested change
import { useState, useEffect } from 'react'
import { useState } from 'react'

Copilot uses AI. Check for mistakes.
@github-actions
Copy link

🔒 Security Scan Results

Security Scan Summary

Scan Results

Python SAST (Bandit)

⚠️ Security issues found in Python code

Recommendations

  • Review all SARIF files uploaded to GitHub Security tab
  • Address high and critical severity vulnerabilities immediately
  • Run npm audit fix and pip-audit locally to fix dependencies
  • Consider implementing additional security controls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

servers with large numbers of mcp tools makes the ui difficult to use

2 participants