Skip to content

Add filtering for MCP tool list - #1108

Open
Kehrlann wants to merge 1 commit into
mainfrom
dgarnier/tool-filters
Open

Add filtering for MCP tool list#1108
Kehrlann wants to merge 1 commit into
mainfrom
dgarnier/tool-filters

Conversation

@Kehrlann

Copy link
Copy Markdown
Contributor

Context

The SDK lacks capabilities for dynamically returning tools, resources, prompts, etc (see #578).

A full implementation in the current state (2.x, 2025-11-25) spec would be complex, as it'd need to target [sync | async] x [stateful | stateless] = 4 variants. We'd need to address the bridges between sync and async, make it coexist with current server's tool management (array list of tools, .addTool method).

We are currently focusing on the implementation of the 2026-07-28 spec, which will bring an entirely new, breaking API. It would be a perfect opportunity to bring in repositories as described in #578 .

In the meantime, we recognize users have been asking for capabilities for a long time. The majority of the asks are centered around filtering the list of tools (#997 , #525, examples in #593, #746, #608, etc). While we recognize there are other asks (dynamic tool generation, other primitives than tools), we think they'd be better addressed by a full #578 implementation. In the meantime, we decided exposing filter capabilities for tools, in this PR.

Scope

This PR is focused on tool list filtering only, while opening the door for filtering other resources if necessary. It addresses filtering in every variant mentioned above.

⚠️⚠️ The filtering only applies to tools listing. It does NOT apply to tool calling, as this can already be achieved in the tool handler. Similarly, it does NOT apply to notifications/tools/list_changed notifications, as these notifications are session-scoped, and not request-scoped. It is recommended that you DO NOT use notifications when using filters.

Closes #997
Closes #525 (with caveats, the main discussion is in #578)
Closes #593 (with caveats, the main discussion is in #578)

@Kehrlann
Kehrlann marked this pull request as ready for review August 26, 2026 11:26
@Kehrlann
Kehrlann requested a review from tzolov August 26, 2026 11:26
@Kehrlann Kehrlann added enhancement New feature or request area/server labels Aug 26, 2026
Signed-off-by: Daniel Garnier-Moiroux <git@garnier.wf>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/server enhancement New feature or request

Projects

None yet

1 participant