delete_file
Delete a file from the filesystem by providing its path. The tool removes the specified file permanently.
Instructions
Delete a file from the filesystem
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | File path to delete |
Implementation Reference
- src/demo-server.ts:49-57 (schema)Input schema definition for delete_file tool (name, description, inputSchema with required 'path' property)
{ name: 'delete_file', description: 'Delete a file from the filesystem', inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'File path to delete' } }, required: ['path'], }, }, - src/demo-server.ts:27-79 (registration)Registration of delete_file in TOOLS array alongside other demo tools
const TOOLS = [ { name: 'read_file', description: 'Read the contents of a file', inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'File path to read' } }, required: ['path'], }, }, { name: 'write_file', description: 'Write content to a file', inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'File path to write' }, content: { type: 'string', description: 'Content to write' }, }, required: ['path', 'content'], }, }, { name: 'delete_file', description: 'Delete a file from the filesystem', inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'File path to delete' } }, required: ['path'], }, }, { name: 'web_search', description: 'Search the web for information', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query' } }, required: ['query'], }, }, { name: 'deploy', description: 'Deploy the application to production', inputSchema: { type: 'object', properties: { environment: { type: 'string', description: 'Target environment', enum: ['staging', 'production'] }, reason: { type: 'string', description: 'Deployment reason' }, }, required: ['environment'], }, }, ]; - src/demo-server.ts:120-122 (handler)Handler for delete_file - when tool is called, returns a demo message simulating file deletion
case 'delete_file': resultText = `[demo] Deleted file: ${args.path || '/example.txt'}`; break; - src/cli.ts:210-227 (registration)Gateway configuration registering delete_file with block: true and min_tier: 'privileged' in the main config template
const config = { tools: { '*': { rate_limit: '100/hour', }, 'delete_file': { block: true, min_tier: 'privileged', }, 'write_file': { min_tier: 'signed-known', rate_limit: '10/minute', }, 'read_file': { rate_limit: '50/minute', }, }, default_tier: 'unknown', - src/cli.ts:783-796 (registration)Quickstart policy config registering delete_file with block: true
const configPath = join(dir, 'protect-mcp.json'); const config = { tools: { '*': { rate_limit: '100/hour' }, 'delete_file': { block: true }, }, default_tier: 'unknown', signing: { key_path: join(keysDir, 'gateway.json'), issuer: 'protect-mcp-quickstart', enabled: true, }, }; writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n');