Tool: search_data_objects
Performs a vector search on a collection.
The following code sample shows how to use curl to call the search_data_objects MCP tool.
| Curl Request |
|---|
curl --location 'https://vectorsearch.googleapis.com/mcp' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "search_data_objects", "arguments": { // Provide these details according to the MCP tool specification. } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
Request for performing a single search.
SearchDataObjectsRequest
| JSON representation |
|---|
{ "parent": string, "pageSize": integer, "pageToken": string, // Union field |
| Fields | |
|---|---|
parent |
Required. The resource name of the Collection for which to search. Format: |
pageSize |
Optional. The standard list page size. Only supported for KNN. If not set, up to search_type.top_k results will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000. |
pageToken |
Optional. The standard list page token. Typically obtained via |
Union field search_type. The query to search for. search_type can be only one of the following: |
|
vectorSearch |
A vector search operation. |
semanticSearch |
A semantic search operation. |
textSearch |
Optional. A text search operation. |
VectorSearch
| JSON representation |
|---|
{ "searchField": string, "filter": { object }, "outputFields": { object ( |
| Fields | |
|---|---|
searchField |
Required. The vector field to search. |
filter |
Optional. A JSON filter expression, e.g. An empty filter ( Logical operators can be nested at most 2 levels deep, e.g. Which filters are accepted depends on how the search is served. If it is served by an approximate nearest neighbor (ANN) index (by default when a ready index exists on |
outputFields |
Optional. Mask specifying which fields to return. |
searchHint |
Optional. Sets the search hint. If no strategy is specified, the service will use an index if one is available, and fall back to the default KNN search otherwise. |
distanceMetric |
Optional. The distance metric to use for the KNN search. If not specified, DOT_PRODUCT will be used as the default. |
Union field vector_type. Specifies the type of vector to use for the query. vector_type can be only one of the following: |
|
vector |
A dense vector for the query. |
sparseVector |
A sparse vector for the query. |
Union field
|
|
topK |
Optional. The number of nearest neighbors to return. |
DenseVector
| JSON representation |
|---|
{ "values": [ number ] } |
| Fields | |
|---|---|
values[] |
Required. The values of the vector. |
SparseVector
| JSON representation |
|---|
{ "values": [ number ], "indices": [ integer ] } |
| Fields | |
|---|---|
values[] |
Required. The values of the vector. |
indices[] |
Required. The corresponding indices for the values. |
Struct
| JSON representation |
|---|
{ "fields": { string: value, ... } } |
| Fields | |
|---|---|
fields |
Unordered map of dynamically typed values. An object containing a list of |
FieldsEntry
| JSON representation |
|---|
{ "key": string, "value": value } |
| Fields | |
|---|---|
key |
|
value |
|
Value
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field kind. The kind of value. kind can be only one of the following: |
|
nullValue |
Represents a JSON |
numberValue |
Represents a JSON number. Must not be |
stringValue |
Represents a JSON string. |
boolValue |
Represents a JSON boolean ( |
structValue |
Represents a JSON object. |
listValue |
Represents a JSON array. |
ListValue
| JSON representation |
|---|
{ "values": [ value ] } |
| Fields | |
|---|---|
values[] |
Repeated field of dynamically typed values. |
OutputFields
| JSON representation |
|---|
{ "dataFields": [ string ], "vectorFields": [ string ], "metadataFields": [ string ] } |
| Fields | |
|---|---|
dataFields[] |
Optional. The fields from the data fields to include in the output. Use |
vectorFields[] |
Optional. The fields from the vector fields to include in the output. Use |
metadataFields[] |
Optional. The DataObject metadata fields to include in the output: |
SearchHint
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field index_type. The type of index to use. index_type can be only one of the following: |
|
knnHint |
Optional. If set, the search will use the system's default K-Nearest Neighbor (KNN) index engine. |
indexHint |
Optional. Specifies that the search should use a particular index. |
IndexHint
| JSON representation |
|---|
{ "name": string, // Union field |
| Fields | |
|---|---|
name |
Required. The resource name of the index to use for the search. The index must be in the same project, location, and collection. Format: |
Union field params. The parameters for the index. params can be only one of the following: |
|
denseScannParams |
Optional. Dense ScaNN parameters. |
DenseScannParams
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field
|
|
targetRecall |
Optional. The target recall for the search. Must be a double in the range [0, 1]. While the search aims to achieve this level of recall, it is not guaranteed. |
SemanticSearch
| JSON representation |
|---|
{ "searchText": string, "searchField": string, "taskType": enum ( |
| Fields | |
|---|---|
searchText |
Optional. The query text, which is used to generate an embedding according to the embedding model specified in the collection config. Required when using the text search mode. |
searchField |
Required. The vector field to search. |
taskType |
Optional. The task type of the query embedding. Must be specified for text-only embedding models, see https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/embeddings/task-types Not needed for multi modal embedding models, see https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/embeddings/get-multimodal-embeddings#specify-task-instructions |
outputFields |
Optional. The fields to return in the search results. |
filter |
Optional. A JSON filter expression, e.g. An empty filter ( Logical operators can be nested at most 2 levels deep, e.g. Which filters are accepted depends on how the search is served. If it is served by an approximate nearest neighbor (ANN) index (by default when a ready index exists on |
searchHint |
Optional. Sets the search hint. If no strategy is specified, the service will use an index if one is available, and fall back to KNN search otherwise. |
Union field
|
|
topK |
Optional. The number of data objects to return. |
TextSearch
| JSON representation |
|---|
{ "searchText": string, "dataFieldNames": [ string ], "outputFields": { object ( |
| Fields | |
|---|---|
searchText |
Optional. The query text. Required when using the default text search mode. |
dataFieldNames[] |
Optional. The data field names to search. Required when using the default text search mode. |
outputFields |
Optional. The fields to return in the search results. |
filter |
Optional. A JSON filter expression, e.g. An empty filter ( Logical operators can be nested at most 2 levels deep, e.g. |
Union field
|
|
topK |
Optional. The number of results to return. |
NullValue
Represents a JSON null.
NullValue is a sentinel, using an enum with only one value to represent the null value for the Value type union.
A field of type NullValue with any value other than 0 is considered invalid. Most ProtoJSON serializers will emit a Value with a null_value set as a JSON null regardless of the integer value, and so will round trip to a 0 value.
| Enums | |
|---|---|
NULL_VALUE |
Null value. |
DistanceMetric
Distance metric for vector search.
| Enums | |
|---|---|
DISTANCE_METRIC_UNSPECIFIED |
Default value, distance metric is not specified. |
DOT_PRODUCT |
Dot product distance metric. |
COSINE_DISTANCE |
Cosine distance metric. |
EmbeddingTaskType
Represents the task the embeddings will be used for.
| Enums | |
|---|---|
EMBEDDING_TASK_TYPE_UNSPECIFIED |
Unspecified task type. |
RETRIEVAL_QUERY |
Specifies the given text is a query in a search/retrieval setting. |
RETRIEVAL_DOCUMENT |
Specifies the given text is a document from the corpus being searched. |
SEMANTIC_SIMILARITY |
Specifies the given text will be used for STS. |
CLASSIFICATION |
Specifies that the given text will be classified. |
CLUSTERING |
Specifies that the embeddings will be used for clustering. |
QUESTION_ANSWERING |
Specifies that the embeddings will be used for question answering. |
FACT_VERIFICATION |
Specifies that the embeddings will be used for fact verification. |
CODE_RETRIEVAL_QUERY |
Specifies that the embeddings will be used for code retrieval. |
Output Schema
Response for a search request.
SearchDataObjectsResponse
| JSON representation |
|---|
{
"results": [
{
object ( |
| Fields | |
|---|---|
results[] |
Output only. The list of dataObjects that match the search criteria. |
nextPageToken |
Output only. A token to retrieve next page of results. Pass to |
SearchResult
| JSON representation |
|---|
{ "dataObject": { object ( |
| Fields | |
|---|---|
dataObject |
Output only. The matching data object. |
Union field
|
|
distance |
Output only. Similarity distance or ranker score returned by BatchSearchDataObjects. |
DataObject
| JSON representation |
|---|
{
"name": string,
"dataObjectId": string,
"createTime": string,
"updateTime": string,
"data": {
object
},
"vectors": {
string: {
object ( |
| Fields | |
|---|---|
name |
Identifier. The fully qualified resource name of the dataObject. Format: |
dataObjectId |
Output only. The id of the dataObject. |
createTime |
Output only. Timestamp the dataObject was created at. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
updateTime |
Output only. Timestamp the dataObject was last updated. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
data |
Optional. The data of the dataObject. |
vectors |
Optional. The vectors of the dataObject. An object containing a list of |
etag |
Optional. The etag of the dataObject. |
Timestamp
| JSON representation |
|---|
{ "seconds": string, "nanos": integer } |
| Fields | |
|---|---|
seconds |
Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be between -62135596800 and 253402300799 inclusive (which corresponds to 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z). |
nanos |
Non-negative fractions of a second at nanosecond resolution. This field is the nanosecond portion of the duration, not an alternative to seconds. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be between 0 and 999,999,999 inclusive. |
Struct
| JSON representation |
|---|
{ "fields": { string: value, ... } } |
| Fields | |
|---|---|
fields |
Unordered map of dynamically typed values. An object containing a list of |
FieldsEntry
| JSON representation |
|---|
{ "key": string, "value": value } |
| Fields | |
|---|---|
key |
|
value |
|
Value
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field kind. The kind of value. kind can be only one of the following: |
|
nullValue |
Represents a JSON |
numberValue |
Represents a JSON number. Must not be |
stringValue |
Represents a JSON string. |
boolValue |
Represents a JSON boolean ( |
structValue |
Represents a JSON object. |
listValue |
Represents a JSON array. |
ListValue
| JSON representation |
|---|
{ "values": [ value ] } |
| Fields | |
|---|---|
values[] |
Repeated field of dynamically typed values. |
VectorsEntry
| JSON representation |
|---|
{
"key": string,
"value": {
object ( |
| Fields | |
|---|---|
key |
|
value |
|
Vector
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field vector_type. The type of the vector. vector_type can be only one of the following: |
|
dense |
A dense vector. |
sparse |
A sparse vector. |
DenseVector
| JSON representation |
|---|
{ "values": [ number ] } |
| Fields | |
|---|---|
values[] |
Required. The values of the vector. |
SparseVector
| JSON representation |
|---|
{ "values": [ number ], "indices": [ integer ] } |
| Fields | |
|---|---|
values[] |
Required. The values of the vector. |
indices[] |
Required. The corresponding indices for the values. |
NullValue
Represents a JSON null.
NullValue is a sentinel, using an enum with only one value to represent the null value for the Value type union.
A field of type NullValue with any value other than 0 is considered invalid. Most ProtoJSON serializers will emit a Value with a null_value set as a JSON null regardless of the integer value, and so will round trip to a 0 value.
| Enums | |
|---|---|
NULL_VALUE |
Null value. |
Tool Annotations
Tool annotations are sent to MCP clients to describe the basic risk of a given tool. Most clients treat these hints as untrusted, but they can be used to decide when a confirmation prompt might be sent to a user.
Along with the title string, the following boolean hints are defined as follows:
readOnlyHint: If true, the tool doesn't modify its environment. Default: false.destructiveHint: If true, then the tool can perform destructive actions. If false, then the tool can only perform additive actions. Default: true.idempotentHint: If true, then calling the tool repeatedly with the same arguments will have no additional effect on its environment. Default: false.openWorldHint: If true, then the tool can interact with an 'open world' of external entities. If false, then the tool can only interact with internal entities. For example, a web search tool would be open world, while a memory tool would not be open world.
Destructive Hint: ❌ | Idempotent Hint: ✅ | Read Only Hint: ✅ | Open World Hint: ❌