fs_delete_file
Remove files from your development environment using this filesystem deletion tool. Specify the file path to permanently delete files from your system.
Instructions
Delete a file from the filesystem. This operation is irreversible.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute or relative path to the file to delete |
Implementation Reference
- src/tools/filesystem.ts:174-204 (handler)The deleteFile function implements the core logic for deleting a file using Node.js fs.unlink. It handles errors and returns a standardized ToolResponse in MCP format.export async function deleteFile(args: z.infer<typeof deleteFileSchema>): Promise<ToolResponse> { try { await fs.unlink(args.path); return { content: [ { type: "text" as const, text: JSON.stringify({ success: true, path: args.path, message: 'File deleted successfully' }, null, 2) } ] }; } catch (error) { return { content: [ { type: "text" as const, text: JSON.stringify({ success: false, error: error instanceof Error ? error.message : String(error) }, null, 2) } ], isError: true }; } }
- src/tools/filesystem.ts:528-541 (schema)MCP tool schema definition for fs_delete_file, defining the input schema advertised to MCP clients.{ name: 'fs_delete_file', description: 'Delete a file from the filesystem. This operation is irreversible.', inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'Absolute or relative path to the file to delete' } }, required: ['path'] } },
- src/index.ts:317-319 (registration)Registration and dispatch logic in the main MCP CallToolRequest handler that routes calls to fs_delete_file to the deleteFile implementation.if (name === 'fs_delete_file') { const validated = deleteFileSchema.parse(args); return await deleteFile(validated);
- src/tools/filesystem.ts:31-33 (schema)Zod runtime validation schema used by the handler and dispatcher for input validation.export const deleteFileSchema = z.object({ path: z.string().describe('Absolute or relative path to the file to delete') });