# Class VertexAiSearchTool

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

public abstract class VertexAiSearchTool extends BaseTool
A built-in tool using Vertex AI Search.

This tool can be configured with either a `dataStoreId` (the Vertex AI search data store resource ID) or a `searchEngineId` (the Vertex AI search engine resource ID).

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `VertexAiSearchTool.Builder`
  Builder for `VertexAiSearchTool`.

  ### 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.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static VertexAiSearchTool.Builder`
  `builder()`
  `abstract Optional<String>`
  `dataStore()`
  `abstract Optional<String>`
  `dataStoreId()`
  `abstract com.google.common.collect.ImmutableList<com.google.genai.types.VertexAISearchDataStoreSpec>`
  `dataStoreSpecs()`
  `abstract Optional<String>`
  `filter()`
  `abstract Optional<String>`
  `location()`
  `abstract Optional<Integer>`
  `maxResults()`
  `io.reactivex.rxjava3.core.Completable`
  `processLlmRequest(LlmRequest.Builder llmRequestBuilder, ToolContext toolContext)`
  Processes the outgoing `LlmRequest.Builder`.
  `abstract Optional<String>`
  `project()`
  `abstract Optional<String>`
  `searchEngineId()`

  ### Methods inherited from class BaseTool

  `customMetadata, declaration, description, fromConfig, longRunning, name, runAsync, 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.
  `Optional<com.google.genai.types.FunctionDeclaration>`
  `declaration()`
  Gets the `FunctionDeclaration` representation of this tool.
  `String`
  `description()`
  `static BaseTool`
  `fromConfig(BaseTool.ToolConfig config, String configAbsPath)`
  Creates a tool instance from a config.
  `boolean`
  `longRunning()`
  `String`
  `name()`
  `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.
  `io.reactivex.rxjava3.core.Single<Map<String,Object>>`
  `runAsync(Map<String,Object> args, ToolContext toolContext)`
  Calls a tool.
  `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`

- ## Method Details

  - ### dataStoreId

    public abstract Optional<String> dataStoreId()

  - ### dataStoreSpecs

    public abstract com.google.common.collect.ImmutableList<com.google.genai.types.VertexAISearchDataStoreSpec> dataStoreSpecs()

  - ### searchEngineId

    public abstract Optional<String> searchEngineId()

  - ### filter

    public abstract Optional<String> filter()

  - ### maxResults

    public abstract Optional<Integer> maxResults()

  - ### project

    public abstract Optional<String> project()

  - ### location

    public abstract Optional<String> location()

  - ### dataStore

    public abstract Optional<String> dataStore()

  - ### builder

    public static VertexAiSearchTool.Builder builder()

  - ### processLlmRequest

    public io.reactivex.rxjava3.core.Completable processLlmRequest(LlmRequest.Builder llmRequestBuilder, ToolContext toolContext)
    Description copied from class: `BaseTool`
    Processes the outgoing `LlmRequest.Builder`.

    This implementation adds the current tool's `BaseTool.declaration()` to the `GenerateContentConfig` within the builder. If a tool with function declarations already exists, the current tool's declaration is merged into it. Otherwise, a new tool definition with the current tool's declaration is created. The current tool itself is also added to the builder's internal list of tools. Override this method for processing the outgoing request.

    Overrides:
      `processLlmRequest` in class `BaseTool`