diff --git a/src/Backend/AutopilotMonitor.Functions/Functions/Sessions/SearchSessionsFunction.cs b/src/Backend/AutopilotMonitor.Functions/Functions/Sessions/SearchSessionsFunction.cs index 2c1770ef..51fee81d 100644 --- a/src/Backend/AutopilotMonitor.Functions/Functions/Sessions/SearchSessionsFunction.cs +++ b/src/Backend/AutopilotMonitor.Functions/Functions/Sessions/SearchSessionsFunction.cs @@ -210,6 +210,8 @@ public class SearchSessionsFunction if (fields.Contains("imeAgentVersion")) dict["imeAgentVersion"] = s.ImeAgentVersion; if (fields.Contains("geoCountry")) dict["geoCountry"] = s.GeoCountry; if (fields.Contains("rebootCount")) dict["rebootCount"] = s.RebootCount; + if (fields.Contains("avgApiLatencyMs")) dict["avgApiLatencyMs"] = s.AvgApiLatencyMs; + if (fields.Contains("apiRequestCount")) dict["apiRequestCount"] = s.ApiRequestCount; if (dict.Count == 0) { diff --git a/src/McpServer/autopilot-monitor-mcp/src/tools/admin.ts b/src/McpServer/autopilot-monitor-mcp/src/tools/admin.ts index ed024f4e..dc97647f 100644 --- a/src/McpServer/autopilot-monitor-mcp/src/tools/admin.ts +++ b/src/McpServer/autopilot-monitor-mcp/src/tools/admin.ts @@ -295,7 +295,9 @@ export function registerAdminTools(server: McpServer, ga: boolean, strictGa: boo title: 'Geographic Metrics', description: 'Get geographic distribution of enrollments — where devices are enrolling from, with performance comparisons. ' + - 'Shows per-location: session counts, success rates, avg/median/p95 duration, throughput, and outlier detection. ' + + 'Shows per-location: session counts, success rates, avg/median/p95 duration, throughput, outlier detection, and ' + + 'avgApiLatencyMs (agent→backend HTTP round-trip, request-weighted — the metric for judging backend-region distance, ' + + 'e.g. when evaluating a new backend region; apiLatencyVsGlobalPct compares against the global weighted average). ' + (ga ? 'Omit tenantId for cross-tenant view (Global Admin). ' : '') + 'Use get_geographic_sessions to drill into a specific location. ' + 'days accepts any value 1-365 (e.g. 5, 7, 12, 30, 90).', diff --git a/src/McpServer/autopilot-monitor-mcp/src/tools/sessions.ts b/src/McpServer/autopilot-monitor-mcp/src/tools/sessions.ts index 0f811819..f1a710f8 100644 --- a/src/McpServer/autopilot-monitor-mcp/src/tools/sessions.ts +++ b/src/McpServer/autopilot-monitor-mcp/src/tools/sessions.ts @@ -144,7 +144,9 @@ export function registerSessionTools(server: McpServer, ga: boolean, delegated: 'Use for counting / aggregation to avoid the response cap. Available: sessionId, tenantId, status, ' + 'serialNumber, manufacturer, model, deviceName, osBuild, osName, startedAt, completedAt, ' + 'durationSeconds, currentPhase, failureReason, eventCount, enrollmentType, isPreProvisioned, ' + - 'isUserDriven, isHybridJoin, isSelfDeployingProfile, agentVersion, imeAgentVersion, geoCountry, rebootCount.'), + 'isUserDriven, isHybridJoin, isSelfDeployingProfile, agentVersion, imeAgentVersion, geoCountry, rebootCount, ' + + 'avgApiLatencyMs, apiRequestCount (agent→backend HTTP round-trip; weight latency by apiRequestCount when aggregating, ' + + 'e.g. fields=geoCountry,avgApiLatencyMs,apiRequestCount for a per-country latency sweep; null on sessions from agents predating the field).'), deviceProperties: z.record(z.string(), z.string()).optional().describe( 'Dynamic device property filters. Keys use "eventType.propertyName" dot notation. ' + 'See the device_properties catalog (call get_resource(name="device_properties")) for all available keys and types. ' +