feat(mcp): Add support for filtering on reference_value and timestamp_value in firestore_query_collection#10481
Open
MrAlek wants to merge 3 commits into
Open
feat(mcp): Add support for filtering on reference_value and timestamp_value in firestore_query_collection#10481MrAlek wants to merge 3 commits into
MrAlek wants to merge 3 commits into
Conversation
Adds a `reference_value` field to the `compare_value` schema so MCP clients can filter Firestore collections by document reference. Relative document paths are expanded to a full resource name using the active project and database; full resource names are passed through unchanged.
Adds a `timestamp_value` field to the `compare_value` schema, encoded as a Firestore `timestampValue` (RFC 3339/ISO 8601) so MCP clients can filter collections by date/time fields.
Contributor
There was a problem hiding this comment.
Code Review
This pull request enhances the Firestore tool by adding support for reference_value and timestamp_value filters in the query_collection tool, including automatic expansion of relative document paths to full resource names. Feedback highlights a critical bug in the filter validation logic that could lead to runtime crashes or incorrect filtering when multiple values are provided. Additionally, a violation of the repository style guide was noted regarding the use of generic errors instead of FirebaseError for user-facing exceptions.
…collection The previous `&&`-chained guard only triggered when *all* compare_value fields were set simultaneously, so it never caught a request with two values, and an empty `compare_value` crashed on `out[0]` destructuring. Switch to a length check so any count other than 1 produces a clean error, and align with the rest of the file by returning the error instead of throwing. Also use `mcpError` for the missing-projectId guard in the firestore converter for consistency.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds the ability to filter on reference values and timestamps in the firestore MCP.
Scenarios Tested
Tested through MCP Inspector.
Sample Commands