@@ -199,7 +199,7 @@ func TestMCPServer_Tools(t *testing.T) {
199199 },
200200 expectedNotifications : 1 ,
201201 validate : func (t * testing.T , notifications []mcp.JSONRPCNotification , toolsList mcp.JSONRPCMessage ) {
202- assert .Equal (t , "notifications/tools/list_changed" , notifications [0 ].Method )
202+ assert .Equal (t , mcp . MethodNotificationToolsListChanged , notifications [0 ].Method )
203203 tools := toolsList .(mcp.JSONRPCResponse ).Result .(mcp.ListToolsResult ).Tools
204204 assert .Len (t , tools , 2 )
205205 assert .Equal (t , "test-tool-1" , tools [0 ].Name )
@@ -241,7 +241,7 @@ func TestMCPServer_Tools(t *testing.T) {
241241 expectedNotifications : 5 ,
242242 validate : func (t * testing.T , notifications []mcp.JSONRPCNotification , toolsList mcp.JSONRPCMessage ) {
243243 for _ , notification := range notifications {
244- assert .Equal (t , "notifications/tools/list_changed" , notification .Method )
244+ assert .Equal (t , mcp . MethodNotificationToolsListChanged , notification .Method )
245245 }
246246 tools := toolsList .(mcp.JSONRPCResponse ).Result .(mcp.ListToolsResult ).Tools
247247 assert .Len (t , tools , 2 )
@@ -269,8 +269,8 @@ func TestMCPServer_Tools(t *testing.T) {
269269 },
270270 expectedNotifications : 2 ,
271271 validate : func (t * testing.T , notifications []mcp.JSONRPCNotification , toolsList mcp.JSONRPCMessage ) {
272- assert .Equal (t , "notifications/tools/list_changed" , notifications [0 ].Method )
273- assert .Equal (t , "notifications/tools/list_changed" , notifications [1 ].Method )
272+ assert .Equal (t , mcp . MethodNotificationToolsListChanged , notifications [0 ].Method )
273+ assert .Equal (t , mcp . MethodNotificationToolsListChanged , notifications [1 ].Method )
274274 tools := toolsList .(mcp.JSONRPCResponse ).Result .(mcp.ListToolsResult ).Tools
275275 assert .Len (t , tools , 2 )
276276 assert .Equal (t , "test-tool-1" , tools [0 ].Name )
@@ -294,9 +294,9 @@ func TestMCPServer_Tools(t *testing.T) {
294294 expectedNotifications : 2 ,
295295 validate : func (t * testing.T , notifications []mcp.JSONRPCNotification , toolsList mcp.JSONRPCMessage ) {
296296 // One for SetTools
297- assert .Equal (t , "notifications/tools/list_changed" , notifications [0 ].Method )
297+ assert .Equal (t , mcp . MethodNotificationToolsListChanged , notifications [0 ].Method )
298298 // One for DeleteTools
299- assert .Equal (t , "notifications/tools/list_changed" , notifications [1 ].Method )
299+ assert .Equal (t , mcp . MethodNotificationToolsListChanged , notifications [1 ].Method )
300300
301301 // Expect a successful response with an empty list of tools
302302 resp , ok := toolsList .(mcp.JSONRPCResponse )
@@ -312,7 +312,7 @@ func TestMCPServer_Tools(t *testing.T) {
312312 for _ , tt := range tests {
313313 t .Run (tt .name , func (t * testing.T ) {
314314 ctx := context .Background ()
315- server := NewMCPServer ("test-server" , "1.0.0" )
315+ server := NewMCPServer ("test-server" , "1.0.0" , WithToolCapabilities ( true ) )
316316 _ = server .HandleMessage (ctx , []byte (`{
317317 "jsonrpc": "2.0",
318318 "id": 1,
@@ -929,7 +929,7 @@ func TestMCPServer_HandleUndefinedHandlers(t *testing.T) {
929929 "uri": "undefined-resource"
930930 }
931931 }` ,
932- expectedErr : mcp .INVALID_PARAMS ,
932+ expectedErr : mcp .RESOURCE_NOT_FOUND ,
933933 validateCallbacks : func (t * testing.T , err error , beforeResults beforeResult ) {
934934 assert .Equal (t , mcp .MethodResourcesRead , beforeResults .method )
935935 assert .True (t , errors .Is (err , ErrResourceNotFound ))
0 commit comments