Skip to content

Conversation

eli0shin
Copy link
Owner

Summary

  • Add new list-tools command that enables standalone tool discovery without starting a proxy server
  • Extend CLI argument parsing to support the new list-tools mode
  • Add comprehensive test coverage for the list-tools functionality
  • Update type definitions to support different operation modes

Changes

Core Functionality

  • Modified src/cli.ts: Added comprehensive list-tools command functionality including:

    • New parseListToolsArguments() function for handling list-tools specific argument parsing
    • New listTools() function that connects to target MCP servers, retrieves available tools, and applies filtering
    • Extended main CLI argument parsing to support list-tools as a subcommand
    • Added support for --enabled-tools and --disabled-tools filtering options in list-tools mode
  • Modified src/types.ts: Extended ProxyConfig type with optional mode field to distinguish between proxy and list-tools operations

Test Coverage

  • Added tests/list-tools.test.ts: Complete test suite covering:
    • Basic tool listing functionality
    • Tool filtering with --enabled-tools and --disabled-tools options
    • Error handling for missing target commands
    • Validation of mutually exclusive filter options
    • Server initialization error handling
    • Command line argument passing to target servers

Usage Examples

# List all available tools from a server
mcp-controller list-tools bun run server.ts

# List only specific tools
mcp-controller list-tools --enabled-tools add,subtract bun run server.ts

# List all tools except specific ones
mcp-controller list-tools --disabled-tools dangerous-tool bun run server.ts

Test Plan

  • All existing tests continue to pass
  • New list-tools command works with basic functionality
  • Tool filtering works correctly with both enabled and disabled tools options
  • Error handling works for invalid arguments and server connection issues
  • Command line arguments are properly passed to target servers
  • Mutually exclusive options are properly validated

🤖 Generated with Claude Code

eli0shin and others added 3 commits August 19, 2025 12:00
Add standalone list-tools command that connects to MCP servers to discover available tools without starting proxy mode. Supports tool filtering via --enabled-tools and --disabled-tools flags.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Add comprehensive CI workflow with testing, linting, and building
- Fix typecheck script from "bun --bun tsc" to "bun tsc"

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@eli0shin eli0shin marked this pull request as ready for review August 19, 2025 16:28
@Copilot Copilot AI review requested due to automatic review settings August 19, 2025 16:28
@eli0shin eli0shin merged commit 1726a38 into main Aug 19, 2025
1 check passed
Copy link

@Copilot 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 adds a new list-tools command that enables standalone tool discovery without starting a proxy server. This allows users to inspect available tools from MCP servers before deciding how to configure the proxy.

Key changes:

  • Add list-tools subcommand with tool filtering capabilities via --enabled-tools and --disabled-tools options
  • Extend CLI argument parsing to handle the new operation mode
  • Add comprehensive test coverage for the new functionality

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
src/cli.ts Implements core list-tools functionality including argument parsing, server communication, and tool filtering
src/types.ts Extends ProxyConfig type with optional mode field to distinguish operation modes
tests/list-tools.test.ts Comprehensive test suite covering all list-tools functionality and edge cases
package.json Minor script update for typecheck command
.github/workflows/ci.yml New CI workflow configuration

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

let tools = response.result.tools || [];

if (config.enabledTools) {
tools = tools.filter((tool: Tool) => config.enabledTools!.includes(tool.name));
Copy link

Copilot AI Aug 19, 2025

Choose a reason for hiding this comment

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

Using non-null assertion operator (!) is risky here. Consider using optional chaining or a proper null check since the condition already verifies enabledTools exists.

Suggested change
tools = tools.filter((tool: Tool) => config.enabledTools!.includes(tool.name));
tools = tools.filter((tool: Tool) => config.enabledTools.includes(tool.name));

Copilot uses AI. Check for mistakes.

if (config.enabledTools) {
tools = tools.filter((tool: Tool) => config.enabledTools!.includes(tool.name));
} else if (config.disabledTools) {
tools = tools.filter((tool: Tool) => !config.disabledTools!.includes(tool.name));
Copy link

Copilot AI Aug 19, 2025

Choose a reason for hiding this comment

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

Using non-null assertion operator (!) is risky here. Consider using optional chaining or a proper null check since the condition already verifies disabledTools exists.

Suggested change
tools = tools.filter((tool: Tool) => !config.disabledTools!.includes(tool.name));
tools = tools.filter((tool: Tool) => !config.disabledTools.includes(tool.name));

Copilot uses AI. Check for mistakes.

return; // Exit successfully
}
} catch {
// Continue reading if this line wasn't valid JSON
Copy link

Copilot AI Aug 19, 2025

Choose a reason for hiding this comment

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

The empty catch block silently ignores all parsing errors. Consider adding a comment explaining why this is intentional or log the error for debugging purposes.

Suggested change
// Continue reading if this line wasn't valid JSON
} catch (err) {
// Continue reading if this line wasn't valid JSON
process.stderr.write(`Warning: Could not parse line as JSON: ${err instanceof Error ? err.message : String(err)}\n`);

Copilot uses AI. Check for mistakes.

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.

1 participant