Skip to content
Closed
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
2 changes: 1 addition & 1 deletion core/src/main/java/com/google/adk/agents/BaseAgent.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public final String name() {
*
* @return the description of the agent.
*/
public final String description() {
public String description() {
return description;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
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 @@ -86,7 +87,7 @@ public T getMcpSession() {

@Override
public Optional<FunctionDeclaration> declaration() {
Map<String, Object> inputSchema = this.mcpTool.inputSchema();
JsonSchema 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())
.httpRequestCustomizer(
(builder, method, uri, body, context) ->
.customizeRequest(
builder ->
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_defaultsInputSchema() {
public void adkToMcpToolType_declarationWithoutParameters_omitsInputSchema() {
// 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_defaultsInputSchema()

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

@Test
public void adkToMcpToolType_noDeclaration_defaultsInputSchema() {
public void adkToMcpToolType_noDeclaration_omitsInputSchema() {
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()).containsExactly("type", "object");
assertThat(result.inputSchema()).isNull();
}
}
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>2.0.0</mcp.version>
<mcp.version>1.1.2</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