# Interface ToolPredicate

All Known Implementing Classes:
  `NamedToolPredicate`

Functional Interface:
  This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ToolPredicate
Functional interface to decide whether a tool should be exposed to the LLM based on the current context.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `default boolean`
  `test(BaseTool tool, @Nullable ReadonlyContext readonlyContext)`
  Decides if the given tool is selected.
  `boolean`
  `test(BaseTool tool, Optional<ReadonlyContext> readonlyContext)`
  Deprecated.
  Use `test(BaseTool, ReadonlyContext)` instead.

- ## Method Details

  - ### test

    @Deprecated boolean test(BaseTool tool, Optional<ReadonlyContext> readonlyContext)
    Deprecated.
    Use `test(BaseTool, ReadonlyContext)` instead.
    Decides if the given tool is selected.
    Parameters:
      `tool` - The tool to check.
      `readonlyContext` - The current context.
    Returns:
      true if the tool should be selected, false otherwise.

  - ### test

    default boolean test(BaseTool tool, @Nullable ReadonlyContext readonlyContext)
    Decides if the given tool is selected.
    Parameters:
      `tool` - The tool to check.
      `readonlyContext` - The current context.
    Returns:
      true if the tool should be selected, false otherwise.