delete_directory
Remove a directory and all its contents permanently using this recursive deletion tool. Exercise caution as this action cannot be undone.
Instructions
Permanently delete a directory and all of its contents, including all files and subdirectories. This is a recursive operation that cannot be undone. Use with extreme caution.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | The path to the directory to delete |
Implementation Reference
- src/index.ts:395-406 (handler)The switch case handler that executes the delete_directory tool by recursively removing the directory and all contents using fs.rm with recursive and force options.case "delete_directory": { const dirPath = args.path as string; await fs.rm(dirPath, { recursive: true, force: true }); return { content: [ { type: "text", text: `Successfully deleted directory ${dirPath}`, }, ], }; }
- src/index.ts:126-139 (schema)The tool definition in the TOOLS array, including name, description, and inputSchema for validating the 'path' parameter.{ name: "delete_directory", description: "Permanently delete a directory and all of its contents, including all files and subdirectories. This is a recursive operation that cannot be undone. Use with extreme caution.", inputSchema: { type: "object", properties: { path: { type: "string", description: "The path to the directory to delete", }, }, required: ["path"], }, },
- src/index.ts:261-263 (registration)The server request handler for ListToolsRequestSchema that returns the TOOLS array, registering delete_directory among available tools.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: TOOLS }; });