# VertexAiSearchTool

class VertexAiSearchTool(val dataStoreId: String? = null, val dataStoreSpecs: List<VertexAISearchDataStoreSpec>? = null, val searchEngineId: String? = null, val filter: String? = null, val maxResults: Int? = null, val model: String? = null) : 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).

## Constructors

VertexAiSearchTool
Link copied to clipboard
constructor(dataStoreId: String? = null, dataStoreSpecs: List<VertexAISearchDataStoreSpec>? = null, searchEngineId: String? = null, filter: String? = null, maxResults: Int? = null, model: String? = null)

## Properties

customMetadata
Link copied to clipboard
val customMetadata: Map<String, Any>

The custom metadata of the tool.

dataStoreId
Link copied to clipboard
val dataStoreId: String? = null

The Vertex AI search data store resource ID in the format of `projects/{project}/locations/{location}/collections/{collection}/dataStores/{dataStore}`.

dataStoreSpecs
Link copied to clipboard
val dataStoreSpecs: List<VertexAISearchDataStoreSpec>? = null

Specifications that define the specific DataStores to be searched. It should only be set if engine is used.

description
Link copied to clipboard
val description: String

The description of the tool.

filter
Link copied to clipboard
val filter: String? = null

The filter to apply to the search results.

isLongRunning
Link copied to clipboard
val isLongRunning: Boolean = false

Whether the tool's final result will be delivered out-of-band. When `true`, the framework marks the call as long-running and uses the tool's return value as the function-response payload (or suppresses the response entirely if the tool returns `Unit`).

maxResults
Link copied to clipboard
val maxResults: Int? = null

The maximum number of results to return.

model
Link copied to clipboard
val model: String? = null

The model name to use, overriding the one in LlmRequest.

name
Link copied to clipboard
val name: String

The name of the tool.

searchEngineId
Link copied to clipboard
val searchEngineId: String? = null

The Vertex AI search engine resource ID in the format of `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}`.

## Functions

close
Link copied to clipboard
open override fun close()
declaration
Link copied to clipboard
open override fun declaration(): FunctionDeclaration?

Returns the underlying function declaration.

processLlmRequest
Link copied to clipboard
open suspend override fun processLlmRequest(toolContext: ToolContext, llmRequest: LlmRequest): LlmRequest

Processes the LLM request before it is sent.

run
Link copied to clipboard
open suspend override fun run(context: ToolContext, args: Map<String, Any>): Any

Executes the tool.