# Class SetModelResponseTool

java.lang.Object
com.google.adk.tools.BaseTool
com.google.adk.tools.SetModelResponseTool

public class SetModelResponseTool extends BaseTool
Internal tool used for output schema workaround.

This tool allows the model to set its final response when output_schema is configured alongside other tools. The model should use this tool to provide its final structured response instead of outputting text directly.

- ## Nested Class Summary

  ### Nested classes/interfaces inherited from class BaseTool

  `BaseTool.ToolArgsConfig, BaseTool.ToolConfig`
  Modifier and Type
  Class
  Description
  `static class`
  `BaseTool.ToolArgsConfig`
  Configuration class for tool arguments that allows arbitrary key-value pairs.
  `static class`
  `BaseTool.ToolConfig`
  Configuration class for a tool definition in YAML/JSON.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `NAME`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SetModelResponseTool(com.google.genai.types.Schema outputSchema)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Optional<com.google.genai.types.FunctionDeclaration>`
  `declaration()`
  Gets the `FunctionDeclaration` representation of this tool.
  `io.reactivex.rxjava3.core.Single<Map<String,Object>>`
  `runAsync(Map<String,Object> args, ToolContext toolContext)`
  Calls a tool.

  ### Methods inherited from class BaseTool

  `customMetadata, description, fromConfig, longRunning, name, processLlmRequest, runAsync, runAsync, runAsync, runAsync, runAsync, runAsync, setCustomMetadata`
  Modifier and Type
  Method
  Description
  `com.google.common.collect.ImmutableMap<String,Object>`
  `customMetadata()`
  Returns a read-only view of the tool metadata.
  `String`
  `description()`
  `static BaseTool`
  `fromConfig(BaseTool.ToolConfig config, String configAbsPath)`
  Creates a tool instance from a config.
  `boolean`
  `longRunning()`
  `String`
  `name()`
  `io.reactivex.rxjava3.core.Completable`
  `processLlmRequest(LlmRequest.Builder llmRequestBuilder, ToolContext toolContext)`
  Processes the outgoing `LlmRequest.Builder`.
  `final <I,O> io.reactivex.rxjava3.core.Single<O>`
  `runAsync(I args, ToolContext toolContext, com.fasterxml.jackson.core.type.TypeReference<? extends O> typeReference)`
  Calls a tool with generic arguments, returning the results converted to a specified type reference.
  `final <I,O> io.reactivex.rxjava3.core.Single<O>`
  `runAsync(I args, ToolContext toolContext, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.fasterxml.jackson.core.type.TypeReference<? extends O> typeReference)`
  Calls a tool with generic arguments and a custom `ObjectMapper`, returning the results converted to a specified type reference.
  `final <I,O> io.reactivex.rxjava3.core.Single<O>`
  `runAsync(I args, ToolContext toolContext, com.fasterxml.jackson.databind.ObjectMapper objectMapper, Class<? extends O> oClass)`
  Calls a tool with generic arguments and a custom `ObjectMapper`, returning the results converted to a specified class.
  `final <I,O> io.reactivex.rxjava3.core.Single<O>`
  `runAsync(I args, ToolContext toolContext, Class<? extends O> oClass)`
  Calls a tool with generic arguments, returning the results converted to a specified class.
  `final <T> io.reactivex.rxjava3.core.Single<Map<String,Object>>`
  `runAsync(T args, ToolContext toolContext)`
  Calls a tool with generic arguments and returns a map of results.
  `final <T> io.reactivex.rxjava3.core.Single<Map<String,Object>>`
  `runAsync(T args, ToolContext toolContext, com.fasterxml.jackson.databind.ObjectMapper objectMapper)`
  Calls a tool with generic arguments using a custom `ObjectMapper` and returns a map of results.
  `void`
  `setCustomMetadata(String key, Object value)`
  Sets custom metadata to the tool associated with a key.

  ### Methods inherited from class Object

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

- ## Field Details

  - ### NAME

    public static final String NAME
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### SetModelResponseTool

    public SetModelResponseTool(com.google.genai.types.Schema outputSchema)

- ## Method Details

  - ### declaration

    public Optional<com.google.genai.types.FunctionDeclaration> declaration()
    Description copied from class: `BaseTool`
    Gets the `FunctionDeclaration` representation of this tool.
    Overrides:
      `declaration` in class `BaseTool`

  - ### runAsync

    public io.reactivex.rxjava3.core.Single<Map<String,Object>> runAsync(Map<String,Object> args, ToolContext toolContext)
    Description copied from class: `BaseTool`
    Calls a tool.
    Overrides:
      `runAsync` in class `BaseTool`