Tool: get_index
Get a Firestore index.
The following code sample shows how to use curl to call the get_index 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": "get_index", "arguments": { // Provide these details according to the MCP tool specification. } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
The request for FirestoreAdmin.GetIndex.
GetIndexRequest
| JSON representation |
|---|
{ "name": string } |
| Fields | |
|---|---|
name |
Required. A name of the form |
Output Schema
Cloud Firestore indexes enable simple and complex queries against documents in a database.
In Standard edition databases, single-field indexes are managed using the google.firestore.admin.v1.Field resource, and composite indexes are managed using the google.firestore.admin.v1.Index resource.
In Enterprise edition databases, both single-field and composite indexes are managed using the google.firestore.admin.v1.Index resource.
Index
| JSON representation |
|---|
{ "name": string, "queryScope": enum ( |
| Fields | |
|---|---|
name |
A server-defined name for this index. Output only. When used in the When used in the |
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 |
The API scope supported by this index. |
fields[] |
The fields supported by this index. At most 100 fields may be specified. In Standard edition databases only:
|
state |
Output only. The serving state of the index. |
density |
Immutable. The density configuration of the index. |
multikey |
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 |
Optional. The number of shards for the index. |
unique |
Optional. Whether it is an unique index. Unique index ensures all values for the indexed field(s) are unique across documents. |
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 |
| Fields | |
|---|---|
fieldPath |
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 |
Indicates that this field supports ordering by the specified order or comparing using =, !=, <, <=, >, >=. |
arrayConfig |
Indicates that this field supports operations on |
vectorConfig |
Indicates that this field supports nearest neighbor and distance operations on vector. |
searchConfig |
Indicates that this field supports search operations. |
VectorConfig
| JSON representation |
|---|
{ "dimension": integer, // Union field |
| Fields | |
|---|---|
dimension |
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 |
Indicates the vector index is a flat index. |
SearchConfig
| JSON representation |
|---|
{ "textSpec": { object ( |
| Fields | |
|---|---|
textSpec |
Optional. The specification for building a text search index for a field. |
geoSpec |
Optional. The specification for building a geo search index for a field. |
SearchTextSpec
| JSON representation |
|---|
{
"indexSpecs": [
{
object ( |
| Fields | |
|---|---|
indexSpecs[] |
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 ( |
| Fields | |
|---|---|
indexType |
Required. How to index the text field value. |
matchType |
Required. How to match the text field value. |
SearchGeoSpec
| JSON representation |
|---|
{ "geoJsonIndexingDisabled": boolean } |
| Fields | |
|---|---|
geoJsonIndexingDisabled |
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 |
Optional. The language to use for text search indexes. Used as the default language if not overridden at the document level by specifying the |
textLanguageOverrideFieldPath |
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 |
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 Take for example the following document: an index on 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: an index on An index that contains |
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 |
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: ❌