You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-**You ask**: "Show me what would change if I applied this configuration"
88
+
-**Agent invokes**: `invoke_dsc_config` with `operation: set` and `what_if: true`
89
+
-**Agent provides**: The projected before and after state for each resource, with the result
90
+
metadata reporting `executionType` as `whatIf`
91
+
92
+
Resources that natively support what-if run their simulation directly. For resources that don't,
93
+
DSC generates a synthetic what-if result from the resource's `test` operation. When `what_if` is
94
+
requested with an operation that doesn't support it, such as `get`, the tool returns an error
95
+
instead of silently ignoring the option.
96
+
77
97
> [!NOTE]
78
98
> Additional MCP tools will become available in future releases to expand the capabilities
79
99
> of the DSC MCP server integration. For the latest updates and feature announcements,
@@ -194,6 +214,7 @@ Example prompts that work well with DSC MCP integration:
194
214
- "What DSC resources are available on this machine?"
195
215
- "Show me the schema for the Microsoft.Windows/Registry resource"
196
216
- "List all available DSC functions I can use in expressions"
217
+
- "Preview what this configuration would change before applying it"
197
218
198
219
:::image type="complex" source="media/dsc-mcp-server/dsc-mcp-usage-example.png" alt-text="Screenshot showing DSC MCP usage example in VS Code":::
199
220
This screenshot demonstrates the DSC MCP integration in action, showing how AI agents use the MCP tools to provide contextual assistance with DSC-related tasks in VS Code.
description = "Optional parameters to pass to the configuration as a YAML string"
53
53
)]
54
54
pubparameters:Option<String>,
55
+
#[schemars(
56
+
description = "When true and operation is 'set', simulate the change (what-if / dry-run) instead of applying it. The result includes 'metadata.Microsoft.DSC.executionType' = 'whatIf'. Only valid with the 'set' operation."
57
+
)]
58
+
#[serde(default)]
59
+
pubwhat_if:Option<bool>,
55
60
}
56
61
57
62
#[tool_router(router = invoke_dsc_config_router, vis = "pub")]
58
63
implMcpServer{
59
64
#[tool(
60
-
description = "Invoke a DSC configuration operation (Get, Set, Test, Export) with optional parameters",
65
+
description = "Invoke a DSC configuration operation (Get, Set, Test, Export) with optional parameters. Set 'what_if' to true to preview a Set without applying changes.",
61
66
annotations(
62
-
title = "Invoke a DSC configuration operation (Get, Set, Test, Export) with optional parameters",
67
+
title = "Invoke a DSC configuration operation (Get, Set, Test, Export) with optional parameters and what-if support",
#[schemars(description = "The properties to pass to the DSC resource as JSON. Must match the resource JSON schema from `show_dsc_resource` tool.")]
56
59
pubproperties_json:String,
60
+
#[schemars(description = "When true and operation is 'set' or 'delete', simulate the change (what-if / dry-run) instead of applying it. Resources without native what-if support return a synthetic result derived from 'test'. Only valid with the 'set' and 'delete' operations.")]
61
+
#[serde(default)]
62
+
pubwhat_if:Option<bool>,
57
63
}
58
64
59
65
#[tool_router(router = invoke_dsc_resource_router, vis = "pub")]
60
66
implMcpServer{
61
67
#[tool(
62
-
description = "Invoke a DSC resource operation (Get, Set, Test, Export, Delete) with specified properties in JSON format",
68
+
description = "Invoke a DSC resource operation (Get, Set, Test, Export, Delete) with specified properties in JSON format. Set 'what_if' to true to preview a Set or Delete without applying changes.",
63
69
annotations(
64
-
title = "Invoke a DSC resource operation (Get, Set, Test, Export, Delete) with specified properties in JSON format",
70
+
title = "Invoke a DSC resource operation (Get, Set, Test, Export, Delete) with specified properties in JSON format and what-if support",
0 commit comments