Skip to content

Commit d8fdb17

Browse files
committed
Standardize ToolingManifest file name usage
Replaced all hardcoded references to "toolingManifest.json" and "ToolingManifest.json" with McpConstants.ToolingManifestFileName. Updated command classes, helpers, validation, and tests for consistent manifest file handling and improved error/log messages.
1 parent 5b80a48 commit d8fdb17

10 files changed

Lines changed: 22 additions & 20 deletions

File tree

src/Microsoft.Agents.A365.DevTools.Cli/Commands/CreateInstanceCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public static Command CreateCommand(ILogger<CreateInstanceCommand> logger, IConf
126126
// Admin consent for MCP scopes (oauth2PermissionGrants)
127127
logger.LogInformation("Granting MCP scopes to Agent Identity via oauth2PermissionGrants");
128128

129-
var manifestPath = Path.Combine(instanceConfig.DeploymentProjectPath ?? string.Empty, "ToolingManifest.json");
129+
var manifestPath = Path.Combine(instanceConfig.DeploymentProjectPath ?? string.Empty, McpConstants.ToolingManifestFileName);
130130
var scopesForAgent = await ManifestHelper.GetRequiredScopesAsync(manifestPath);
131131

132132
// clientId must be the *service principal objectId* of the agentic app

src/Microsoft.Agents.A365.DevTools.Cli/Commands/DeployCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,8 @@ private static async Task DeployMcpToolPermissionsAsync(
337337
GraphApiService graphApiService,
338338
AgentBlueprintService blueprintService)
339339
{
340-
// Read scopes from toolingManifest.json (at deploymentProjectPath)
341-
var manifestPath = Path.Combine(config.DeploymentProjectPath ?? string.Empty, "toolingManifest.json");
340+
// Read scopes from ToolingManifest.json (at deploymentProjectPath)
341+
var manifestPath = Path.Combine(config.DeploymentProjectPath ?? string.Empty, McpConstants.ToolingManifestFileName);
342342
var toolingScopes = await ManifestHelper.GetRequiredScopesAsync(manifestPath);
343343

344344
// 1. Apply MCP OAuth2 permission grants

src/Microsoft.Agents.A365.DevTools.Cli/Commands/DevelopSubcommands/AddPermissionsSubcommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public static Command CreateCommand(
110110

111111
// Determine manifest path
112112
var manifestPath = manifest?.FullName
113-
?? Path.Combine(setupConfig?.DeploymentProjectPath ?? Environment.CurrentDirectory, "ToolingManifest.json");
113+
?? Path.Combine(setupConfig?.DeploymentProjectPath ?? Environment.CurrentDirectory, McpConstants.ToolingManifestFileName);
114114

115115
// Determine which scopes to add
116116
string[] requestedScopes;

src/Microsoft.Agents.A365.DevTools.Cli/Commands/DevelopSubcommands/GetTokenSubcommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public static Command CreateCommand(
101101

102102
// Determine manifest path
103103
var manifestPath = manifest?.FullName
104-
?? Path.Combine(setupConfig?.DeploymentProjectPath ?? Environment.CurrentDirectory, "ToolingManifest.json");
104+
?? Path.Combine(setupConfig?.DeploymentProjectPath ?? Environment.CurrentDirectory, McpConstants.ToolingManifestFileName);
105105

106106
// Determine which scopes to request
107107
string[] requestedScopes;

src/Microsoft.Agents.A365.DevTools.Cli/Commands/SetupSubcommands/PermissionsSubcommand.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ public static Task<List<string>> ValidateMcpAsync(
3434

3535
if (string.IsNullOrWhiteSpace(config.DeploymentProjectPath))
3636
{
37-
errors.Add("deploymentProjectPath is required to read toolingManifest.json");
37+
errors.Add("deploymentProjectPath is required to read ToolingManifest.json");
3838
return Task.FromResult(errors);
3939
}
4040

41-
var manifestPath = Path.Combine(config.DeploymentProjectPath, "toolingManifest.json");
41+
var manifestPath = Path.Combine(config.DeploymentProjectPath, McpConstants.ToolingManifestFileName);
4242
if (!File.Exists(manifestPath))
4343
{
44-
errors.Add($"toolingManifest.json not found at {manifestPath}");
44+
errors.Add($"ToolingManifest.json not found at {manifestPath}");
4545
}
4646

4747
return Task.FromResult(errors);
@@ -130,8 +130,8 @@ private static Command CreateMcpSubcommand(
130130

131131
if (dryRun)
132132
{
133-
// Read scopes from toolingManifest.json
134-
var manifestPath = Path.Combine(setupConfig.DeploymentProjectPath ?? string.Empty, "toolingManifest.json");
133+
// Read scopes from ToolingManifest.json
134+
var manifestPath = Path.Combine(setupConfig.DeploymentProjectPath ?? string.Empty, McpConstants.ToolingManifestFileName);
135135
var toolingScopes = await ManifestHelper.GetRequiredScopesAsync(manifestPath);
136136

137137
logger.LogInformation("DRY RUN: Configure MCP Permissions");
@@ -252,8 +252,8 @@ public static async Task<bool> ConfigureMcpPermissionsAsync(
252252

253253
try
254254
{
255-
// Read scopes from toolingManifest.json
256-
var manifestPath = Path.Combine(setupConfig.DeploymentProjectPath ?? string.Empty, "toolingManifest.json");
255+
// Read scopes from ToolingManifest.json
256+
var manifestPath = Path.Combine(setupConfig.DeploymentProjectPath ?? string.Empty, McpConstants.ToolingManifestFileName);
257257
var toolingScopes = await ManifestHelper.GetRequiredScopesAsync(manifestPath);
258258

259259
var resourceAppId = ConfigConstants.GetAgent365ToolsResourceAppId(setupConfig.Environment);

src/Microsoft.Agents.A365.DevTools.Cli/Helpers/ManifestHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public static List<object> ConvertToServerObjects(IEnumerable<JsonElement> jsonE
205205
}
206206

207207
/// <summary>
208-
/// Reads toolingManifest.json and returns the unique list of scopes required by all MCP servers.
208+
/// Reads ToolingManifest.json and returns the unique list of scopes required by all MCP servers.
209209
/// Strategy:
210210
/// 1) If a server entry has an explicit "scope" property, use it.
211211
/// 2) Otherwise, use McpConstants.ServerScopeMappings.GetScopeAndAudience(serverName).

src/Microsoft.Agents.A365.DevTools.Cli/Services/AuthenticationService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ public string[] ResolveScopesForResource(string resourceUrl, string? manifestPat
395395
if (string.IsNullOrWhiteSpace(manifestPath))
396396
{
397397
var currentDir = Environment.CurrentDirectory;
398-
manifestPath = Path.Combine(currentDir, "ToolingManifest.json");
398+
manifestPath = Path.Combine(currentDir, McpConstants.ToolingManifestFileName);
399399

400400
if (!File.Exists(manifestPath))
401401
{

src/Microsoft.Agents.A365.DevTools.Cli/Services/NodeBuilder.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the MIT License.
33

44
using System.Text.Json;
5+
using Microsoft.Agents.A365.DevTools.Cli.Constants;
56
using Microsoft.Agents.A365.DevTools.Cli.Exceptions;
67
using Microsoft.Agents.A365.DevTools.Cli.Models;
78
using Microsoft.Agents.A365.DevTools.Cli.Services.Helpers;
@@ -133,10 +134,10 @@ public async Task<string> BuildAsync(string projectDir, string outputPath, bool
133134
}
134135

135136
// Copy ToolingManifest if exists
136-
var toolingManifestPath = Path.Combine(projectDir, "ToolingManifest.json");
137+
var toolingManifestPath = Path.Combine(projectDir, McpConstants.ToolingManifestFileName);
137138
if (File.Exists(toolingManifestPath))
138139
{
139-
File.Copy(toolingManifestPath, Path.Combine(publishPath, "ToolingManifest.json"));
140+
File.Copy(toolingManifestPath, Path.Combine(publishPath, McpConstants.ToolingManifestFileName));
140141
}
141142

142143
// Copy source files (src, lib, etc.)

src/Tests/Microsoft.Agents.A365.DevTools.Cli.Tests/Commands/SubcommandValidationTests.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using FluentAssertions;
55
using Microsoft.Agents.A365.DevTools.Cli.Commands.SetupSubcommands;
6+
using Microsoft.Agents.A365.DevTools.Cli.Constants;
67
using Microsoft.Agents.A365.DevTools.Cli.Models;
78
using Microsoft.Agents.A365.DevTools.Cli.Services;
89
using Microsoft.Agents.A365.DevTools.Cli.Services.Requirements;
@@ -265,7 +266,7 @@ public async Task PermissionsSubcommand_ValidateMcp_WithValidConfig_PassesValida
265266
// Arrange
266267
var tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
267268
Directory.CreateDirectory(tempDir);
268-
var manifestPath = Path.Combine(tempDir, "toolingManifest.json");
269+
var manifestPath = Path.Combine(tempDir, McpConstants.ToolingManifestFileName);
269270
await File.WriteAllTextAsync(manifestPath, "{}");
270271

271272
try
@@ -295,7 +296,7 @@ public async Task PermissionsSubcommand_ValidateMcp_WithMissingBlueprintId_Fails
295296
// Arrange
296297
var tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
297298
Directory.CreateDirectory(tempDir);
298-
var manifestPath = Path.Combine(tempDir, "toolingManifest.json");
299+
var manifestPath = Path.Combine(tempDir, McpConstants.ToolingManifestFileName);
299300
await File.WriteAllTextAsync(manifestPath, "{}");
300301

301302
try
@@ -340,7 +341,7 @@ public async Task PermissionsSubcommand_ValidateMcp_WithMissingManifest_FailsVal
340341

341342
// Assert
342343
errors.Should().ContainSingle()
343-
.Which.Should().Contain("toolingManifest.json");
344+
.Which.Should().Contain("ToolingManifest.json");
344345
}
345346
finally
346347
{

src/Tests/Microsoft.Agents.A365.DevTools.Cli.Tests/Services/AuthenticationServiceTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ public void ResolveScopesForResource_WithNoManifestPath_ShouldLookForLocalManife
464464
{
465465
// Arrange
466466
var currentDir = Environment.CurrentDirectory;
467-
var localManifestPath = Path.Combine(currentDir, "ToolingManifest.json");
467+
var localManifestPath = Path.Combine(currentDir, McpConstants.ToolingManifestFileName);
468468
var manifestCreated = false;
469469

470470
try

0 commit comments

Comments
 (0)