Class GridAITools

java.lang.Object
com.vaadin.flow.component.ai.grid.GridAITools

public final class GridAITools extends Object
Factory for creating reusable grid LLMProvider.ToolSpec instances.

The tools use a gridId parameter to identify which grid to operate on, allowing a single set of tools to manage multiple grids (e.g., in a dashboard). Callers provide a GridAITools.Callbacks implementation for state retrieval and mutation, keeping this class decoupled from Grid.

Author:
Vaadin Ltd
  • Method Details

    • getGridState

      public static LLMProvider.ToolSpec getGridState(GridAITools.Callbacks callbacks)
      Creates a tool that returns the current grid state.
      Parameters:
      callbacks - the callbacks for grid state access, not null
      Returns:
      the tool definition, never null
    • updateGridData

      public static LLMProvider.ToolSpec updateGridData(GridAITools.Callbacks callbacks)
      Creates a tool that updates the grid data with a SQL query. If the handler throws, the error is returned to the LLM.
      Parameters:
      callbacks - the callbacks for grid mutation, not null
      Returns:
      the tool definition, never null
    • createAll

      public static List<LLMProvider.ToolSpec> createAll(GridAITools.Callbacks callbacks)
      Creates all grid tools for the given callbacks.
      Parameters:
      callbacks - the callbacks for grid state access and mutation, not null
      Returns:
      a list of all grid tools, never null