File tree 2 files changed +3
-6
lines changed
2 files changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -492,7 +492,7 @@ func (s *MCPServer) AddTools(tools ...ServerTool) {
492
492
// SetTools replaces all existing tools with the provided list
493
493
func (s * MCPServer ) SetTools (tools ... ServerTool ) {
494
494
s .toolsMu .Lock ()
495
- s .tools = make (map [string ]ServerTool )
495
+ s .tools = make (map [string ]ServerTool , len ( tools ) )
496
496
s .toolsMu .Unlock ()
497
497
s .AddTools (tools ... )
498
498
}
@@ -714,7 +714,7 @@ func (s *MCPServer) handleReadResource(
714
714
matched = true
715
715
matchedVars := template .URITemplate .Match (request .Params .URI )
716
716
// Convert matched variables to a map
717
- request .Params .Arguments = make (map [string ]interface {})
717
+ request .Params .Arguments = make (map [string ]interface {}, len ( matchedVars ) )
718
718
for name , value := range matchedVars {
719
719
request .Params .Arguments [name ] = value .V
720
720
}
Original file line number Diff line number Diff line change @@ -179,10 +179,7 @@ func NewSSEServer(server *MCPServer, opts ...SSEOption) *SSEServer {
179
179
180
180
// NewTestServer creates a test server for testing purposes
181
181
func NewTestServer (server * MCPServer , opts ... SSEOption ) * httptest.Server {
182
- sseServer := NewSSEServer (server )
183
- for _ , opt := range opts {
184
- opt (sseServer )
185
- }
182
+ sseServer := NewSSEServer (server , opts ... )
186
183
187
184
testServer := httptest .NewServer (sseServer )
188
185
sseServer .baseURL = testServer .URL
You can’t perform that action at this time.
0 commit comments