feat(mcp): device group read tools - #7719
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7719 +/- ##
==========================================
+ Coverage 75.94% 75.96% +0.01%
==========================================
Files 445 446 +1
Lines 23990 24004 +14
Branches 6404 6404
==========================================
+ Hits 18220 18234 +14
Misses 5770 5770
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
9420520 to
6d62562
Compare
8bfb22e to
9742987
Compare
6d62562 to
d1583af
Compare
d1583af to
f462226
Compare
103f9ae to
5773bdb
Compare
Add forge/ee/lib/mcp/schemas.js, a shared module of composable zod fragments the platform read tools import instead of redefining entity-id and pagination/search/sort/audit-log query fields in each tool file. - entity-id params: teamId, applicationId, hostedInstanceId (UUID), remoteInstanceId, snapshotId - query fragments composed per route by spreading only the params the backing finder honors: cursorParam/limitParam (basePagination), pageParam, searchQuery, sortParams, auditLogFilters - appendQuery serialises a tool's supported params onto the request URL The module lives one level above tools/ so the tool loader does not register it as a tool module. Closes #7669
eae081f to
e04360f
Compare
f462226 to
5b86464
Compare
5b86464 to
5265992
Compare
5265992 to
8833422
Compare
8833422 to
972c237
Compare
Replace the single platform_list_device_groups tool, which took an optional teamId or applicationId and routed to whichever was set, with two tools: platform_list_team_device_groups and platform_list_application_device_groups. The team and application device-group endpoints are separate, with different scopes and a different result shape, and the merged tool relied on an unenforced 'exactly one of teamId or applicationId' contract that could otherwise build a request against an undefined id. Also correct the descriptions: the routes return a plain not-found when the deviceGroups feature is disabled, not the descriptive message the tools previously claimed.
…-groups-read # Conflicts: # forge/routes/auth/permissions.js
Testing results of new/changed tools@cstns for visibility. The three tools in this PR were invoked against a running local platform. The context the calls ran against:
Payloads below are redacted for ids, names and secrets; structural values (counts, statuses, and which fields are present) are verbatim. platform_list_team_device_groupsLists the device groups across all applications in a team.
platform_list_application_device_groupsLists the device groups belonging to a single application.
platform_get_application_device_groupFetches a single device group in an application, including its members and target snapshot.
Findings
ConclusionAll three tools verified against their descriptions, including feature-gating and the environment variable secret-masking guarantee. No open defects. |
Summary
Add Phase 1 read-only MCP tools for fleet device groups, per #7699.
Tools added (
forge/ee/lib/mcp/tools/deviceGroups.js):platform_list_team_device_groups- lists the device groups across all applications in a team.GET /api/v1/teams/:teamId/device-groupsplatform_list_application_device_groups- lists the device groups belonging to a single application.GET /api/v1/applications/:applicationId/device-groupsplatform_get_application_device_group-GET /api/v1/applications/:applicationId/device-groups/:groupIdAll routes require the
deviceGroupsteam feature; when disabled they return the existing 404 gate response.Write, membership, settings, and delete tools are tracked separately in sub-issues #7700 and #7701 and are not part of this PR.
Permissions:
#8185 removed the hardcoded
user:expert-mcpscope allow-list, so expert MCP tokens now inherit the user's permissions gated by team role and no allow-list entries are needed.Closes #7699
Test plan
eslinton changed filesmochaunit tests for the tool file