Skip to content
This repository was archived by the owner on Jun 29, 2025. It is now read-only.

Commit 53f12d5

Browse files
committed
Use url.JoinPath to build fullURL and handle errors
1 parent 63712e9 commit 53f12d5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pkg/openapi2mcp/register.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1121,7 +1121,10 @@ func RegisterOpenAPITools(server *mcpserver.MCPServer, ops []OpenAPIOperation, d
11211121
}
11221122
// Pick a random baseURL for each call using the global rand
11231123
baseURL := baseURLs[rand.Intn(len(baseURLs))]
1124-
fullURL := baseURL + path
1124+
fullURL, err := url.JoinPath(baseURL, path)
1125+
if err != nil {
1126+
return nil, err
1127+
}
11251128
if len(query) > 0 {
11261129
fullURL += "?" + query.Encode()
11271130
}

0 commit comments

Comments
 (0)