MCP Tools Reference: firestore.googleapis.com

Tool: list_indexes

List Firestore indexes.

The following code sample shows how to use curl to call the list_indexes MCP tool.

Curl Request
curl --location 'https://firestore.googleapis.com/mcp' \
--header 'content-type: application/json' \
--header 'accept: application/json, text/event-stream' \
--data '{
  "method": "tools/call",
  "params": {
    "name": "list_indexes",
    "arguments": {
      // Provide these details according to the MCP tool specification.
    }
  },
  "jsonrpc": "2.0",
  "id": 1
}'

Input Schema

The request for FirestoreAdmin.ListIndexes.

ListIndexesRequest

JSON representation
{
  "parent": string,
  "filter": string,
  "pageSize": integer,
  "pageToken": string
}
Fields
parent

string

Required. A parent name of the form projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}

filter

string

The filter to apply to list results.

pageSize

integer

The number of results to return.

pageToken

string

A page token, returned from a previous call to FirestoreAdmin.ListIndexes, that may be used to get the next page of results.

Output Schema

The response for FirestoreAdmin.ListIndexes.

ListIndexesResponse

JSON representation
{
  "indexes": [
    {
      object (Index)
    }
  ],
  "nextPageToken": string
}
Fields
indexes[]

object (Index)

The requested indexes.

nextPageToken

string

A page token that may be used to request another page of results. If blank, this is the last page.

Index

JSON representation
{
  "name": string,
  "queryScope": enum (QueryScope),
  "apiScope": enum (ApiScope),
  "fields": [
    {
      object (IndexField)
    }
  ],
  "state": enum (State),
  "density": enum (Density),
  "multikey": boolean,
  "shardCount": integer,
  "unique": boolean,
  "searchIndexOptions": {
    object (SearchIndexOptions)
  }
}
Fields
name

string

A server-defined name for this index. Output only.

When used in the google.firestore.admin.v1.Index resource, the value is of the form: projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}

When used in the google.firestore.admin.v1.Field resource, the value is empty.

queryScope

enum (QueryScope)

Indexes with a collection query scope specified allow queries against a collection that is the child of a specific document, specified at query time, and that has the same collection ID.

Indexes with a collection group query scope specified allow queries against all collections descended from a specific document, specified at query time, and that have the same collection ID as this index.

apiScope

enum (ApiScope)

The API scope supported by this index.

fields[]

object (IndexField)

The fields supported by this index.

At most 100 fields may be specified.

In Standard edition databases only:

  • At least 2 fields must be specified.
  • The last field entry is always for the field path __name__. If, on creation, __name__ was not specified as the last field, it will be added automatically with the same direction as that of the last field defined. If the final field in the index is not directional, the __name__ will be ordered ASCENDING (unless explicitly specified).
state

enum (State)

Output only. The serving state of the index.

density

enum (Density)

Immutable. The density configuration of the index.

multikey

boolean

Optional. Whether the index is multikey. By default, the index is not multikey. For non-multikey indexes, none of the paths in the index definition reach or traverse an array, except via an explicit array index. For multikey indexes, at most one of the paths in the index definition reach or traverse an array, except via an explicit array index. Violations will result in errors.

Note this field only applies to index with MONGODB_COMPATIBLE_API ApiScope.

shardCount

integer

Optional. The number of shards for the index.

unique

boolean

Optional. Whether it is an unique index. Unique index ensures all values for the indexed field(s) are unique across documents.

searchIndexOptions

object (SearchIndexOptions)

Optional. Options for search indexes that are at the index definition level. This field is only currently supported for indexes with MONGODB_COMPATIBLE_API ApiScope.

IndexField

JSON representation
{
  "fieldPath": string,

  // Union field value_mode can be only one of the following:
  "order": enum (Order),
  "arrayConfig": enum (ArrayConfig),
  "vectorConfig": {
    object (VectorConfig)
  },
  "searchConfig": {
    object (SearchConfig)
  }
  // End of list of possible types for union field value_mode.
}
Fields
fieldPath

string

Can be name. For single field indexes, this must match the name of the field or may be omitted.

Union field value_mode. How the field value is indexed. value_mode can be only one of the following:
order

enum (Order)

Indicates that this field supports ordering by the specified order or comparing using =, !=, <, <=, >, >=.

arrayConfig

enum (ArrayConfig)

Indicates that this field supports operations on array_values.

vectorConfig

object (VectorConfig)

Indicates that this field supports nearest neighbor and distance operations on vector.

searchConfig

object (SearchConfig)

Indicates that this field supports search operations.

VectorConfig

JSON representation
{
  "dimension": integer,

  // Union field type can be only one of the following:
  "flat": {
    object (FlatIndex)
  }
  // End of list of possible types for union field type.
}
Fields
dimension

integer

Required. The vector dimension this configuration applies to.

The resulting index will only include vectors of this dimension, and can be used for vector search with the same dimension.

Union field type. The type of index used. type can be only one of the following:
flat

object (FlatIndex)

Indicates the vector index is a flat index.

SearchConfig

JSON representation
{
  "textSpec": {
    object (SearchTextSpec)
  },
  "geoSpec": {
    object (SearchGeoSpec)
  }
}
Fields
textSpec

object (SearchTextSpec)

Optional. The specification for building a text search index for a field.

geoSpec

object (SearchGeoSpec)

Optional. The specification for building a geo search index for a field.

SearchTextSpec

JSON representation
{
  "indexSpecs": [
    {
      object (SearchTextIndexSpec)
    }
  ]
}
Fields
indexSpecs[]

object (SearchTextIndexSpec)

