Tool: list_documents
List documents from a Firestore database.
The following code sample shows how to use curl to call the list_documents 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_documents", "arguments": { // Provide these details according to the MCP tool specification. } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
The request for Firestore.ListDocuments.
ListDocumentsRequest
| JSON representation |
|---|
{ "parent": string, "collectionId": string, "recursive": boolean, "pageSize": integer, "pageToken": string, "orderBy": string, "mask": { object ( |
| Fields | |
|---|---|
parent |
Required. The parent resource name. In the format: For example: |
collectionId |
Optional. The collection ID, relative to For example: This is optional, and when not provided, Firestore will list documents from all collections under the provided |
recursive |
Optional. If the list should recursively include all documents nested under the parent at any level. If the request specifies a This is optional, and when not provided, Firestore will only list documents nested immediately under the parent. Requests with |
pageSize |
Optional. The maximum number of documents to return in a single response. Firestore may return fewer than this value. |
pageToken |
Optional. A page token, received from a previous Provide this to retrieve the subsequent page. When paginating, all other parameters (with the exception of |
orderBy |
Optional. The optional ordering of the documents to return. For example: This mirrors the |
mask |
Optional. The fields to return. If not set, returns all fields. If a document has a field that is not present in this mask, that field will not be returned in the response. |
showMissing |
If the list should show missing documents. A document is missing if it does not exist, but there are sub-documents nested underneath it. When true, such missing documents will be returned with a key but will not have fields, Requests with |
Union field consistency_selector. The consistency mode for this transaction. If not set, defaults to strong consistency. consistency_selector can be only one of the following: |
|
transaction |
Perform the read as part of an already active transaction. A base64-encoded string. |
readTime |
Perform the read at the provided time. This must be a microsecond precision timestamp within the past one hour, or if Point-in-Time Recovery is enabled, can additionally be a whole minute timestamp within the past 7 days. 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: |
DocumentMask
| JSON representation |
|---|
{ "fieldPaths": [ string ] } |
| Fields | |
|---|---|
fieldPaths[] |
The list of field paths in the mask. See |
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. |
Output Schema
The response for Firestore.ListDocuments.
ListDocumentsResponse
| JSON representation |
|---|
{
"documents": [
{
object ( |
| Fields | |
|---|---|
documents[] |
The Documents found. |
nextPageToken |
A token to retrieve the next page of documents. If this field is omitted, there are no subsequent pages. |
Document
| JSON representation |
|---|
{
"name": string,
"fields": {
string: {
object ( |
| Fields | |
|---|---|
name |
The resource name of the document, for example |
fields |
The document's fields. The map keys represent field names. Field names matching the regular expression Field paths may be used in other contexts to refer to structured fields defined here. For A simple field name contains only characters A quoted field name starts and ends with An object containing a list of |
createTime |
Output only. The time at which the document was created. This value increases monotonically when a document is deleted then recreated. It can also be compared to values from other documents and the 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. The time at which the document was last changed. This value is initially set to the 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: |
FieldsEntry
| JSON representation |
|---|
{
"key": string,
"value": {
object ( |
| Fields | |
|---|---|
key |
|
value |
|
Value
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field value_type. Must have a value set. value_type can be only one of the following: |
|
nullValue |
A null value. |
booleanValue |
A boolean value. |
integerValue |
An integer value. |
doubleValue |
A double value. |
timestampValue |
A timestamp value. Precise only to microseconds. When stored, any additional precision is rounded down. 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: |
stringValue |
A string value. In Standard edition databases:
In Enterprise edition databases, there is no limit on the size of the value. However, it is still subject to document and index entry size limits. |
bytesValue |
A bytes value. In Standard edition databases:
In Enterprise edition databases, there is no limit on the size of the value. However, it is still subject to document and index entry size limits. A base64-encoded string. |
referenceValue |
A reference to a document. For example: |
geoPointValue |
A geo point value representing a point on the surface of Earth. |
arrayValue |
An array value. In Standard edition databases, an array value cannot directly contain another array value, though it can contain a map which contains another array. In Enterprise edition databases, an array value can contain another array value. |
mapValue |
A map value. |
fieldReferenceValue |
Value which references a field. This is considered relative (vs absolute) since it only refers to a field and not a field within a particular document. Requires:
|
variableReferenceValue |
Pointer to a variable defined elsewhere in a pipeline. Unlike |
functionValue |
A value that represents an unevaluated expression. Requires:
|
pipelineValue |
A value that represents an unevaluated pipeline. Requires:
|
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. |
LatLng
| JSON representation |
|---|
{ "latitude": number, "longitude": number } |
| Fields | |
|---|---|
latitude |
The latitude in degrees. It must be in the range [-90.0, +90.0]. |
longitude |
The longitude in degrees. It must be in the range [-180.0, +180.0]. |
ArrayValue
| JSON representation |
|---|
{
"values": [
{
object ( |
| Fields | |
|---|---|
values[] |
Values in the array. |
MapValue
| JSON representation |
|---|
{
"fields": {
string: {
object ( |
| Fields | |
|---|---|
fields |
The map's fields. The map keys represent field names. Field names matching the regular expression An object containing a list of |
FieldsEntry
| JSON representation |
|---|
{
"key": string,
"value": {
object ( |
| Fields | |
|---|---|
key |
|
value |
|
Function
| JSON representation |
|---|
{ "name": string, "args": [ { object ( |
| Fields | |
|---|---|
name |
Required. The name of the function to evaluate. Requires:
|
args[] |
Optional. Ordered list of arguments the given function expects. |
options |
Optional. Optional named arguments that certain functions may support. An object containing a list of |
OptionsEntry
| JSON representation |
|---|
{
"key": string,
"value": {
object ( |
| Fields | |
|---|---|
key |
|
value |
|
Pipeline
| JSON representation |
|---|
{
"stages": [
{
object ( |
| Fields | |
|---|---|
stages[] |
Required. Ordered list of stages to evaluate. |
Stage
| JSON representation |
|---|
{ "name": string, "args": [ { object ( |
| Fields | |
|---|---|
name |
Required. The name of the stage to evaluate. Requires:
|
args[] |
Optional. Ordered list of arguments the given stage expects. |
options |
Optional. Optional named arguments that certain functions may support. An object containing a list of |
OptionsEntry
| JSON representation |
|---|
{
"key": string,
"value": {
object ( |
| Fields | |
|---|---|
key |
|
value |
|
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: ❌