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
The TypeScript SDK automatically sends `list_changed` notifications when tools are enabled or disabled. To avoid over-sending notifications, you should check whether the tool is already enabled or disabled before enabling or disabling it.
`list_changed` will be batched to avoid sending too many notifications.
53
-
</callout-info>
49
+
#### Example: Resource List Change Notification
50
+
51
+
When new experiment logs become available in the space station's research database:
52
+
53
+
```json filename=server-notification.json nocopy
54
+
{
55
+
"jsonrpc": "2.0",
56
+
"method": "notifications/resources/list_changed"
57
+
}
58
+
```
59
+
60
+
This tells the client that the available resources have changed, prompting it to refresh its resource list and discover new experiment logs.
54
61
55
62
## 2. Resource List Change (Templates and Expansions)
56
63
@@ -81,7 +88,7 @@ ingredientsResource.enable() // or disable()
81
88
82
89
Resources in MCP can be either static (a single file, a database record) or dynamic via **resource templates** (e.g., a directory of files, a database table, or even a set of modules on a space station 🚀). Resource templates allow the server to expose a pattern or collection of resources that can change over time.
83
90
84
-
A `notifications/resources/list_changed` notification is sent when:
91
+
A `notifications/resources/list_changed` notification (like the one in the example above) is sent when:
85
92
86
93
- A new resource template is enabled/disabled
87
94
- The set of expansions for a template changes (e.g., a new module docks, a new experiment log appears, or a file is added to a directory)
@@ -98,7 +105,7 @@ While `list_changed` tells clients about changes in what resources are available
98
105
99
106
A client wants to stay updated on a specific space station module:
100
107
101
-
```json filename="client-request.json" nocopy
108
+
```json filename=client-request.json nocopy
102
109
{
103
110
"jsonrpc": "2.0",
104
111
"id": 1,
@@ -109,7 +116,7 @@ A client wants to stay updated on a specific space station module:
109
116
110
117
When the module's status changes (e.g., a new experiment starts, or the module is undocked), the server sends:
0 commit comments