feat(mcp): snapshot read tools - #7720
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7720 +/- ##
==========================================
+ Coverage 76.20% 76.35% +0.15%
==========================================
Files 443 443
Lines 23728 23734 +6
Branches 6315 6315
==========================================
+ Hits 18081 18123 +42
+ Misses 5647 5611 -36
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:
|
5fa6a86 to
84edc1f
Compare
8bfb22e to
9742987
Compare
84edc1f to
64a8111
Compare
64a8111 to
09497ea
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
09497ea to
1d840cc
Compare
1d840cc to
33e0e46
Compare
33e0e46 to
04f3e3a
Compare
04f3e3a to
04bfd8b
Compare
|
@cstns reworked the snapshot read tools in 49a1cad based on your review, taking a slightly different route than the literal suggestions:
Let me know if you'd prefer different naming. |
|
Follow-up in 6d7de1a, continuing the consolidation and picking up your last comment:
Snapshot read/create tools are now: |
Testing results of new/edited toolsLocal platform context these calls ran against:
This PR reworks
All five are exercised below. Hashids and instance UUIDs are redacted; counts, states, and env keys are verbatim. platform_list_instance_snapshotsLists the snapshots of a hosted instance or a remote instance (device), selected by
platform_create_instance_snapshotCreates a snapshot from a hosted or remote instance. Consolidated from the two former create tools; the
platform_get_snapshotGets a single snapshot's metadata by id; resolves the owner (hosted or remote) automatically.
platform_get_snapshot_fullGets the full payload (flows, settings, environment variables). Hidden (secret) env values are blanked; keys and the hidden flag are kept. Credentials are not included.
platform_get_hosted_instance_device_target_snapshotGets the target snapshot that a hosted instance's assigned devices are set to deploy. Returns null when none is set.
ConclusionAll five new/edited tools in |
…ots-read # Conflicts: # forge/routes/auth/permissions.js
Summary
Reworks the snapshot tools in
forge/ee/lib/mcp/tools/snapshots.js.Consolidates the split hosted/remote tools into single tools that take an
instanceType("hosted" or "remote"), matching the shape used by the other hosted/remote twins:platform_list_instance_snapshots-GET /api/v1/projects/:instanceId/snapshotsorGET /api/v1/devices/:instanceId/snapshots(replacesplatform_list_hosted_instance_snapshotsandplatform_list_remote_instance_snapshots)platform_create_instance_snapshot-POSTto the same routes (replacesplatform_create_hosted_instance_snapshotandplatform_create_remote_instance_snapshot)Adds three read tools:
platform_get_snapshot-GET /api/v1/snapshots/:id- snapshot metadata; resolves the owner (hosted or remote) automaticallyplatform_get_snapshot_full-GET /api/v1/snapshots/:id/full- full payload (flows, settings, env); hidden env values are blanked, keys kept, credentials never includedplatform_get_hosted_instance_device_target_snapshot-GET /api/v1/projects/:instanceId/devices/settings- the snapshot a hosted instance's assigned devices are set to deploy (null when none)The read tools are annotated
readOnlyHint: true, destructiveHint: false.No permissions changes: #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 #7687
Test plan
eslinton changed filesmochaon changed files