query_analytics
Run guarded read-only Azure DevOps Analytics OData queries and $apply aggregations across work tracking, pipeline, and test entities for historical trends and reporting.
Instructions
Execute guarded read-only Azure DevOps Analytics OData v4 queries and $apply aggregations across Work Tracking, Pipelines, and Test entities (supports Cloud and on-prem Server). IMPORTANT CAVEATS: (1) Analytics has no area-path-level security — users with View analytics permission see work items across all area paths in the project; (2) Analytics data has eventual consistency lag (seconds to minutes behind real-time state) — use REST APIs for real-time checks and OData Analytics for historical trends and aggregations.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"entitySet": "<entitySet>"
},
"name": "query_analytics"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| top | No | Maximum number of rows to return ($top; default: 100, hard max: 1000). | |
| skip | No | Number of rows to skip ($skip). Prefer nextLink for large datasets. | |
| apply | No | OData $apply aggregation pipeline (e.g. "groupby((DateSK,State),aggregate($count as ItemCount))"). Required for all *Snapshot entities. | |
| count | No | Include total matching row count ($count=true, returned as @odata.count). | |
| scope | No | Query scope: "project" (recommended default) or "organization" (opt-in org/collection-wide query; requires View analytics across projects). | project |
| expand | No | OData $expand clause with nested $select (e.g. "AssignedTo($select=UserName)"). Expanding Revisions on WorkItems is blocked (query WorkItemRevisions instead). | |
| filter | No | OData $filter expression (e.g. "State eq 'Active' and ChangedDate ge 2026-11-01T00:00:00Z"). DateTimeOffset literals MUST include a timezone offset (Z or ±HH:MM). | |
| select | No | Fields to return ($select, max 800 columns). If both select and apply are omitted, a safe bounded default $select is automatically injected. | |
| orderby | No | OData $orderby clause (e.g. "StoryPoints desc"). | |
| version | No | Azure DevOps Analytics OData version (default: "v3.0-preview"). | v3.0-preview |
| nextLink | No | Explicit same-origin @odata.nextLink URL from a previous query_analytics page. Off-origin URLs are rejected before sending any request. | |
| entitySet | Yes | Target OData entity set (e.g. "WorkItems", "WorkItemRevisions", "WorkItemSnapshot", "PipelineRuns", "TestResultsDaily"). Plain entity set name only — key addressing like WorkItems(123) is blocked. | |
| projectId | No | Project ID or name (defaults to AZURE_DEVOPS_DEFAULT_PROJECT when scope is "project"). | |
| organizationId | No | Optional Azure DevOps organization (Cloud) or collection (Server) override. |