Skip to content

feat: add opt-in execute_command tool#21

Merged
rnovatorov merged 1 commit into
mainfrom
feat/execute-command-spec-007
Jun 24, 2026
Merged

feat: add opt-in execute_command tool#21
rnovatorov merged 1 commit into
mainfrom
feat/execute-command-spec-007

Conversation

@rnovatorov

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings June 23, 2026 19:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds an opt-in, destructive execute_command MCP tool that can execute real device commands through the Enapter HTTP SDK, with layered safety controls (deployment kill switch + manifest-based confirmation gate + fast-fail on unknown command names).

Changes:

  • Introduces execute_command tool registration behind ServerConfig.command_execution_enabled (CLI/env kill switch), with destructive tool annotations.
  • Adds domain/MCP models and HTTP mapping for a vendor-provided confirmation block on command declarations, and enforces human_confirmed_this_action in ApplicationServer.execute_command.
  • Expands unit + integration tests and commits schema snapshots for the new tool and extended blueprint schema.

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/unit/http/test_enapter_data_mapper.py Adds unit coverage for mapping confirmation into command declarations.
tests/unit/http/test_enapter_api.py Adds unit coverage for EnapterAPI.execute_command SDK call-through and domain mapping.
tests/unit/core/test_application_server.py Adds unit coverage for command-name existence and confirmation gate behavior.
tests/integration/test_mcp.py Adds enabled/disabled integration coverage and schema snapshot assertions for tool registration.
tests/integration/schemas/read_blueprint.json Updates blueprint schema snapshot to include confirmation on command declarations.
tests/integration/schemas/execute_command.json Adds schema snapshot for the new execute_command tool.
src/enapter_mcp_server/mcp/server.py Registers execute_command conditionally and implements the MCP tool handler.
src/enapter_mcp_server/mcp/server_config.py Adds command_execution_enabled configuration flag (default off).
src/enapter_mcp_server/mcp/models/command_declaration.py Exposes optional confirmation on MCP command declarations + mapping from domain.
src/enapter_mcp_server/mcp/models/command_confirmation.py Adds MCP model for vendor confirmation block.
src/enapter_mcp_server/mcp/models/init.py Exports CommandConfirmation from MCP models package.
src/enapter_mcp_server/http/enapter_data_mapper.py Maps manifest confirmation into new domain type.
src/enapter_mcp_server/http/enapter_api.py Adds execute_command implementation using client.commands.execute.
src/enapter_mcp_server/domain/command_declaration.py Adds optional confirmation field to domain command declaration.
src/enapter_mcp_server/domain/command_confirmation.py Adds domain type for vendor confirmation metadata.
src/enapter_mcp_server/domain/init.py Exports CommandConfirmation from domain package.
src/enapter_mcp_server/core/errors.py Adds ConfirmationRequired and CommandNotFound errors.
src/enapter_mcp_server/core/enapter_api.py Extends core API protocol with execute_command.
src/enapter_mcp_server/core/application_server.py Adds execute_command orchestration (manifest lookup + confirmation gate + SDK call).
src/enapter_mcp_server/core/init.py Re-exports new core errors.
src/enapter_mcp_server/cli/serve_command.py Wires CLI/env kill switch into server config.
specs/SPEC-007-command-execution.md Adds design spec and acceptance criteria for command execution.
README.md Documents the new tool and adds a human-confirmation usage example.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md Outdated
Comment thread src/enapter_mcp_server/mcp/server.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 23 out of 23 changed files in this pull request and generated 1 comment.

Comment thread src/enapter_mcp_server/core/application_server.py

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 23 out of 23 changed files in this pull request and generated 1 comment.

Comment thread src/enapter_mcp_server/core/application_server.py
@rnovatorov rnovatorov merged commit bb46314 into main Jun 24, 2026
4 checks passed
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.

3 participants