ToolPredicate

fun interface ToolPredicate

Decides whether a BaseTool should be exposed to the LLM under the current context.

A toolset accepts a predicate (usually wrapped in ToolFilter.Predicate) and applies it in Toolset.getTools to narrow the tools it returns. As a functional (SAM) interface it can be written as a lambda: ToolFilter.Predicate { tool, context -> tool.name.startsWith("read_") }.

Functions

Link copied to clipboard
abstract fun test(tool: BaseTool, readonlyContext: ReadonlyContext?): Boolean

Returns true if tool should be selected.