Skip to content

Commit a6690fc

Browse files
committed
fix: remove .enabled suffix from individual DML tool configure options (#3373)
The dab configure command used option names like --runtime.mcp.dml-tools.describe-entities.enabled which implied a nested object structure ({ describe-entities: { enabled: true } }). The schema expects direct booleans ({ describe-entities: true }). Removed the .enabled suffix from 7 individual DML tool option names in ConfigureOptions.cs. Added 3 test methods (5 test cases) covering individual, bulk, and multi-tool configure scenarios.
1 parent b84418d commit a6690fc

2 files changed

Lines changed: 95 additions & 7 deletions

File tree

src/Cli.Tests/ConfigureOptionsTests.cs

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,6 +1081,94 @@ public void TestConfigureDescriptionForMcpSettings(string descriptionValue)
10811081
Assert.AreEqual(descriptionValue, runtimeConfig.Runtime.Mcp.Description);
10821082
}
10831083

1084+
/// <summary>
1085+
/// Tests that running "dab configure --runtime.mcp.dml-tools.{tool} {value}" updates
1086+
/// the individual DML tool boolean in the runtime config. Each tool is a direct boolean
1087+
/// in the schema (e.g., "describe-entities": true), NOT a nested object with .enabled.
1088+
/// </summary>
1089+
[DataTestMethod]
1090+
[DataRow(true, DisplayName = "Enable individual DML tool: describe-entities")]
1091+
[DataRow(false, DisplayName = "Disable individual DML tool: describe-entities")]
1092+
public void TestConfigureIndividualDmlToolForMcpSettings(bool updatedValue)
1093+
{
1094+
// Arrange
1095+
SetupFileSystemWithInitialConfig(INITIAL_CONFIG);
1096+
1097+
// Act: Set describe-entities via the corrected option name (no .enabled suffix)
1098+
ConfigureOptions options = new(
1099+
runtimeMcpDmlToolsDescribeEntitiesEnabled: updatedValue,
1100+
config: TEST_RUNTIME_CONFIG_FILE
1101+
);
1102+
bool isSuccess = TryConfigureSettings(options, _runtimeConfigLoader!, _fileSystem!);
1103+
1104+
// Assert
1105+
Assert.IsTrue(isSuccess);
1106+
string updatedConfig = _fileSystem!.File.ReadAllText(TEST_RUNTIME_CONFIG_FILE);
1107+
Assert.IsTrue(RuntimeConfigLoader.TryParseConfig(updatedConfig, out RuntimeConfig? runtimeConfig));
1108+
Assert.IsNotNull(runtimeConfig.Runtime?.Mcp?.DmlTools);
1109+
Assert.AreEqual(updatedValue, runtimeConfig.Runtime.Mcp.DmlTools.DescribeEntities);
1110+
}
1111+
1112+
/// <summary>
1113+
/// Tests that running "dab configure --runtime.mcp.dml-tools.enabled {value}" sets all
1114+
/// DML tools at once via the bulk toggle.
1115+
/// </summary>
1116+
[DataTestMethod]
1117+
[DataRow(true, DisplayName = "Enable all DML tools at once")]
1118+
[DataRow(false, DisplayName = "Disable all DML tools at once")]
1119+
public void TestConfigureAllDmlToolsForMcpSettings(bool updatedValue)
1120+
{
1121+
// Arrange
1122+
SetupFileSystemWithInitialConfig(INITIAL_CONFIG);
1123+
1124+
// Act: Set all tools via the bulk enabled toggle
1125+
ConfigureOptions options = new(
1126+
runtimeMcpDmlToolsEnabled: updatedValue,
1127+
config: TEST_RUNTIME_CONFIG_FILE
1128+
);
1129+
bool isSuccess = TryConfigureSettings(options, _runtimeConfigLoader!, _fileSystem!);
1130+
1131+
// Assert
1132+
Assert.IsTrue(isSuccess);
1133+
string updatedConfig = _fileSystem!.File.ReadAllText(TEST_RUNTIME_CONFIG_FILE);
1134+
Assert.IsTrue(RuntimeConfigLoader.TryParseConfig(updatedConfig, out RuntimeConfig? runtimeConfig));
1135+
Assert.IsNotNull(runtimeConfig.Runtime?.Mcp?.DmlTools);
1136+
Assert.AreEqual(updatedValue, runtimeConfig.Runtime.Mcp.DmlTools.DescribeEntities);
1137+
Assert.AreEqual(updatedValue, runtimeConfig.Runtime.Mcp.DmlTools.CreateRecord);
1138+
Assert.AreEqual(updatedValue, runtimeConfig.Runtime.Mcp.DmlTools.ReadRecords);
1139+
Assert.AreEqual(updatedValue, runtimeConfig.Runtime.Mcp.DmlTools.UpdateRecord);
1140+
Assert.AreEqual(updatedValue, runtimeConfig.Runtime.Mcp.DmlTools.DeleteRecord);
1141+
Assert.AreEqual(updatedValue, runtimeConfig.Runtime.Mcp.DmlTools.ExecuteEntity);
1142+
Assert.AreEqual(updatedValue, runtimeConfig.Runtime.Mcp.DmlTools.AggregateRecords);
1143+
}
1144+
1145+
/// <summary>
1146+
/// Tests that running "dab configure" with multiple individual DML tool options
1147+
/// correctly updates each tool independently.
1148+
/// </summary>
1149+
[TestMethod]
1150+
public void TestConfigureMultipleIndividualDmlToolsForMcpSettings()
1151+
{
1152+
// Arrange
1153+
SetupFileSystemWithInitialConfig(INITIAL_CONFIG);
1154+
1155+
// Act: Enable describe-entities, disable create-record
1156+
ConfigureOptions options = new(
1157+
runtimeMcpDmlToolsDescribeEntitiesEnabled: true,
1158+
runtimeMcpDmlToolsCreateRecordEnabled: false,
1159+
config: TEST_RUNTIME_CONFIG_FILE
1160+
);
1161+
bool isSuccess = TryConfigureSettings(options, _runtimeConfigLoader!, _fileSystem!);
1162+
1163+
// Assert
1164+
Assert.IsTrue(isSuccess);
1165+
string updatedConfig = _fileSystem!.File.ReadAllText(TEST_RUNTIME_CONFIG_FILE);
1166+
Assert.IsTrue(RuntimeConfigLoader.TryParseConfig(updatedConfig, out RuntimeConfig? runtimeConfig));
1167+
Assert.IsNotNull(runtimeConfig.Runtime?.Mcp?.DmlTools);
1168+
Assert.AreEqual(true, runtimeConfig.Runtime.Mcp.DmlTools.DescribeEntities);
1169+
Assert.AreEqual(false, runtimeConfig.Runtime.Mcp.DmlTools.CreateRecord);
1170+
}
1171+
10841172
/// <summary>
10851173
/// Validates that `dab configure --show-effective-permissions` correctly displays
10861174
/// effective permissions without modifying the config file.

