Extend ExecuteResourceQueryAsync to return a model type with more information#1526
Merged
alzimmermsft merged 8 commits intomicrosoft:mainfrom Jan 27, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the BaseAzureResourceService.ExecuteResourceQueryAsync method to return a ResourceQueryResults<T> wrapper type that includes both the query results and a TruncatedResults boolean flag. This flag indicates whether the Azure Resource Graph query limit prevented all matching resources from being returned.
Changes:
- Introduces a new
ResourceQueryResults<T>record type withResultsandTruncatedResultsproperties - Updates
ExecuteResourceQueryAsyncinBaseAzureResourceServiceto return the new wrapper type - Updates service interfaces and implementations across 7 tool packages (ACR, AppConfig, Authorization, Grafana, Kusto, SQL, Storage)
- Updates command result records to include the
TruncatedResultsfield - Updates all unit tests to work with the new return type
- Improves test patterns by replacing
Task.FromExceptionwithThrowsAsyncfor NSubstitute mocks
Reviewed changes
Copilot reviewed 33 out of 33 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| core/Azure.Mcp.Core/src/Services/Azure/BaseAzureResourceService.cs | Adds ResourceQueryResults<T> record and updates ExecuteResourceQueryAsync return type to include truncation information |
| tools/Azure.Mcp.Tools.Storage/src/Services/IStorageService.cs | Updates GetAccountDetails signature to return ResourceQueryResults<StorageAccountInfo> |
| tools/Azure.Mcp.Tools.Storage/src/Services/StorageService.cs | Implements new return type for GetAccountDetails, returns wrapper with truncation flag |
| tools/Azure.Mcp.Tools.Sql/src/Services/ISqlService.cs | Updates ListDatabasesAsync and GetElasticPoolsAsync signatures to return ResourceQueryResults |
| tools/Azure.Mcp.Tools.Sql/src/Services/SqlService.cs | Implements new return types for database and elastic pool listing methods |
| tools/Azure.Mcp.Tools.Sql/src/Commands/Database/DatabaseListCommand.cs | Updates result record to include TruncatedResults and extracts both properties from service response |
| tools/Azure.Mcp.Tools.Sql/src/Commands/ElasticPool/ElasticPoolListCommand.cs | Updates result record to include TruncatedResults and extracts both properties from service response |
| tools/Azure.Mcp.Tools.Kusto/src/Services/IKustoService.cs | Updates ListClustersAsync signature to return ResourceQueryResults<string> |
| tools/Azure.Mcp.Tools.Kusto/src/Services/KustoService.cs | Implements new return type for cluster listing |
| tools/Azure.Mcp.Tools.Kusto/src/Commands/ClusterListCommand.cs | Updates result record and extracts truncation information |
| tools/Azure.Mcp.Tools.Grafana/src/Services/IGrafanaService.cs | Updates ListWorkspacesAsync signature to return ResourceQueryResults<GrafanaWorkspace> |
| tools/Azure.Mcp.Tools.Grafana/src/Services/GrafanaService.cs | Implements new return type for workspace listing |
| tools/Azure.Mcp.Tools.Grafana/src/Commands/Workspace/WorkspaceListCommand.cs | Updates result record and extracts truncation information |
| tools/Azure.Mcp.Tools.Authorization/src/Services/IAuthorizationService.cs | Updates ListRoleAssignmentsAsync signature to return ResourceQueryResults<RoleAssignment> |
| tools/Azure.Mcp.Tools.Authorization/src/Services/AuthorizationService.cs | Implements new return type for role assignment listing |
| tools/Azure.Mcp.Tools.Authorization/src/Commands/RoleAssignmentListCommand.cs | Updates result record and extracts truncation information |
| tools/Azure.Mcp.Tools.AppConfig/src/Services/IAppConfigService.cs | Updates GetAppConfigAccounts signature to return ResourceQueryResults<AppConfigurationAccount> |
| tools/Azure.Mcp.Tools.AppConfig/src/Services/AppConfigService.cs | Implements new return type for account listing |
| tools/Azure.Mcp.Tools.AppConfig/src/Commands/Account/AccountListCommand.cs | Updates result record and extracts truncation information |
| tools/Azure.Mcp.Tools.Acr/src/Services/IAcrService.cs | Updates ListRegistries signature to return ResourceQueryResults<AcrRegistryInfo> |
| tools/Azure.Mcp.Tools.Acr/src/Services/AcrService.cs | Implements new return type for registry listing |
| tools/Azure.Mcp.Tools.Acr/src/Commands/Registry/RegistryListCommand.cs | Updates result record and extracts truncation information |
| Various test files | Updates mocks and expectations to use ResourceQueryResults wrapper, improves test patterns with ThrowsAsync |
| servers/Azure.Mcp.Server/docs/new-command.md | Updates documentation example to show new return type |
| AGENTS.md | Updates service implementation example to show new return type |
| core/Azure.Mcp.Core/tests/.../SubscriptionCommandTests.cs | Updates tests to work with new return type |
JasonYeMSFT
reviewed
Jan 20, 2026
JasonYeMSFT
approved these changes
Jan 27, 2026
colbytimm
pushed a commit
to colbytimm/microsoft-mcp
that referenced
this pull request
Apr 20, 2026
…ormation (microsoft#1526) * Extend ExecuteResourceQueryAsync to return a model type with more information * Fix compilation * Fix linting * Add CHANGELOG entry * Update based on feedback * Update new tool * Fix linting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Extends
BaseAzureResouceService.ExecuteResourceQueryAsyncto return a model type that can be extended with additional information in the future.In this PR,
TruncatedResultsis added to the results returned byExecuteResourceQueryAsyncto indicate if the query limit prevented results from being returned, or in other words indicating if results were truncated and additional queries are needed to get all the results. At this time this is nothing more than information for the LLM and user as acting on truncation won't be available until paging is implemented.GitHub issue number?
[Link to the GitHub issue this PR addresses]Pre-merge Checklist
servers/Azure.Mcp.Server/CHANGELOG.mdand/orservers/Fabric.Mcp.Server/CHANGELOG.mdfor product changes (features, bug fixes, UI/UX, updated dependencies)servers/Azure.Mcp.Server/README.mdand/orservers/Fabric.Mcp.Server/README.mddocumentationeng/scripts/Process-PackageReadMe.ps1. See Package README/servers/Azure.Mcp.Server/docs/azmcp-commands.mdand/or/docs/fabric-commands.md.\eng\scripts\Update-AzCommandsMetadata.ps1to update tool metadata in azmcp-commands.md (required for CI)ToolDescriptionEvaluatorand obtained a score of0.4or more and a top 3 ranking for all related test promptsconsolidated-tools.json/servers/Azure.Mcp.Server/docs/e2eTestPrompts.mdcrypto mining, spam, data exfiltration, etc.)/azp run mcp - pullrequest - liveto run Live Test Pipeline