Skip to content

Commit 1632be8

Browse files
committed
Remaining builders and cleanup
Signed-off-by: Dariusz Jędrzejczyk <2554306+chemicL@users.noreply.github.com>
1 parent 8d1f63e commit 1632be8

61 files changed

Lines changed: 2989 additions & 1602 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

conformance-tests/client-jdk-http-client/src/main/java/io/modelcontextprotocol/conformance/client/ConformanceJdkClientMcpClient.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ private static McpSyncClient createClient(String serverUrl) {
8080
HttpClientStreamableHttpTransport transport = HttpClientStreamableHttpTransport.builder(serverUrl).build();
8181

8282
return McpClient.sync(transport)
83-
.clientInfo(new McpSchema.Implementation("test-client", "1.0.0"))
83+
.clientInfo(McpSchema.Implementation.builder("test-client", "1.0.0").build())
8484
.requestTimeout(Duration.ofSeconds(30))
8585
.build();
8686
}
@@ -97,7 +97,7 @@ private static McpSyncClient createClientWithElicitation(String serverUrl) {
9797
var capabilities = McpSchema.ClientCapabilities.builder().elicitation().build();
9898

9999
return McpClient.sync(transport)
100-
.clientInfo(new McpSchema.Implementation("test-client", "1.0.0"))
100+
.clientInfo(McpSchema.Implementation.builder("test-client", "1.0.0").build())
101101
.requestTimeout(Duration.ofSeconds(30))
102102
.capabilities(capabilities)
103103
.elicitation(request -> {
@@ -120,7 +120,7 @@ private static McpSyncClient createClientWithElicitation(String serverUrl) {
120120
}
121121

122122
// Return accept action with the defaults applied
123-
return new McpSchema.ElicitResult(McpSchema.ElicitResult.Action.ACCEPT, content, null);
123+
return McpSchema.ElicitResult.builder(McpSchema.ElicitResult.Action.ACCEPT).content(content).build();
124124
})
125125
.build();
126126
}
@@ -174,7 +174,7 @@ private static void runToolsCallScenario(String serverUrl) throws Exception {
174174
arguments.put("b", 3);
175175

176176
McpSchema.CallToolResult result = client
177-
.callTool(new McpSchema.CallToolRequest("add_numbers", arguments));
177+
.callTool(McpSchema.CallToolRequest.builder("add_numbers").arguments(arguments).build());
178178

179179
System.out.println("Successfully called add_numbers tool");
180180
if (result != null && result.content() != null) {
@@ -219,7 +219,9 @@ private static void runElicitationDefaultsScenario(String serverUrl) throws Exce
219219
var arguments = new java.util.HashMap<String, Object>();
220220

221221
McpSchema.CallToolResult result = client
222-
.callTool(new McpSchema.CallToolRequest("test_client_elicitation_defaults", arguments));
222+
.callTool(McpSchema.CallToolRequest.builder("test_client_elicitation_defaults")
223+
.arguments(arguments)
224+
.build());
223225

224226
System.out.println("Successfully called test_client_elicitation_defaults tool");
225227
if (result != null && result.content() != null) {
@@ -264,8 +266,8 @@ private static void runSSERetryScenario(String serverUrl) throws Exception {
264266
// reconnection
265267
var arguments = new java.util.HashMap<String, Object>();
266268

267-
McpSchema.CallToolResult result = client
268-
.callTool(new McpSchema.CallToolRequest("test_reconnection", arguments));
269+
McpSchema.CallToolResult result = client.callTool(
270+
McpSchema.CallToolRequest.builder("test_reconnection").arguments(arguments).build());
269271

270272
System.out.println("Successfully called test_reconnection tool");
271273
if (result != null && result.content() != null) {

conformance-tests/client-spring-http-client/src/main/java/io/modelcontextprotocol/conformance/client/scenario/DefaultScenario.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public void execute(String serverUrl) {
6969

7070
this.client = McpClient.sync(transport)
7171
.transportContextProvider(new AuthenticationMcpTransportContextProvider())
72-
.clientInfo(new McpSchema.Implementation("test-client", "1.0.0"))
72+
.clientInfo(McpSchema.Implementation.builder("test-client", "1.0.0").build())
7373
.requestTimeout(Duration.ofSeconds(30))
7474
.build();
7575

conformance-tests/client-spring-http-client/src/main/java/io/modelcontextprotocol/conformance/client/scenario/PreRegistrationScenario.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public void execute(String serverUrl) {
6060

6161
var client = McpClient.sync(transport)
6262
.transportContextProvider(new AuthenticationMcpTransportContextProvider())
63-
.clientInfo(new McpSchema.Implementation("test-client", "1.0.0"))
63+
.clientInfo(McpSchema.Implementation.builder("test-client", "1.0.0").build())
6464
.requestTimeout(Duration.ofSeconds(30))
6565
.build();
6666

0 commit comments

Comments
 (0)