run_aggregation_query
Run an aggregation query against a Firestore database. Executes an aggregation query (such as COUNT, SUM, or AVG) over a structured query and returns the aggregated results. Required Parameters: - parent: The parent resource name in projects/{project_id}/databases/{database_id}/documents format (...
This record as markdown: /tools/com-googleapis-firestore-mcp/run-aggregation-query.md
What run_aggregation_query does on Mcp
AI agents invoke run_aggregation_query to trigger actions in Mcp. What it does depends on the arguments the agent supplies, and its effects often reach beyond the immediate call: builds kicked off, notifications sent, workflows started.
| Parameter | Type | Required | Description |
|---|---|---|---|
parent | string | Yes | Required. The parent resource name. In the format: `projects/{project_id}/databases/{database_id}/documents` or `projects/{project_id}/databases/{database_id}/d |
readTime | string | — | Executes the query at the given timestamp. This must be a microsecond precision timestamp within the past one hour, or if Point-in-Time Recovery is enabled, can |
transaction | string | — | Run the aggregation within an already active transaction. The value here is the opaque transaction ID to execute the query in. |
explainOptions | object | — | Optional. Explain options for the query. If set, additional query statistics will be returned. If not, only query results will be returned. |
newTransaction | object | — | Starts a new transaction as part of the query, defaulting to read-only. The new transaction ID will be returned as the first response in the stream. |
requestOptions | object | — | Optional. The request options for the request. |
structuredAggregationQuery | object | — | An aggregation query. |
Parameters from the server's own tool schema.
Why run_aggregation_query is rated High
run_aggregation_query triggers real processes with real consequences. An agent gone sideways doesn't fire it once. It starts dozens of builds, sends mass notifications, or burns through compute before anyone looks up.
Attacks that exploit this kind of access
The rule that runs run_aggregation_query safely
PolicyLayer is an MCP gateway: it sits between your AI agents and Mcp, and checks every tool call against a rule you set before the call runs. Nothing changes on the server itself. For run_aggregation_query, this is the rule to start with:
run_aggregation_query stays usable, but rate-capped: a runaway agent can't fire it dozens of times a minute. Everything else on the server is denied unless you say otherwise.
The button opens the PolicyLayer dashboard: create your workspace, connect Mcp, apply this rule, and every run_aggregation_query call is checked against it from then on.
Questions about run_aggregation_query
Run an aggregation query against a Firestore database. Executes an aggregation query (such as COUNT, SUM, or AVG) over a structured query and returns the aggregated results. Required Parameters: - parent: The parent resource name in projects/{project_id}/databases/{database_id}/documents format (e.g., projects/my-project/databases/(default)/documents). - structured_aggregation_query: A StructuredAggregationQuery object defining the aggregation query to execute. Example usage (COUNT and AVG): json { "parent": "projects/my-project/databases/(default)/documents", "structured_aggregation_query": { "structured_query": { "from": [{"collection_id": "orders"}], "where": { "field_filter": { "field": {"field_path": "status"}, "op": "EQUAL", "value": {"string_value": "COMPLETED"} } } }, "aggregations": [ { "alias": "total_orders", "count": {} }, { "alias": "average_amount", "avg": { "field": {"field_path": "amount"} } } ] } }. It is categorised as a Execute tool in the Mcp MCP Server, which means it can trigger actions or run processes. Use rate limits and argument validation.
run_aggregation_query accepts 7 parameters: parent, readTime, transaction, explainOptions, newTransaction, requestOptions, structuredAggregationQuery. Required: parent. The full parameter table on this page comes from the server's own tool schema.
Register the MCP server in PolicyLayer and add a rule for run_aggregation_query: allow, deny, rate-limit, or require approval. Point your MCP client at the PolicyLayer proxy URL and the rule is enforced on every call, before it reaches Mcp. Nothing to install.
run_aggregation_query is a Execute tool with high risk. Execute tools should be rate-limited and have argument validation enabled.
Yes. Add a rate_limit block to the run_aggregation_query rule in your PolicyLayer policy. For example, setting max: 10 and window: 60 limits the tool to 10 calls per minute. Rate limits are tracked per agent session and reset automatically.
Set action: deny in the PolicyLayer policy for run_aggregation_query. The AI agent will receive a policy violation error and cannot call the tool. You can also include a reason field to explain why the tool is blocked.
run_aggregation_query is provided by the MCP server (https://firestore.googleapis.com/mcp). PolicyLayer sits as a proxy in front of this server to enforce policies before tool calls reach the server.
More on , and thousands of servers like it.
This server
Across the catalogue