Skip to content

Conversation

@wonderwhy-er
Copy link
Owner

@wonderwhy-er wonderwhy-er commented Oct 2, 2025

Summary by CodeRabbit

  • New Features
    • The list of available tools is now tailored to the active client, automatically hiding tools that aren’t applicable. Users will see a cleaner, more relevant set of options, reducing confusion and preventing attempts to use unsupported tools. This dynamic filtering improves clarity across platforms, with the number of available tools adjusted based on context.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 2, 2025

Walkthrough

Implements client-aware filtering of tools in ListToolsRequestHandler by introducing shouldIncludeTool(toolName) that checks currentClient and excludes specific tools (e.g., give_feedback_to_desktop_commander for the desktop-commander client). Replaces a static tools array with filteredTools derived from allTools. Adds debug logging of filtered vs. total tool counts.

Changes

Cohort / File(s) Summary of edits
Client-aware tool filtering in List Tools
src/server.ts
Introduced shouldIncludeTool(toolName) using currentClient to filter allTools; replaced static tools list with filteredTools; added debug log reporting returned vs. total tools for the client context.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant C as Client
    participant S as Server (ListToolsRequestHandler)
    participant R as Tool Registry (allTools)

    Note over C,S: Request available tools
    C->>S: ListTools
    S->>R: Load allTools
    rect rgba(198,225,247,0.3)
    Note right of S: Apply client-aware filter
    S->>S: shouldIncludeTool(toolName)<br/>(checks currentClient)
    S-->>S: filteredTools
    end
    S-->>C: filteredTools + debug log (count info)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Usage stats and feedback clean #171 — Introduces give_feedback_to_desktop_commander and updates tools registration; directly overlaps with this PR’s client-specific tool filtering in src/server.ts.

Poem

A rabbit taps keys with a gentle thrum,
Trims the tools when the clients come.
“Desktop commander? Hold that spade!”
Filters set, the list is made.
Logs burrow deep, counts neatly spun—
Hippity-hop, clean queries run. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly summarizes the main change by indicating that tool filtering is added and specifically that the “give feedback” tool is excluded for the Desktop Commander (DC) client, which matches the PR’s implementation details.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch tool-filtering

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6586aa2 and 6c43c9e.

📒 Files selected for processing (1)
  • src/server.ts (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/server.ts (1)
src/utils/logger.ts (1)
  • logToStderr (71-82)
🔇 Additional comments (3)
src/server.ts (3)

152-165: LGTM! Clean filtering implementation.

The function correctly excludes the feedback tool for the desktop-commander client while maintaining an inclusive default. The optional chaining guards against uninitialized state, and the comment provides clear guidance for future extensions.


172-940: LGTM! Effective two-step filtering approach.

The implementation cleanly separates tool definition from filtering logic. Building allTools first, then deriving filteredTools via the shouldIncludeTool predicate is maintainable and makes the filtering logic explicit and testable.


936-936: LGTM! Helpful debug logging.

The log statement provides clear visibility into the filtering operation, reporting both the filtered count and the original total. The fallback for currentClient?.name ensures the log message remains informative even if client info is unavailable.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@wonderwhy-er wonderwhy-er merged commit d40fbcb into main Oct 2, 2025
2 checks passed
@wonderwhy-er wonderwhy-er deleted the tool-filtering branch October 2, 2025 14:35
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.

2 participants