You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: seps/2084-primitive-groups.md
+54-43Lines changed: 54 additions & 43 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,60 +23,35 @@ Groups are named collections of MCP primitives: tools, prompts, resources, tasks
23
23
- A server with many tools could separate them by functionality such as "Pull Requests", "Issues", "Actions".
24
24
- A server with various reference programming resources could separate them by language, like "Python", "TypeScript, and "Kotlin".
25
25
26
-
#### Groups are overlapping sets NOT hierarchies
27
-
28
-
- Primitives can belong to multiple groups; for instance, if tools are grouped by use case, a `spell_check` tool might appear in both `compose_email` and `compose_document` groups.
29
-
- Since groups are a primitive, they may belong to multiple groups, and so the result is **not a hierarchy** but rather, potentially overlapping sets.
30
-
- Server developers should take care to avoid cyclic graphs — e.g., a group belonging to itself or to a child.
31
-
32
-
#### Transitivity
33
-
34
-
- Primitive A is in group B. Group B is in group C. Is primitive A implicitly in group C also?
35
-
- The Transitivity of groups is a matter of client interpretation.
36
-
- In the TypeScript reference implementation, the `communications` group contains `email` and `calendar` groups.
37
-
- When listing the primitives in the `communications` group, I chose to have it display the contents of both children.
38
-
- So `email_thank_contributor` would appear in both `email` and `communications`.
39
-
- Some clients might wish to only show direct children of a group.
40
-
- If a server contained cyclic graphs, configuring the client to only show the direct children of a group would short circuit the graph traversal, unless the group contains itself as a direct child, which would be an obvious mistake on the server developer's part that would likely never happen in production.
41
-
42
-
#### Visibility of Groups to LLMs
43
-
44
-
- Groups are simply an organizational tool available to the server developer.
45
-
- It is up to clients to decide how to interpret and make use of them, e.g., for deciding what primitives to expose to LLMs or simply ignoring them.
46
-
- Server developers cannot expect that clients will pass any group information to LLMs, although they may.
47
-
48
26
### Why use Groups?
49
27
50
-
Organizing a server's primitives by functionality or use case enables richer client workflows, wherein certain operations or settings can be applied to multiple primitives concurrently. Some use cases [identified by the community](https://github.com/modelcontextprotocol/modelcontextprotocol/discussions/1772) include:
28
+
Organizing a server's primitives by functionality or use case enables richer client workflows, wherein certain operations or settings to be applied to multiple primitives concurrently:
51
29
52
-
#### Client-Side & User Organization
30
+
-**Client-side filtering:** Client UIs could display a list of groups and allow users to select/deselect groups to interact with or ignore. Primitives from deselected groups would not be presented to the LLM.
31
+
-**Agentic control:** In-addition to human-affordances, clients can offer agents special tools which enable the LLM to dynamically enable / disable specific groups.
32
+
-**Simplify server instructions:** When describing how to use various primitives in a server, the instructions could refer to them by group name rather than exhaustive lists.
53
33
54
-
-**Client-side Filtering:** Client UIs could display a list of groups and allow users to select/deselect specific groups to interact with or ignore. Primitives from deselected groups would not be presented to the LLM.
34
+
The [appendix](#community-identified-use-cases) described many other use cases [identified by the community](https://github.com/modelcontextprotocol/modelcontextprotocol/discussions/1772).
55
35
56
-
-**Library Management:** Enabling users to create and manage organized Prompt and Resource libraries that can be shared or reused across different sessions.
36
+
It is up to clients to decide how to interpret and use groups, and if grouping semantics are exposed to the LLMs are not.
57
37
58
-
-**Presentation and Search:** Improving how humans and AI models look up and discover tools. Grouping helps organize the interface so that relevant tools are easier to find among hundreds of options.
38
+
## Protocol Considerations
59
39
60
-
-**Workflow-Specific Context:** Providing a model with a "set" of tools and tasks specifically curated for a particular workflow, rather than overwhelming it with every available primitive.
40
+
#### New Primitive or Extension?
61
41
62
-
#### Server-Side & Architectural Patterns
42
+
Groups are implemented as new MCP primitive, alongside the existing ones (i.e., tools, resources, prompts, and tasks). The new primitive will have a similar schema, list method, and list changed notification. Additionally, all MCP primitives, including groups, use a new reserved `_meta` key to list the groups to which they belong. An alternative proposal for implementing groups as an extension over existing primitives was disregarded since it was considered unintuitive.
63
43
64
-
-**Gateway Facades:** Using a Gateway Server to wrap various backend services (REST APIs, databases, or legacy systems) into a single cohesive facade. For example, a group might dynamically expose a mix of tools from different MCP servers, APIs, REST services, etc.
44
+
#### Membership Constraints
65
45
66
-
-**Dynamic Orchestration:** Supporting the ability to add or remove groups and tools without restarting the server, which is essential for high-availability gateway environments.
67
-
68
-
-**Task Management:** Grouping the new Task primitive alongside tools and prompts to manage long-running workflows, sequencing, and concurrency.
46
+
This SEP recommends flexible grouping membership given diversity in potential use-cases:
69
47
70
-
#### Governance & Development Lifecycle
71
-
72
-
-**Governance and Security:** Providing a standardized mechanism for server-side governance of who can access specific sets of tools and resources.
73
-
74
-
-**Ecosystem Tooling:** Supporting broader developer workflows such as debugging, automated testing, and documentation by grouping related diagnostic tools together.
48
+
1. Primitives **can** belong to multiple groups. This is crucial for key use-cases e.g., if grouping tools by specfic workflows, a `spell_check` tool might appear in both `compose_email` and `compose_document` groups.
49
+
2. Groups **may** belong to multiple groups. This results in overlapping sets, not a rigid **not a hierarchy**.
50
+
3. Clients **may** interpret transitive relationships based on their specific use-cases (see [reference implementation](#transitity-example)).
51
+
4. Although servers are responsible for avoiding invalid groupings such as self or cyclic memberships, SDKs can help. We argue the maintenance overhead would be modest and consider it acceptable for the additional flexibility, since such features are already implemented in most language compilers / interpreters.
75
52
76
53
## Specification
77
54
78
-
**Recommendation:** Groups are implemented as new MCP primitive, alongside the existing ones (i.e., tools, resources, prompts, and tasks). The new primitive will have a similar schema, list method, and list changed notification. Additionally, all MCP primitives, including groups, use a new reserved `_meta` key to list the groups to which they belong.
79
-
80
55
### Capability
81
56
82
57
Servers that support groups MUST declare the capability during initialization, including whether list change notifications are supported. Group lists can change at runtime, and so support for listChanged notifications for each is included.
@@ -254,9 +229,7 @@ This specification proposal was selected for its ease of understanding since it
254
229
255
230
## Security Implications
256
231
257
-
No serious implications identified.
258
-
259
-
We do wish to point out that use of groups for controlling access to a set of primitives, while a stated use case, could have security implications if groups change dynamically.
232
+
No new implications identified. Offering group information to LLMs presents challenges similar to other primitives, and if servers use groups for access control, that might raise additional implications.
260
233
261
234
## Reference Implementation
262
235
@@ -267,8 +240,46 @@ The reference implementation's example client and server demonstrate how groups,
267
240
268
241
Note: Tasks are not included in the example as they are ephemeral, but the SDK changes do support grouping of tasks.
269
242
243
+
### Transitivity Example
244
+
- In the TypeScript reference implementation, the `communications` group contains `email` and `calendar` groups.
245
+
- When listing the primitives in the `communications` group, it displays the contents of both children.
246
+
- So `email_thank_contributor` would appear in both `email` and `communications`.
247
+
- Some clients might wish to only show direct children of a group.
248
+
<!-- If a server contained cyclic graphs, configuring the client to only show the direct children of a group would short circuit the graph traversal, unless the group contains itself as a direct child, which would be an obvious mistake on the server developer's part that would likely never happen in production. -->
249
+
250
+
270
251
## Acknowledgements
271
252
272
253
-@cliffhall and @chughtapan thank @patwhite for his earlier work on [SEP-1300](https://github.com/modelcontextprotocol/modelcontextprotocol/issues/1300) where a version of this grouping approach was first proposed.
273
254
- And thanks to @scottslewis for rounding up [use cases](https://github.com/modelcontextprotocol/modelcontextprotocol/discussions/1772) for grouping and providing input on alternative implementations.
274
255
- Thanks also to @bdoyle0182, @LucaButBoring, and @SamMorrowDrums for providing feedback and opinions in Discord and meetings.
256
+
257
+
## Appendix
258
+
259
+
### Community Identified Use-Cases
260
+
261
+
Additional use cases [identified by the community](https://github.com/modelcontextprotocol/modelcontextprotocol/discussions/1772) include:
262
+
263
+
#### Client-Side & User Organization
264
+
265
+
-**Client-side Filtering:** Client UIs could display a list of groups and allow users to select/deselect specific groups to interact with or ignore. Primitives from deselected groups would not be presented to the LLM.
266
+
267
+
-**Library Management:** Enabling users to create and manage organized Prompt and Resource libraries that can be shared or reused across different sessions.
268
+
269
+
-**Presentation and Search:** Improving how humans and AI models look up and discover tools. Grouping helps organize the interface so that relevant tools are easier to find among hundreds of options.
270
+
271
+
-**Workflow-Specific Context:** Providing a model with a "set" of tools and tasks specifically curated for a particular workflow, rather than overwhelming it with every available primitive.
272
+
273
+
#### Server-Side & Architectural Patterns
274
+
275
+
-**Gateway Facades:** Using a Gateway Server to wrap various backend services (REST APIs, databases, or legacy systems) into a single cohesive facade. For example, a group might dynamically expose a mix of tools from different MCP servers, APIs, REST services, etc.
276
+
277
+
-**Dynamic Orchestration:** Supporting the ability to add or remove groups and tools without restarting the server, which is essential for high-availability gateway environments.
278
+
279
+
-**Task Management:** Grouping the new Task primitive alongside tools and prompts to manage long-running workflows, sequencing, and concurrency.
280
+
281
+
#### Governance & Development Lifecycle
282
+
283
+
-**Governance and Security:** Providing a standardized mechanism for server-side governance of who can access specific sets of tools and resources.
284
+
285
+
-**Ecosystem Tooling:** Supporting broader developer workflows such as debugging, automated testing, and documentation by grouping related diagnostic tools together.
0 commit comments