Skip to content

Commit 5c19710

Browse files
authored
fix(MCPServer): correct notification method in RemoveResource() (#262)
1 parent cecf3e0 commit 5c19710

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

server/resource_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func TestMCPServer_RemoveResource(t *testing.T) {
8484
expectedNotifications: 1,
8585
validate: func(t *testing.T, notifications []mcp.JSONRPCNotification, resourcesList mcp.JSONRPCMessage) {
8686
// Check that we received a list_changed notification
87-
assert.Equal(t, "resources/list_changed", notifications[0].Method)
87+
assert.Equal(t, mcp.MethodNotificationResourcesListChanged, notifications[0].Method)
8888

8989
// Verify we now have only one resource
9090
resp, ok := resourcesList.(mcp.JSONRPCResponse)
@@ -133,7 +133,7 @@ func TestMCPServer_RemoveResource(t *testing.T) {
133133
expectedNotifications: 1, // Still sends a notification
134134
validate: func(t *testing.T, notifications []mcp.JSONRPCNotification, resourcesList mcp.JSONRPCMessage) {
135135
// Check that we received a list_changed notification
136-
assert.Equal(t, "resources/list_changed", notifications[0].Method)
136+
assert.Equal(t, mcp.MethodNotificationResourcesListChanged, notifications[0].Method)
137137

138138
// The original resource should still be there
139139
resp, ok := resourcesList.(mcp.JSONRPCResponse)

server/server.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ func (s *MCPServer) RemoveResource(uri string) {
341341

342342
// Send notification to all initialized sessions if listChanged capability is enabled
343343
if s.capabilities.resources != nil && s.capabilities.resources.listChanged {
344-
s.SendNotificationToAllClients("resources/list_changed", nil)
344+
s.SendNotificationToAllClients(mcp.MethodNotificationResourcesListChanged, nil)
345345
}
346346
}
347347

0 commit comments

Comments
 (0)