# Copyright 2025 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. kind: source name: firestore-source type: firestore project: ${FIRESTORE_PROJECT} database: ${FIRESTORE_DATABASE:} --- kind: tool name: get_documents type: firestore-get-documents source: firestore-source description: Gets multiple documents from Firestore by their paths --- kind: tool name: add_documents type: firestore-add-documents source: firestore-source description: | Adds a new document to a Firestore collection. Please follow the best practices : 1. Always use typed values in the documentData: Every field must be wrapped with its appropriate type indicator (e.g., {"stringValue": "text"}) 2. Integer values can be strings in the documentData: The tool accepts integer values as strings (e.g., {"integerValue": "1500"}) 3. Use returnData sparingly: Only set to true when you need to verify the exact data that was written 4. Validate data before sending: Ensure your data matches Firestore's native JSON format 5. Handle timestamps properly: Use RFC3339 format for timestamp strings 6. Base64 encode binary data: Binary data must be base64 encoded in the bytesValue field 7. Consider security rules: Ensure your Firestore security rules allow document creation in the target collection --- kind: tool name: update_document type: firestore-update-document source: firestore-source description: | Updates an existing document in Firestore. Supports both full document updates and selective field updates using an update mask. Please follow the best practices: 1. Use update masks for precision: When you only need to update specific fields, use the updateMask parameter to avoid unintended changes 2. Always use typed values in the documentData: Every field must be wrapped with its appropriate type indicator (e.g., {"stringValue": "text"}) 3. Delete fields using update mask: To delete fields, include them in the updateMask but omit them from documentData 4. Integer values can be strings: The tool accepts integer values as strings (e.g., {"integerValue": "1500"}) 5. Use returnData sparingly: Only set to true when you need to verify the exact data after the update 6. Handle timestamps properly: Use RFC3339 format for timestamp strings 7. Consider security rules: Ensure your Firestore security rules allow document updates --- kind: tool name: list_collections type: firestore-list-collections source: firestore-source description: List Firestore collections for a given parent path --- kind: tool name: delete_documents type: firestore-delete-documents source: firestore-source description: Delete multiple documents from Firestore --- kind: tool name: query_collection type: firestore-query-collection source: firestore-source description: | Retrieves one or more Firestore documents from a collection in a database in the current project by a collection with a full document path. Use this if you know the exact path of a collection and the filtering clause you would like for the document. --- kind: tool name: get_rules type: firestore-get-rules source: firestore-source description: Retrieves the active Firestore security rules for the current project --- kind: tool name: validate_rules type: firestore-validate-rules source: firestore-source description: Checks the provided Firestore Rules source for syntax and validation errors. Provide the source code to validate. --- kind: toolset name: data tools: - get_documents - add_documents - update_document - delete_documents - query_collection - list_collections --- kind: toolset name: security tools: - get_rules - validate_rules