Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions src/Cli.Tests/ConfigureOptionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1081,6 +1081,94 @@ public void TestConfigureDescriptionForMcpSettings(string descriptionValue)
Assert.AreEqual(descriptionValue, runtimeConfig.Runtime.Mcp.Description);
}

/// <summary>
/// Tests that running "dab configure --runtime.mcp.dml-tools.{tool} {value}" updates
/// the individual DML tool boolean in the runtime config. Each tool is a direct boolean
/// in the schema (e.g., "describe-entities": true), NOT a nested object with .enabled.
Comment thread
souvikghosh04 marked this conversation as resolved.
Outdated
/// </summary>
[DataTestMethod]
[DataRow(true, DisplayName = "Enable individual DML tool: describe-entities")]
[DataRow(false, DisplayName = "Disable individual DML tool: describe-entities")]
public void TestConfigureIndividualDmlToolForMcpSettings(bool updatedValue)
{
// Arrange
SetupFileSystemWithInitialConfig(INITIAL_CONFIG);

// Act: Set describe-entities via the corrected option name (no .enabled suffix)
Comment thread
souvikghosh04 marked this conversation as resolved.
Outdated
ConfigureOptions options = new(
runtimeMcpDmlToolsDescribeEntitiesEnabled: updatedValue,
config: TEST_RUNTIME_CONFIG_FILE
);
bool isSuccess = TryConfigureSettings(options, _runtimeConfigLoader!, _fileSystem!);

// Assert
Assert.IsTrue(isSuccess);
string updatedConfig = _fileSystem!.File.ReadAllText(TEST_RUNTIME_CONFIG_FILE);
Assert.IsTrue(RuntimeConfigLoader.TryParseConfig(updatedConfig, out RuntimeConfig? runtimeConfig));
Assert.IsNotNull(runtimeConfig.Runtime?.Mcp?.DmlTools);
Assert.AreEqual(updatedValue, runtimeConfig.Runtime.Mcp.DmlTools.DescribeEntities);
}
Comment thread
souvikghosh04 marked this conversation as resolved.
Outdated

/// <summary>
/// Tests that running "dab configure --runtime.mcp.dml-tools.enabled {value}" sets all
/// DML tools at once via the bulk toggle.
/// </summary>
[DataTestMethod]
[DataRow(true, DisplayName = "Enable all DML tools at once")]
[DataRow(false, DisplayName = "Disable all DML tools at once")]
public void TestConfigureAllDmlToolsForMcpSettings(bool updatedValue)
{
// Arrange
SetupFileSystemWithInitialConfig(INITIAL_CONFIG);

// Act: Set all tools via the bulk enabled toggle
ConfigureOptions options = new(
runtimeMcpDmlToolsEnabled: updatedValue,
config: TEST_RUNTIME_CONFIG_FILE
);
bool isSuccess = TryConfigureSettings(options, _runtimeConfigLoader!, _fileSystem!);

// Assert
Assert.IsTrue(isSuccess);
string updatedConfig = _fileSystem!.File.ReadAllText(TEST_RUNTIME_CONFIG_FILE);
Assert.IsTrue(RuntimeConfigLoader.TryParseConfig(updatedConfig, out RuntimeConfig? runtimeConfig));
Assert.IsNotNull(runtimeConfig.Runtime?.Mcp?.DmlTools);
Assert.AreEqual(updatedValue, runtimeConfig.Runtime.Mcp.DmlTools.DescribeEntities);
Assert.AreEqual(updatedValue, runtimeConfig.Runtime.Mcp.DmlTools.CreateRecord);
Assert.AreEqual(updatedValue, runtimeConfig.Runtime.Mcp.DmlTools.ReadRecords);
Assert.AreEqual(updatedValue, runtimeConfig.Runtime.Mcp.DmlTools.UpdateRecord);
Assert.AreEqual(updatedValue, runtimeConfig.Runtime.Mcp.DmlTools.DeleteRecord);
Assert.AreEqual(updatedValue, runtimeConfig.Runtime.Mcp.DmlTools.ExecuteEntity);
Assert.AreEqual(updatedValue, runtimeConfig.Runtime.Mcp.DmlTools.AggregateRecords);
}

/// <summary>
/// Tests that running "dab configure" with multiple individual DML tool options
/// correctly updates each tool independently.
/// </summary>
[TestMethod]
public void TestConfigureMultipleIndividualDmlToolsForMcpSettings()
{
// Arrange
SetupFileSystemWithInitialConfig(INITIAL_CONFIG);

// Act: Enable describe-entities, disable create-record
ConfigureOptions options = new(
runtimeMcpDmlToolsDescribeEntitiesEnabled: true,
runtimeMcpDmlToolsCreateRecordEnabled: false,
config: TEST_RUNTIME_CONFIG_FILE
);
bool isSuccess = TryConfigureSettings(options, _runtimeConfigLoader!, _fileSystem!);

// Assert
Assert.IsTrue(isSuccess);
string updatedConfig = _fileSystem!.File.ReadAllText(TEST_RUNTIME_CONFIG_FILE);
Assert.IsTrue(RuntimeConfigLoader.TryParseConfig(updatedConfig, out RuntimeConfig? runtimeConfig));
Assert.IsNotNull(runtimeConfig.Runtime?.Mcp?.DmlTools);
Assert.AreEqual(true, runtimeConfig.Runtime.Mcp.DmlTools.DescribeEntities);
Assert.AreEqual(false, runtimeConfig.Runtime.Mcp.DmlTools.CreateRecord);
}

/// <summary>
/// Validates that `dab configure --show-effective-permissions` correctly displays
/// effective permissions without modifying the config file.
Expand Down
14 changes: 7 additions & 7 deletions src/Cli/Commands/ConfigureOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,25 +212,25 @@ public ConfigureOptions(
[Option("runtime.mcp.dml-tools.enabled", Required = false, HelpText = "Enable DAB's MCP DML tools endpoint. Default: true (boolean).")]
public bool? RuntimeMcpDmlToolsEnabled { get; }

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

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

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

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

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

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

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

[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.")]
Expand Down
Loading