src/Cli/Commands/ConfigureOptions.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -212,25 +212,25 @@ public ConfigureOptions(
212212
[Option("runtime.mcp.dml-tools.enabled", Required = false, HelpText = "Enable DAB's MCP DML tools endpoint. Default: true (boolean).")]
213213
public bool? RuntimeMcpDmlToolsEnabled { get; }
214214

215-
[Option("runtime.mcp.dml-tools.describe-entities.enabled", Required = false, HelpText = "Enable DAB's MCP describe entities tool. Default: true (boolean).")]
215+
[Option("runtime.mcp.dml-tools.describe-entities", Required = false, HelpText = "Enable DAB's MCP describe entities tool. Default: true (boolean).")]
216216
public bool? RuntimeMcpDmlToolsDescribeEntitiesEnabled { get; }
217217

218-
[Option("runtime.mcp.dml-tools.create-record.enabled", Required = false, HelpText = "Enable DAB's MCP create record tool. Default: true (boolean).")]
218+
[Option("runtime.mcp.dml-tools.create-record", Required = false, HelpText = "Enable DAB's MCP create record tool. Default: true (boolean).")]
219219
public bool? RuntimeMcpDmlToolsCreateRecordEnabled { get; }
220220

221-
[Option("runtime.mcp.dml-tools.read-records.enabled", Required = false, HelpText = "Enable DAB's MCP read record tool. Default: true (boolean).")]
221+
[Option("runtime.mcp.dml-tools.read-records", Required = false, HelpText = "Enable DAB's MCP read record tool. Default: true (boolean).")]
222222
public bool? RuntimeMcpDmlToolsReadRecordsEnabled { get; }
223223

224-
[Option("runtime.mcp.dml-tools.update-record.enabled", Required = false, HelpText = "Enable DAB's MCP update record tool. Default: true (boolean).")]
224+
[Option("runtime.mcp.dml-tools.update-record", Required = false, HelpText = "Enable DAB's MCP update record tool. Default: true (boolean).")]
225225
public bool? RuntimeMcpDmlToolsUpdateRecordEnabled { get; }
226226

227-
[Option("runtime.mcp.dml-tools.delete-record.enabled", Required = false, HelpText = "Enable DAB's MCP delete record tool. Default: true (boolean).")]
227+
[Option("runtime.mcp.dml-tools.delete-record", Required = false, HelpText = "Enable DAB's MCP delete record tool. Default: true (boolean).")]
228228
public bool? RuntimeMcpDmlToolsDeleteRecordEnabled { get; }
229229

230-
[Option("runtime.mcp.dml-tools.execute-entity.enabled", Required = false, HelpText = "Enable DAB's MCP execute entity tool. Default: true (boolean).")]
230+
[Option("runtime.mcp.dml-tools.execute-entity", Required = false, HelpText = "Enable DAB's MCP execute entity tool. Default: true (boolean).")]
231231
public bool? RuntimeMcpDmlToolsExecuteEntityEnabled { get; }
232232

233-
[Option("runtime.mcp.dml-tools.aggregate-records.enabled", Required = false, HelpText = "Enable DAB's MCP aggregate records tool. Default: true (boolean).")]
233+
[Option("runtime.mcp.dml-tools.aggregate-records", Required = false, HelpText = "Enable DAB's MCP aggregate records tool. Default: true (boolean).")]
234234
public bool? RuntimeMcpDmlToolsAggregateRecordsEnabled { get; }
235235

236236
[Option("runtime.mcp.dml-tools.aggregate-records.query-timeout", Required = false, HelpText = "Set the execution timeout in seconds for the aggregate-records MCP tool. Default: 30 (integer). Range: 1-600.")]

0 commit comments

Comments
 (0)