mcp-connector changedagents-and-tools/mcp-connector
Nearest release: v2.1.309, published 3 hours before this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
Recorded here
Lines+29added
Lines−27removed
From line
1,544
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits34to this page, all time
The whole hunk
from line 1544, old and new numbered
/
from line 1544
15441544
15451545 // Connect to an MCP server
15461546 StdioClientTransport transport = new StdioClientTransport(
1547 ServerParameters.builder("mcp-server").build(), McpJsonDefaults.getMapper());
1547 ServerParameters.builder("mcp-server").build(), McpJsonDefaults.getMapper());
15481548
15491549 try (McpSyncClient mcpClient = McpClient.sync(transport)
15501550 .clientInfo(new McpSchema.Implementation("my-client", "1.0.0"))
from line 1556
15561556 List<McpBetaTool> betaTools = BetaMcp.mcpTools(mcpClient.listTools().tools(), mcpClient);
15571557
15581558 MessageCreateParams params = MessageCreateParams.builder()
1559 .model(Model.CLAUDE_OPUS_5_5)
1560 .maxTokens(1024L)
1561 .addUserMessage("What tools do you have available?")
1562 .addTools(betaTools)
1563 .build();
1559 .model(Model.CLAUDE_OPUS_5_5)
1560 .maxTokens(1024L)
1561 .addUserMessage("What tools do you have available?")
1562 .addTools(betaTools)
1563 .build();
15641564
1565 // The runner yields one message per assistant turn; the last is the final response
1565 // The runner yields one message for each assistant turn; the last is the final response
15661566 BetaToolRunner runner = anthropic.beta().messages().toolRunner(params);
15671567 BetaMessage finalMessage = null;
15681568 for (BetaMessage message : runner) {
from line 1692
16921692
16931693 ```java Java
16941694 McpSchema.GetPromptResult prompt = mcpClient.getPrompt(
1695 new McpSchema.GetPromptRequest("my-prompt", Map.of()));
1695 new McpSchema.GetPromptRequest("my-prompt", Map.of()));
16961696
16971697 BetaMessage response = anthropic.beta().messages().create(MessageCreateParams.builder()
1698 .model(Model.CLAUDE_OPUS_5_5)
1699 .maxTokens(1024L)
1700 .messages(BetaMcp.mcpMessages(prompt.messages()))
1701 .build());
1698 .model(Model.CLAUDE_OPUS_5_5)
1699 .maxTokens(1024L)
1700 .messages(BetaMcp.mcpMessages(prompt.messages()))
1701 .build());
17021702
17031703 IO.println(response);
17041704 ```
from line 1821
18211821 var fileResource = await mcpClient.ReadResourceAsync("file:///path/to/data.json");
18221822 var (filename, data, mediaType) = BetaMcp.ResourceToFile(fileResource);
18231823
1824 // Build the file part explicitly so the resource's filename and MIME type
1824 // Build the file part explicitly so the resource's file name and MIME type
18251825 // carry through to the upload.
18261826 var file = new BinaryContent { Stream = new MemoryStream(data), FileName = filename };
18271827 if (mediaType is not null)
from line 1885
18851885 ```java Java
18861886 // As a content block in a message
18871887 McpSchema.ReadResourceResult resource = mcpClient.readResource(
1888 new McpSchema.ReadResourceRequest("file:///path/to/doc.txt"));
1888 new McpSchema.ReadResourceRequest("file:///path/to/doc.txt"));
18891889
18901890 List<BetaContentBlockParam> content =
1891 new ArrayList<>(BetaMcp.mcpResourceContents(resource));
1891 new ArrayList<>(BetaMcp.mcpResourceContents(resource));
18921892 content.add(BetaContentBlockParam.ofText(
1893 BetaTextBlockParam.builder().text("Summarize this document").build()));
1893 BetaTextBlockParam.builder()
1894 .text("Summarize this document")
1895 .build()));
18941896
18951897 BetaMessage response = anthropic.beta().messages().create(MessageCreateParams.builder()
1896 .model(Model.CLAUDE_OPUS_5_5)
1897 .maxTokens(1024L)
1898 .addUserMessageOfContentBlockParams(content)
1899 .build());
1898 .model(Model.CLAUDE_OPUS_5_5)
1899 .maxTokens(1024L)
1900 .addUserMessageOfContentBlockParams(content)
1901 .build());
19001902
19011903 IO.println(response);
19021904
19031905 // As a file upload
19041906 McpSchema.ReadResourceResult fileResource = mcpClient.readResource(
1905 new McpSchema.ReadResourceRequest("file:///path/to/data.json"));
1907 new McpSchema.ReadResourceRequest("file:///path/to/data.json"));
19061908
19071909 McpResourceFile resourceFile = BetaMcp.mcpResourceFiles(fileResource).getFirst();
19081910
1909 // Build the file part explicitly so the resource's filename and MIME type
1911 // Build the file part explicitly so the resource's file name and MIME type
19101912 // carry through to the upload.
19111913 MultipartField.Builder<InputStream> fileField = MultipartField.<InputStream>builder()
1912 .value(new ByteArrayInputStream(resourceFile.content()))
1913 .filename(resourceFile.filename());
1914 .value(new ByteArrayInputStream(resourceFile.content()))
1915 .filename(resourceFile.filename());
19141916 resourceFile.mimeType().ifPresent(fileField::contentType);
19151917
19161918 var uploaded = anthropic.files().upload(FileUploadParams.builder()
1917 .file(fileField.build())
1918 .build());
1919 .file(fileField.build())
1920 .build());
19191921
19201922 IO.println(uploaded.id());
19211923 ```
No line in this hunk matches that.