MCP: Device Profiles#20
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the MCP API to better expose Enapter blueprint/profile information to clients by (1) adding blueprint_id to device results and (2) exposing device profile membership via a new read_blueprint(section="implements") section, alongside propagating per-declaration implements mappings.
Changes:
- Add required
blueprint_idpropagation from SDK → DTO → domain → MCPDevice, and updatesearch_devicesschema/docstring accordingly. - Add
BlueprintSection.IMPLEMENTSand supportread_blueprint(section="implements")returninglist[str]of implemented profile names with filtering/pagination. - Add optional
implements: list[str] | Nonemetadata to telemetry/property/command declarations (domain + MCP models) and map it from the HTTP manifest payload.
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/mcp/test_server.py | Adds MCP-layer tests ensuring read_blueprint returns bare strings for implements and models for other sections. |
| tests/unit/mcp/models/test_telemetry_attribute_declaration.py | Verifies MCP telemetry declaration model propagates implements from domain and defaults to None. |
| tests/unit/mcp/models/test_property_declaration.py | Verifies MCP property declaration model propagates implements from domain and defaults to None. |
| tests/unit/mcp/models/test_device.py | Updates device model tests for required blueprint_id propagation. |
| tests/unit/mcp/models/test_command_declaration.py | Verifies MCP command declaration model propagates implements from domain and defaults to None. |
| tests/unit/http/test_enapter_data_mapper.py | Adds mapper tests for top-level manifest implements, per-declaration implements, and blueprint_id mapping. |
| tests/unit/domain/test_blueprint_summary.py | Updates manifest construction in tests to include required implements field. |
| tests/unit/core/test_device_search_query.py | Updates DTO construction in tests to include required blueprint_id. |
| tests/unit/core/test_application_server.py | Adds coverage for read_blueprint implements section and updates test DTO/manifest helpers. |
| tests/integration/schemas/search_devices.json | Regenerates schema snapshot to include required blueprint_id and updated tool description. |
| tests/integration/schemas/read_blueprint.json | Regenerates schema snapshot to include implements section and string output variant; adds declaration-level implements fields. |
| src/enapter_mcp_server/mcp/server.py | Updates tool docstrings and extends read_blueprint to return strings for the implements section. |
| src/enapter_mcp_server/mcp/models/telemetry_attribute_declaration.py | Adds optional implements field and maps it from domain. |
| src/enapter_mcp_server/mcp/models/property_declaration.py | Adds optional implements field and maps it from domain. |
| src/enapter_mcp_server/mcp/models/device.py | Adds required blueprint_id to MCP Device model and maps it from domain. |
| src/enapter_mcp_server/mcp/models/command_declaration.py | Adds optional implements field and maps it from domain. |
| src/enapter_mcp_server/mcp/models/blueprint_section.py | Extends MCP blueprint section literal to include "implements". |
| src/enapter_mcp_server/http/enapter_data_mapper.py | Maps blueprint_id, top-level manifest implements, and per-declaration implements from HTTP payloads. |
| src/enapter_mcp_server/domain/telemetry_attribute_declaration.py | Adds optional per-declaration implements field to domain telemetry declarations. |
| src/enapter_mcp_server/domain/property_declaration.py | Adds optional per-declaration implements field to domain property declarations. |
| src/enapter_mcp_server/domain/device.py | Adds required blueprint_id to domain device model. |
| src/enapter_mcp_server/domain/device_manifest.py | Adds required top-level implements: list[str] to manifests. |
| src/enapter_mcp_server/domain/command_declaration.py | Adds optional per-declaration implements field to domain command declarations. |
| src/enapter_mcp_server/domain/blueprint_section.py | Adds IMPLEMENTS = "implements" enum member. |
| src/enapter_mcp_server/core/device_dto.py | Adds required blueprint_id to the internal DTO. |
| src/enapter_mcp_server/core/application_server.py | Propagates blueprint_id into domain devices; adds implements support in read_blueprint. |
| specs/SPEC-004-blueprint-id.md | Documents design/constraints for exposing blueprint_id on devices. |
| specs/SPEC-005-profile-mappings-on-declarations.md | Documents design/constraints for per-declaration implements mappings. |
| specs/SPEC-006-device-profile-membership.md | Documents design/constraints for top-level manifest implements and read_blueprint(section="implements"). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #15.