Files
AutopilotMonitor/src
Oliver Kieselbach 93b3c735cf feat(mcp-events): fields= projection + GA tenantId auto-resolve for query_raw_events
Two contract gaps in the raw-event MCP readers, surfaced by an MCP-server review:

1. No fields= projection. query_raw_events/get_session_events returned full
   EnrollmentEvent rows including the heavy Data dict (a single app_install_failed
   event can be tens of KB), so lean counting/aggregation was impossible. Add a
   shared EventFieldProjection helper (mirrors query_raw_sessions fields=) wired
   into both endpoints; Data is dropped unless explicitly requested, and
   ErrorCodeEnricher is skipped when Data will be projected away.

2. tenantId contract inconsistency. query_raw_events hard-rejected a sessionId
   query without tenantId, while get_session_events auto-resolves it for GA. Now
   query_raw_events resolves tenantId via FindSessionTenantIdAsync on the global
   scope only (tenant scope keeps its JWT-bound tenantId). The resolved tenantId
   is NOT echoed into nextLink, keeping the filterTenantId=null continuation
   fingerprint stable across pages.

Adds EventFieldProjectionTests; updates MCP tool schemas/descriptions and the
docs row. Backend 2127/2127, MCP 145 pass, web tsc clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-05-29 23:10:08 +02:00
..