工具谓词(Predicate)

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_") }.

函数

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

返回值 true if tool 应该选择一个选项。