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 @@ -201,7 +201,7 @@ private static Message errorResponse(String msg, String contextId) {
new Message.Builder()
.messageId(UUID.randomUUID().toString())
.role(Message.Role.AGENT)
.parts(List.of(new TextPart("Error: " + msg)))
.parts(ImmutableList.of(new TextPart("Error: " + msg)))
.build();
if (contextId != null && !contextId.isEmpty()) {
error.setContextId(contextId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ public static Optional<io.a2a.spec.Part<?>> fromGenaiPart(Part part) {
return Optional.empty();
}

@SuppressWarnings("unchecked") // safe conversion from OBJECT_MAPPER.readValue
private static Map<String, Object> coerceToMap(Object value) {
if (value == null) {
return new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
package com.google.adk.tools;

import com.google.adk.agents.ReadonlyContext;
import com.google.common.collect.ImmutableList;
import java.util.List;
import java.util.Optional;

public class NamedToolPredicate implements ToolPredicate {

private final List<String> toolNames;
private final ImmutableList<String> toolNames;

public NamedToolPredicate(List<String> toolNames) {
this.toolNames = List.copyOf(toolNames);
this.toolNames = ImmutableList.copyOf(toolNames);
}

public NamedToolPredicate(String... toolNames) {
this.toolNames = List.of(toolNames);
this.toolNames = ImmutableList.copyOf(toolNames);
}

@Override
Expand Down