Required. Specifications for how the field should be indexed. Repeated so that the field can be indexed in multiple ways.

SearchTextIndexSpec

JSON representation
{
  "indexType": enum (TextIndexType),
  "matchType": enum (TextMatchType)
}
Fields
indexType

enum (TextIndexType)

Required. How to index the text field value.

matchType

enum (TextMatchType)

Required. How to match the text field value.

SearchGeoSpec

JSON representation
{
  "geoJsonIndexingDisabled": boolean
}
Fields
geoJsonIndexingDisabled

boolean

Optional. Disables geoJSON indexing for the field. By default, geoJSON points are indexed. Firestore GeoPoints are indexed regardless of the value of this field.

SearchIndexOptions

JSON representation
{
  "textLanguage": string,
  "textLanguageOverrideFieldPath": string
}
Fields
textLanguage

string

Optional. The language to use for text search indexes. Used as the default language if not overridden at the document level by specifying the text_language_override_field. The language is specified as a BCP 47 language code. For indexes with MONGODB_COMPATIBLE_API ApiScope: If unspecified, the default language is English. For indexes with ANY_API ApiScope: If unspecified, the default behavior is autodetect.

textLanguageOverrideFieldPath

string

Optional. The field in the document that specifies which language to use for that specific document. For indexes with MONGODB_COMPATIBLE_API ApiScope: if unspecified, the language is taken from the "language" field if it exists or from text_language if it does not.

QueryScope

Query Scope defines the scope at which a query is run. This is specified on a StructuredQuery's from field.

Enums
QUERY_SCOPE_UNSPECIFIED The query scope is unspecified. Not a valid option.
COLLECTION Indexes with a collection query scope specified allow queries against a collection that is the child of a specific document, specified at query time, and that has the collection ID specified by the index.
COLLECTION_GROUP Indexes with a collection group query scope specified allow queries against all collections that has the collection ID specified by the index.
COLLECTION_RECURSIVE Include all the collections's ancestor in the index. Only available for Datastore Mode databases.

ApiScope

API Scope defines the APIs (Firestore Native, or Firestore in Datastore Mode) that are supported for queries.

Enums
ANY_API The index can only be used by the Firestore Native query API. This is the default.
DATASTORE_MODE_API The index can only be used by the Firestore in Datastore Mode query API.
MONGODB_COMPATIBLE_API The index can only be used by the MONGODB_COMPATIBLE_API.

Order

The supported orderings.

Enums
ORDER_UNSPECIFIED The ordering is unspecified. Not a valid option.
ASCENDING The field is ordered by ascending field value.
DESCENDING The field is ordered by descending field value.

ArrayConfig

The supported array value configurations.

Enums
ARRAY_CONFIG_UNSPECIFIED The index does not support additional array queries.
CONTAINS The index supports array containment queries.

TextIndexType

Ways to index the text field value.

Enums
TEXT_INDEX_TYPE_UNSPECIFIED The index type is unspecified. Not a valid option.
TOKENIZED Field values are tokenized. This is the only way currently supported for MONGODB_COMPATIBLE_API.

TextMatchType

Types of text matches that are supported for the field.

Enums
TEXT_MATCH_TYPE_UNSPECIFIED The match type is unspecified. Not a valid option.
MATCH_GLOBALLY Match on any indexed field. This is the only way currently supported for MONGODB_COMPATIBLE_API.

State

The state of an index. During index creation, an index will be in the CREATING state. If the index is created successfully, it will transition to the READY state. If the index creation encounters a problem, the index will transition to the NEEDS_REPAIR state.

Enums
STATE_UNSPECIFIED The state is unspecified.
CREATING The index is being created. There is an active long-running operation for the index. The index is updated when writing a document. Some index data may exist.
READY The index is ready to be used. The index is updated when writing a document. The index is fully populated from all stored documents it applies to.
NEEDS_REPAIR The index was being created, but something went wrong. There is no active long-running operation for the index, and the most recently finished long-running operation failed. The index is not updated when writing a document. Some index data may exist. Use the google.longrunning.Operations API to determine why the operation that last attempted to create this index failed, then re-create the index.

Density

The density configuration for the index.

Enums
DENSITY_UNSPECIFIED Unspecified. It will use database default setting. This value is input only.
SPARSE_ALL

An index entry will only exist if ALL fields are present in the document.

This is both the default and only allowed value for Standard edition databases (for both Cloud Firestore ANY_API and Cloud Datastore DATASTORE_MODE_API).

Take for example the following document:

{
  "__name__": "...",
  "a": 1,
  "b": 2,
  "c": 3
}

an index on (a ASC, b ASC, c ASC, __name__ ASC) will generate an index entry for this document since a, 'b', c, and __name__ are all present but an index of (a ASC, d ASC, __name__ ASC) will not generate an index entry for this document since d is missing.

This means that such indexes can only be used to serve a query when the query has either implicit or explicit requirements that all fields from the index are present.

SPARSE_ANY

An index entry will exist if ANY field are present in the document.

This is used as the definition of a sparse index for Enterprise edition databases.

Take for example the following document:

{
  "__name__": "...",
  "a": 1,
  "b": 2,
  "c": 3
}

an index on (a ASC, d ASC) will generate an index entry for this document since a is present, and will fill in an unset value for d. An index on (d ASC, e ASC) will not generate any index entry as neither d nor e are present.

An index that contains __name__ will generate an index entry for all documents since Firestore guarantees that all documents have a __name__ field.

DENSE

An index entry will exist regardless of if the fields are present or not.

This is the default density for an Enterprise edition database.

The index will store unset values for fields that are not present in the document.

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: ❌