Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import com.google.genai.types.FunctionDeclaration;
import io.modelcontextprotocol.spec.McpSchema.CallToolResult;
import io.modelcontextprotocol.spec.McpSchema.Content;
import io.modelcontextprotocol.spec.McpSchema.JsonSchema;
import io.modelcontextprotocol.spec.McpSchema.TextContent;
import io.modelcontextprotocol.spec.McpSchema.Tool;
import io.modelcontextprotocol.spec.McpSchema.ToolAnnotations;
Expand Down Expand Up @@ -87,7 +86,7 @@ public T getMcpSession() {

@Override
public Optional<FunctionDeclaration> declaration() {
JsonSchema inputSchema = this.mcpTool.inputSchema();
Map<String, Object> inputSchema = this.mcpTool.inputSchema();
Map<String, Object> outputSchema = this.mcpTool.outputSchema();
try {
return Optional.ofNullable(inputSchema)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public McpClientTransport build(Object connectionParams) {
return HttpClientSseClientTransport.builder(sseServerParams.url())
.sseEndpoint(
sseServerParams.sseEndpoint() == null ? "sse" : sseServerParams.sseEndpoint())
.customizeRequest(
builder ->
.httpRequestCustomizer(
(builder, method, uri, body, context) ->
Optional.ofNullable(sseServerParams.headers())
.map(ImmutableMap::entrySet)
.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void adkToMcpToolType_declarationWithParameters_setsInputSchema() {
}

@Test
public void adkToMcpToolType_declarationWithoutParameters_omitsInputSchema() {
public void adkToMcpToolType_declarationWithoutParameters_defaultsInputSchema() {
// A present declaration with no parameters is a valid no-argument tool. Before the fix this
// threw NoSuchElementException from an unguarded Optional.get() on parameters().
FunctionDeclaration declaration = FunctionDeclaration.builder().name("noParams").build();
Expand All @@ -72,17 +72,17 @@ public void adkToMcpToolType_declarationWithoutParameters_omitsInputSchema() {

assertThat(result.name()).isEqualTo("noParams");
assertThat(result.description()).isEqualTo("no params");
assertThat(result.inputSchema()).isNull();
assertThat(result.inputSchema()).containsExactly("type", "object");
}

@Test
public void adkToMcpToolType_noDeclaration_omitsInputSchema() {
public void adkToMcpToolType_noDeclaration_defaultsInputSchema() {
BaseTool tool = new FakeTool("bare", "no declaration", Optional.empty());

McpSchema.Tool result = ConversionUtils.adkToMcpToolType(tool);

assertThat(result.name()).isEqualTo("bare");
assertThat(result.description()).isEqualTo("no declaration");
assertThat(result.inputSchema()).isNull();
assertThat(result.inputSchema()).containsExactly("type", "object");
}
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
cloud libraries. Once they update their otel dependencies we
can consider updating ours here as well -->
<otel.version>1.51.0</otel.version>
<mcp.version>1.1.2</mcp.version>
<mcp.version>2.0.0</mcp.version>
<errorprone.version>2.47.0</errorprone.version>
<google.genai.version>1.58.0</google.genai.version>
<protobuf.version>4.33.5</protobuf.version>
Expand Down
Loading