Skip to content

feat: list command enhancements with tool filtering and brief output#62

Open
yuhp wants to merge 8 commits intosteipete:mainfrom
yuhp:feature/list-command-enhancements
Open

feat: list command enhancements with tool filtering and brief output#62
yuhp wants to merge 8 commits intosteipete:mainfrom
yuhp:feature/list-command-enhancements

Conversation

@yuhp
Copy link

@yuhp yuhp commented Feb 6, 2026

Description: Enhance list command with tool filtering and brief output

💡 Motivation

When an MCP server provides a large number of tools, the default list command outputs extensive tool descriptions. This leads to two main issues:

  1. Information Overload: It becomes difficult for users to quickly scan or find specific tools.
  2. LLM Token Waste: When mcporter is used by LLMs to discover tools, providing full descriptions for dozens of irrelevant tools quickly exhausts the context window and increases costs.
    This PR introduces filtering and a --brief mode to allow both users and LLMs to interact with tools more efficiently.

Key Changes

🚀 Features

  • Tool Filtering: Added support for an optional [tool-pattern] positional argument. You can now filter tools by name using simple string matching (e.g., mcporter list context "query*").
  • Brief Output (--brief): Show only tool names, omitting descriptions. This significantly reduces token usage and stdout noise when a server has many tools.
  • Improved Filter Logic: The filter matches against tool names across all listed servers.

🐛 Bug Fixes

  • Ephemeral Server Parsing: Fixed a bug where arguments were incorrectly parsed when using ephemeral servers (e.g., --http-url or --command).

📝 Documentation

  • Updated help text for the list command to reflect new arguments and flags.
  • Updated README.md with examples of tool filtering and brief output.

Examples

Get a concise list of all tool names (Token-efficient):

mcporter list context7 --brief

Filter for specific tool sets:

mcporter list context7 "query-*"

Show full details for only one specific tool:

mcporter list context7 query-docs 
mcporter list context7 query-docs --schema

yuhp added 5 commits February 6, 2026 11:36
Implements --brief flag for concise tool signatures and adds positional argument support for filtering tools by name patterns.
Prioritizes positional argument as tool pattern instead of target name when ephemeral flags (e.g. --http-url) are present.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b0e0e5f877

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +358 to +369
// Handle --brief output mode
if (flags.brief) {
if (metadataEntries.length === 0) {
if (toolPattern) {
console.log(`No tools matching pattern '${toolPattern}'.`);
} else {
console.log('No tools available.');
}
return;
}
printBriefToolList(metadataEntries, { colorize: true });
return;

Choose a reason for hiding this comment

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

P2 Badge Reject or honor --json when --brief is set

When --brief is supplied alongside --json, the handler bypasses JSON output and prints text signatures, then returns early. That breaks callers that rely on --json for machine-readable output (e.g., mcporter list server --json --brief), because the format silently changes to plain text. Either treat --brief as mutually exclusive with --json in extractListFlags, or emit a JSON payload for brief mode so the --json contract is preserved.

Useful? React with 👍 / 👎.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed this by making --brief and --json mutually exclusive in [extractListFlags]. Supplying both will now throw an error with a clear message, ensuring the --json contract isn't silently broken.
I've also updated the following to reflect this change:

  • Help output in [src/cli/list-command.ts]
  • README.md
  • docs/cli-reference.md

@yuhp yuhp changed the title Feature/list command enhancements feat: list command enhancements with tool filtering and brief output Feb 14, 2026
@yuhp
Copy link
Author

yuhp commented Mar 9, 2026

Synced with latest upstream changes
I've merged the latest changes from main into this branch.

  • Resolved conflicts in README.md and package.json.
  • Updated dependencies and fixed some linting/formatting issues introduced during the merge.
  • Verified that all tests are passing.
    Ready for another look!

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