Skip to content

Commit 78afac9

Browse files
committed
Address review comments
Signed-off-by: Christian Tzolov <[email protected]>
1 parent 9e5b2a5 commit 78afac9

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

auto-configurations/spring-ai-mcp-client/src/main/java/org/springframework/ai/autoconfigure/mcp/client/McpClientAutoConfiguration.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,18 @@
110110
matchIfMissing = true)
111111
public class McpClientAutoConfiguration {
112112

113+
/**
114+
* Create a dynamic client name based on the client name and the name of the server
115+
* connection.
116+
* @param clientName the client name as defined by the configuration
117+
* @param serverConnectionName the name of the server connection being used by the
118+
* client
119+
* @return the connected client name
120+
*/
121+
private String connectedClientName(String clientName, String serverConnectionName) {
122+
return clientName + " - " + serverConnectionName;
123+
}
124+
113125
/**
114126
* Creates a list of {@link McpSyncClient} instances based on the available
115127
* transports.
@@ -145,7 +157,8 @@ public List<McpSyncClient> mcpSyncClients(McpSyncClientConfigurer mcpSyncClientC
145157
for (NamedClientMcpTransport namedTransport : namedTransports) {
146158

147159
McpSchema.Implementation clientInfo = new McpSchema.Implementation(
148-
commonProperties.getName() + " - " + namedTransport.name(), commonProperties.getVersion());
160+
this.connectedClientName(commonProperties.getName(), namedTransport.name()),
161+
commonProperties.getVersion());
149162

150163
McpClient.SyncSpec syncSpec = McpClient.sync(namedTransport.transport())
151164
.clientInfo(clientInfo)
@@ -257,7 +270,8 @@ public List<McpAsyncClient> mcpAsyncClients(McpAsyncClientConfigurer mcpSyncClie
257270
for (NamedClientMcpTransport namedTransport : namedTransports) {
258271

259272
McpSchema.Implementation clientInfo = new McpSchema.Implementation(
260-
commonProperties.getName() + " - " + namedTransport.name(), commonProperties.getVersion());
273+
this.connectedClientName(commonProperties.getName(), namedTransport.name()),
274+
commonProperties.getVersion());
261275

262276
McpClient.AsyncSpec syncSpec = McpClient.async(namedTransport.transport())
263277
.clientInfo(clientInfo)

0 commit comments

Comments
 (0)