FlowFuse / FlowFuse/flowfuse

5.11-c Delete and destructive tools (phase 2)

Open
#7,707 0 comments 0 reactions 0 assignees View on GitHub
story
Dominant language
JavaScript
Stars
400
Forks
89
Avg merge
1d 20h
Merged PRs (30d)
149

Description

**Parent:** #7680 (5.11 Instance configuration)
**Tool file:** new `forge/ee/lib/mcp/tools/instanceConfig.js`

`destructiveHint: true`. Kept separate from ordinary writes so MCP clients gate them behind confirmation by default.

| Tool | Endpoint | Scope | Annotation |
|---|---|---|---|
| `platform_delete_instance_file` | `DELETE /projects/:id/files/_/:path` | `project:files:delete` | destructive |
| `platform_delete_instance_http_token` (`instanceType`: `hosted`\|`remote`) | hosted: `DELETE /projects/:id/httpTokens/:tid`; remote: `DELETE /devices/:id/httpTokens/:tid` | `project:edit` (hosted), `device:edit` (remote) | destructive |

**Consolidation notes:**
- `platform_delete_instance_http_token` covers both hosted and remote instances through an `instanceType` discriminator, mirroring the read tools. It routes to `DELETE /projects/:id/httpTokens/:tid` (`project:edit`) or `DELETE /devices/:id/httpTokens/:tid` (`device:edit`) based on `instanceType`.

**Design notes:** deleting an HTTP bearer token revokes access for that token; surface the outcome descriptively.

**Tool definitions (description + zod inputSchema):**
```js
platform_delete_instance_file: {
description: 'Deletes a file or directory from a hosted instance file store.',
inputSchema: z.object({
instanceId: z.string().uuid().describe('UUID of the hosted instance'),
path: z.string().describe('Path of the file or directory to delete')
})
}

platform_delete_instance_http_token: {
description: 'Deletes an HTTP bearer token from an instance, revoking access for that token. instanceType selects whether instanceId is a hosted instance UUID or a remote instance (device) hashid.',
inputSchema: z.object({
instanceId: z.string().describe('Instance id: hosted instance UUID, or remote instance (device) hashid'),
instanceType: z.enum(['hosted', 'remote']).describe('Whether instanceId refers to a hosted instance or a remote instance (device)'),
tokenId: z.string().describe('Opaque hashid of the HTTP bearer token to delete')
})
}
```

**Tests:**
- Every tool carries `destructiveHint: true`.
- `platform_delete_instance_http_token` routes by `instanceType`.
- Read-only PAT rejected.
- Feature-disabled instance returns the descriptive gate error.
---

Contributor guide

Open the contributing guide

Research direction

Read parent issue #7680 and the new forge/ee/lib/mcp/tools/instanceConfig.js entry point, then trace the hosted and remote DELETE endpoints listed here. Verify that both tools carry destructiveHint, routing follows instanceType, read-only PATs are rejected, and feature-disabled instances return the descriptive gate error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.