Skip to content

Actions - #1734

Draft
Steve Lee (SteveL-MSFT) wants to merge 5 commits into
PowerShell:mainfrom
SteveL-MSFT:actions
Draft

Actions#1734
Steve Lee (SteveL-MSFT) wants to merge 5 commits into
PowerShell:mainfrom
SteveL-MSFT:actions

Conversation

@SteveL-MSFT

Copy link
Copy Markdown
Member

PR Summary

  • remove use of unstable feature on config.toml since it's now stable
  • add new DscResourceKind that encapulates DscResource and DscAction, this resulted in many changes that formally only expected a DscResource
  • add new dsc action list to list actions, did not implement dsc action invoke since expectation is apps use the server apis
  • add invoke_dsc_action(), list_dsc_actions(), and show_dsc_action() server APIs
  • add tests for new server apis and using actions in configuration
  • add test actions that also cover security context and versioning
  • command discovery looks separately for actions and caches them separately

PR Context

Fix #1470

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Unresolved moderate issues affect MCP contracts, input validation, configuration behavior, and discovery caching.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 6 Medium severity · 1 Low severity

Open (7)
What changed in this PR

Adds DSC action manifests, discovery, configuration support, CLI listing, MCP APIs, schemas, and test coverage.

Changes:

  • Adds action discovery, caching, invocation, and validation.
  • Adds dsc action list and MCP action tools.
  • Integrates actions with configuration and resource dispatch.
  • Adds fixtures, tests, localization, and stable Cargo configuration.
File Summary
tools/​dsctest/​src/​main.rs Adds action test support and schemas.
tools/​dsctest/​src/​args.rs Adds action arguments.
tools/​dsctest/​src/​action.rs Implements test action input/output.
tools/​dsctest/​dsctest.dsc.manifests.json Adds action manifests.
tools/​dsctest/​dsctest.dsc.action.json Adds an action fixture.
tools/​dsctest/​.project.data.json Includes the action fixture.
lib/​dsc-lib/​src/​lib.rs Exposes action support and resource kinds.
lib/​dsc-lib/​src/​extensions/​dscextension.rs Corrects directory documentation.
lib/​dsc-lib/​src/​extensions/​discover.rs Discovers action extensions.
lib/​dsc-lib/​src/​dscresources/​dscresource.rs Handles resource/action distinctions.
lib/​dsc-lib/​src/​dscresources/​command_resource.rs Adds action security validation.
lib/​dsc-lib/​src/​discovery/​mod.rs Adds action caching and lookup; cache readiness needs correction.
lib/​dsc-lib/​src/​discovery/​discovery_trait.rs Extends discovery APIs for actions.
lib/​dsc-lib/​src/​discovery/​command_discovery.rs Loads action manifests; resource cache guarding needs correction.
lib/​dsc-lib/​src/​configure/​mod.rs Executes actions during configuration; test/set operation selection needs correction.
lib/​dsc-lib/​src/​actions/​mod.rs Registers action modules.
lib/​dsc-lib/​src/​actions/​dscaction.rs Implements action loading and invocation; missing inputs can bypass validation.
lib/​dsc-lib/​src/​actions/​action_manifest.rs Defines action schemas; schema transforms need alignment with resource manifests.
lib/​dsc-lib/​locales/​en-us.toml Adds action messages.
dsc/​tests/​dsc_server.tests.ps1 Tests MCP action tools.
dsc/​tests/​dsc_actions.tests.ps1 Tests action CLI and configuration behavior.
dsc/​src/​subcommand.rs Adds action listing and validation; required null inputs and localization need correction.
dsc/​src/​server/​show_dsc_resource.rs Separates actions from resources.
dsc/​src/​server/​show_dsc_action.rs Adds action details API.
dsc/​src/​server/​mod.rs Registers action server modules.
dsc/​src/​server/​mcp_server.rs Registers action tool routers.
dsc/​src/​server/​list_dsc_resources.rs Restricts listing to resources.
dsc/​src/​server/​list_dsc_actions.rs Adds action listing; metadata incorrectly describes resources.
dsc/​src/​server/​invoke_dsc_resource.rs Restricts invocation to resources.
dsc/​src/​server/​invoke_dsc_action.rs Adds action invocation; metadata does not match the request contract.
dsc/​src/​resource_command.rs Separates action and resource CLI operations.
dsc/​src/​main.rs Dispatches the action subcommand.
dsc/​src/​args.rs Defines action CLI arguments.
dsc/​locales/​en-us.toml Adds CLI action strings.
dsc-bicep-ext/​src/​main.rs Rejects actions in Bicep resource operations.
.cargo/​config.toml Removes obsolete unstable Cargo configuration.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +39 to +41
description = "Invoke a DSC action 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.",
annotations(
title = "Invoke a DSC action operation (Get, Set, Test, Export, Delete) with specified properties in JSON format and what-if support",
Comment on lines +43 to +45
description = "List summary of all DSC resources available on the local machine",
annotations(
title = "Enumerate all available DSC resources on the local machine returning name, kind, and description.",
Comment on lines +90 to +97
if let Some(input) = input {
let Some(input_schema) = &self.input_schema else {
error!("{}", t!("actions.dscaction.inputSchemaNotAvailable", type_name = self.type_name.to_string()));
return Err(DscError::SchemaNotAvailable(self.type_name.to_string()));
};

validate_json(input, input_schema)?;
}
results.push(serde_json::to_value(&result.result)?);
let (test_result, execution_information, metadata) = match dsc_resource {
DscResourceKind::Action(dsc_action) => {
let result = if dsc_action.supported_operations.contains(&SupportedOperations::Set) {
#[allow(clippy::too_many_lines)]
fn discover(&mut self, kind: &DiscoveryKind, filter: &TypeNameFilter) -> Result<(), DscError> {
if self.discovery_mode == ResourceDiscoveryMode::PreDeployment && !locked_is_empty!(RESOURCES) {
if self.discovery_mode == ResourceDiscoveryMode::PreDeployment && kind == &DiscoveryKind::Resource && (!locked_is_empty!(RESOURCES) || !locked_is_empty!(ACTIONS)) {
Comment on lines +154 to +158
} else if let Some(actions) = self.actions.get(type_name) {
if let Some(version_req) = filter.require_version() {
for action in actions {
if version_req.matches(&ResourceVersion::Semantic(action.version.clone())) {
return Ok(Some(DscResourceKind::Action(Box::new(action.clone()))));
Comment thread dsc/src/subcommand.rs
Comment on lines +697 to +701
let has_input = if action.invoke.input_schema.is_some() {
"Yes"
} else {
"No"
};
@SteveL-MSFT
Steve Lee (SteveL-MSFT) marked this pull request as draft September 26, 2026 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for actions

2 participants