# Class ToolChoice

java.lang.Object
com.codename1.ai.ToolChoice

public final class ToolChoice extends Object
Controls how aggressively the model will call tools. Use the constants for the three common modes; use `named(String)` to force the model to call a specific tool.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final ToolChoice`
  `AUTO`
  Model picks freely between calling tools and replying with text.
  `static final ToolChoice`
  `NONE`
  Model must not call any tool -- it must reply with text.
  `static final ToolChoice`
  `REQUIRED`
  Model must call exactly one tool (any tool).

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getForcedToolName()`
  `String`
  `getMode()`
  `static ToolChoice`
  `named(String toolName)`
  Forces the model to call the named tool.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### AUTO

    public static final ToolChoice AUTO
    Model picks freely between calling tools and replying with text.

  - ### NONE

    public static final ToolChoice NONE
    Model must not call any tool -- it must reply with text.

  - ### REQUIRED

    public static final ToolChoice REQUIRED
    Model must call exactly one tool (any tool). Useful for forcing a structured-output path.

- ## Method Details

  - ### named

    public static ToolChoice named(String toolName)
    Forces the model to call the named tool.

  - ### getMode

    public String getMode()

  - ### getForcedToolName

    public String getForcedToolName()