Skip to content

Commit b5c5dd1

Browse files
committed
feat: Update tool filter type from List to Collection in BaseToolset
1 parent 073d5e8 commit b5c5dd1

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

core/src/main/java/com/google/adk/tools/BaseToolset.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import com.google.adk.agents.ReadonlyContext;
44
import io.reactivex.rxjava3.core.Flowable;
5-
import java.util.List;
5+
import java.util.Collection;
66
import java.util.Optional;
77

88
/** Base interface for toolsets. */
@@ -31,7 +31,7 @@ public interface BaseToolset extends AutoCloseable {
3131
* list of tools of if testing against the given ToolPredicate returns true (otherwise false).
3232
*
3333
* @param tool The tool to check.
34-
* @param toolFilter An Optional containing either a ToolPredicate or a List of tool names.
34+
* @param toolFilter An Optional containing either a ToolPredicate or a Collection of tool names.
3535
* @param readonlyContext The current context.
3636
* @return true if the tool is selected.
3737
*/
@@ -44,9 +44,9 @@ default boolean isToolSelected(
4444
if (filter instanceof ToolPredicate toolPredicate) {
4545
return toolPredicate.test(tool, readonlyContext);
4646
}
47-
if (filter instanceof List) {
47+
if (filter instanceof Collection) {
4848
@SuppressWarnings("unchecked")
49-
List<String> toolNames = (List<String>) filter;
49+
Collection<String> toolNames = (Collection<String>) filter;
5050
return toolNames.contains(tool.name());
5151
}
5252
return false;

core/src/main/java/com/google/adk/tools/mcp/McpToolset.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public McpToolset(SseServerParameters connectionParams, ObjectMapper objectMappe
8989
*
9090
* @param connectionParams The local server connection parameters to the MCP server.
9191
* @param objectMapper An ObjectMapper instance for parsing schemas.
92-
* @param toolFilter An Optional containing either a ToolPredicate or a List of tool names.
92+
* @param toolFilter An Optional containing either a ToolPredicate or a Collection of tool names.
9393
*/
9494
public McpToolset(
9595
ServerParameters connectionParams, ObjectMapper objectMapper, Optional<Object> toolFilter) {

0 commit comments

Comments
 (0)