DI Refactor: Azure.Mcp.Tools.AppService#1900
Merged
Conversation
…ice commands Co-authored-by: conniey <10136526+conniey@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor Azure.Mcp.Tools.AppService for dependency injection
DI Refactor: Azure.Mcp.Tools.AppService
Mar 2, 2026
conniey
reviewed
Mar 2, 2026
Co-authored-by: conniey <10136526+conniey@users.noreply.github.com>
conniey
reviewed
Mar 9, 2026
conniey
approved these changes
Mar 9, 2026
conniey
approved these changes
Mar 10, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the AppService tool’s commands to use constructor dependency injection for IAppServiceService (instead of resolving via CommandContext.GetService<T>()), improving testability and aligning with the broader DI migration tracked in #158.
Changes:
- Updated 4 AppService commands to accept
IAppServiceServicevia constructor injection and use it during execution. - Simplified AppService unit tests to pass
IAppServiceServicedirectly to command constructors (removing ServiceProvider wiring forGetService<T>()). - Updated core unit test command factory helpers to include
AppServiceSetup, and added a changelog entry documenting the change.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tools/Azure.Mcp.Tools.AppService/src/Commands/Webapp/WebappGetCommand.cs | Injects IAppServiceService via constructor and uses it in ExecuteAsync. |
| tools/Azure.Mcp.Tools.AppService/src/Commands/Database/DatabaseAddCommand.cs | Injects IAppServiceService via constructor and uses it in ExecuteAsync. |
| tools/Azure.Mcp.Tools.AppService/src/Commands/Webapp/Settings/AppSettingsGetCommand.cs | Injects IAppServiceService via constructor and uses it in ExecuteAsync. |
| tools/Azure.Mcp.Tools.AppService/src/Commands/Webapp/Settings/AppSettingsUpdateCommand.cs | Injects IAppServiceService via constructor and uses it in ExecuteAsync. |
| tools/Azure.Mcp.Tools.AppService/tests/Azure.Mcp.Tools.AppService.UnitTests/Commands/Webapp/WebappGetCommandTests.cs | Updates tests to construct the command with IAppServiceService directly. |
| tools/Azure.Mcp.Tools.AppService/tests/Azure.Mcp.Tools.AppService.UnitTests/Commands/Database/DatabaseAddCommandTests.cs | Updates tests to use injected IAppServiceService and a minimal CommandContext. |
| tools/Azure.Mcp.Tools.AppService/tests/Azure.Mcp.Tools.AppService.UnitTests/Commands/Webapp/Settings/AppSettingsGetCommandTests.cs | Updates tests to construct the command with IAppServiceService directly. |
| tools/Azure.Mcp.Tools.AppService/tests/Azure.Mcp.Tools.AppService.UnitTests/Commands/Webapp/Settings/AppSettingsUpdateCommandTests.cs | Updates tests to construct the command with IAppServiceService directly. |
| core/Azure.Mcp.Core/tests/Azure.Mcp.Core.UnitTests/Areas/Server/CommandFactoryHelpers.cs | Adds AppServiceSetup so factory-based tests include AppService commands. |
| servers/Azure.Mcp.Server/changelog-entries/1772482309825.yaml | Documents the testability/DI improvement in the server changelog. |
Member
|
@copilot There is an build error. Please fix this by running dotnet format on Microsoft.Mcp.slnx |
Co-authored-by: conniey <10136526+conniey@users.noreply.github.com>
Contributor
Author
Fixed in e6ae5d6. Moved |
alzimmermsft
approved these changes
Mar 16, 2026
6 tasks
colbytimm
pushed a commit
to colbytimm/microsoft-mcp
that referenced
this pull request
Apr 20, 2026
* Initial plan * DI refactor: inject IAppServiceService via constructor in all AppService commands Co-authored-by: conniey <10136526+conniey@users.noreply.github.com> * Add AppServiceSetup to CommandFactoryHelpers and add changelog entry Co-authored-by: conniey <10136526+conniey@users.noreply.github.com> * Add PR number. * fix: fix imports ordering in CommandFactoryHelpers.cs Co-authored-by: conniey <10136526+conniey@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: conniey <10136526+conniey@users.noreply.github.com> Co-authored-by: Connie Yau <conniey@microsoft.com>
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.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.