You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(mcp): aggregate_records MCP tool over the engine read path (#2976)
* feat(mcp,runtime,plugin-security): aggregate_records MCP tool over the engine read path
Adds GROUP BY aggregation to the MCP surface so agents can answer
quantitative questions in one call instead of paging raw rows through
query_records (capped + token-expensive).
- mcp: new data:read tool aggregate_records (count/sum/avg/min/max/
count_distinct, groupBy incl. {field,dateGranularity} date bucketing,
where, timezone). Optional McpDataBridge.aggregate seam — runtimes that
omit it simply don't register the tool. Output rows capped at the query
limit with a truncated flag.
- runtime: callData('aggregate') branch resolves the ObjectQL ENGINE
(never the raw per-env dataDriver) so the security middleware — RLS,
tenant scoping, ADR-0090 D10 delegator intersection — always runs;
requires >=1 aggregation (the engine's in-memory path would otherwise
degrade to raw rows the FLS masker does not cover). aggregate maps to
the 'list' ApiMethod in the exposure gate.
- plugin-security: FLS aggregate-INPUT gate (2.5b) — result masking never
runs for aggregate and aliases hide field provenance, so groupBy /
aggregation references to FLS-unreadable fields are rejected
fail-closed with the offending names, including the D10 delegator
field-mask intersection.
Tests: mcp 72 passed (6 new: registration/degradation, delegation,
sys_* guard, min(1) schema, truncation, FLS error surface); plugin-
security 426 passed (3 new FLS aggregate gate cases); runtime 507
passed (new aggregate exposure-mapping case).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012RE5oFswe4DUvExuAgvbg2
* docs(ai): open MCP surface now ships server-side aggregation (aggregate_records)
natural-language-queries.mdx stated the open MCP surface has no
server-side aggregate tool and a BYO agent must sum client-side — the
aggregate_records tool added in this branch makes that false. Update the
tool enumeration + the aggregation callout, and keep the distinction
from the cloud dataset-level aggregate_data tool (cross-object / cubes).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012RE5oFswe4DUvExuAgvbg2
---------
Co-authored-by: Claude <noreply@anthropic.com>
0 commit comments