File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -421,11 +421,11 @@ func (s *MCPServer) AddResource(
421421 }
422422
423423 s .resourcesMu .Lock ()
424- defer s .resourcesMu .Unlock ()
425424 s .resources [resource .URI ] = resourceEntry {
426425 resource : resource ,
427426 handler : handler ,
428427 }
428+ s .resourcesMu .Unlock ()
429429
430430 // When the list of available resources changes, servers that declared the listChanged capability SHOULD send a notification
431431 if s .capabilities .resources .listChanged {
@@ -466,11 +466,11 @@ func (s *MCPServer) AddResourceTemplate(
466466
467467
468468 s .resourcesMu .Lock ()
469- defer s .resourcesMu .Unlock ()
470469 s .resourceTemplates [template .URITemplate .Raw ()] = resourceTemplateEntry {
471470 template : template ,
472471 handler : handler ,
473472 }
473+ s .resourcesMu .Unlock ()
474474
475475 // When the list of available resources changes, servers that declared the listChanged capability SHOULD send a notification
476476 if s .capabilities .resources .listChanged {
@@ -495,9 +495,9 @@ func (s *MCPServer) AddPrompt(prompt mcp.Prompt, handler PromptHandlerFunc) {
495495 }
496496
497497 s .promptsMu .Lock ()
498- defer s .promptsMu .Unlock ()
499498 s .prompts [prompt .Name ] = prompt
500499 s .promptHandlers [prompt .Name ] = handler
500+ s .promptsMu .Unlock ()
501501
502502 // When the list of available resources changes, servers that declared the listChanged capability SHOULD send a notification.
503503 if s .capabilities .prompts .listChanged {
You can’t perform that action at this time.
0 commit comments