feat: add list-tools command for standalone tool discovery#1
Conversation
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 <noreply@anthropic.com>
- 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 <noreply@anthropic.com>
There was a problem hiding this comment.
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-toolssubcommand with tool filtering capabilities via--enabled-toolsand--disabled-toolsoptions - 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)); |
There was a problem hiding this comment.
Using non-null assertion operator (!) is risky here. Consider using optional chaining or a proper null check since the condition already verifies enabledTools exists.
| tools = tools.filter((tool: Tool) => config.enabledTools!.includes(tool.name)); | |
| tools = tools.filter((tool: Tool) => config.enabledTools.includes(tool.name)); |
| 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)); |
There was a problem hiding this comment.
Using non-null assertion operator (!) is risky here. Consider using optional chaining or a proper null check since the condition already verifies disabledTools exists.
| tools = tools.filter((tool: Tool) => !config.disabledTools!.includes(tool.name)); | |
| tools = tools.filter((tool: Tool) => !config.disabledTools.includes(tool.name)); |
| return; // Exit successfully | ||
| } | ||
| } catch { | ||
| // Continue reading if this line wasn't valid JSON |
There was a problem hiding this comment.
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.
| // 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`); |
Summary
list-toolscommand that enables standalone tool discovery without starting a proxy serverChanges
Core Functionality
Modified
src/cli.ts: Added comprehensive list-tools command functionality including:parseListToolsArguments()function for handling list-tools specific argument parsinglistTools()function that connects to target MCP servers, retrieves available tools, and applies filteringlist-toolsas a subcommand--enabled-toolsand--disabled-toolsfiltering options in list-tools modeModified
src/types.ts: ExtendedProxyConfigtype with optionalmodefield to distinguish between proxy and list-tools operationsTest Coverage
tests/list-tools.test.ts: Complete test suite covering:--enabled-toolsand--disabled-toolsoptionsUsage Examples
Test Plan
🤖 Generated with Claude Code