Skip to content

Paoxiaomooo sync mcp tool callback addmethod #3891

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

paoxiaomooo
Copy link
Contributor

@paoxiaomooo paoxiaomooo commented Jul 23, 2025

This PR introduces server name-based filtering capabilities to AsyncMcpToolCallbackProvider, matching the functionality already present in the synchronous implementation. The changes include:

​​New Constructor​​:
public AsyncMcpToolCallbackProvider(List mcpClients, Set allowedServerNames)

  • Filters clients by allowed server names during initialization
  • aintains existing asynchronous behavior
  • Includes null/empty validation
    ​​New Reactive Utility Method​​:
    public static Flux asyncToolCallbacksByServer(List mcpClients, Set allowedServerNames)
  • Provides end-to-end reactive pipeline for filtered tool discovery
  • Performs duplicate tool name validation
  • Preserves non-blocking characteristics

Why Add Server Filtering?

  1. Selective Tool Discovery – Only fetch tools from specified servers, reducing overhead and improving performance.
  2. Consistent API – Matches the sync version’s functionality, avoiding surprises.
  3. Reactive Efficiency – Built-in non-blocking filtering for cleaner, optimized async flows.
  4. Operational Control – Enables precise server management in multi-server environments.

Before: Manual filtering + duplicate checks.
After: Single-line reactive filtering with validation.
// Cleaner, safer usage
Flux tools = asyncToolCallbacksByServer(clients, allowedServers);

Signed-off-by: Sizhe Fan <132420031+paoxiaomooo@users.noreply.github.com>
Signed-off-by: Sizhe Fan <132420031+paoxiaomooo@users.noreply.github.com>
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