Skip to main content
Glama

delete_directory

Remove a directory and all its contents permanently through recursive deletion. This operation cannot be undone, so use with caution when managing file systems.

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
NameRequiredDescriptionDefault
pathYesThe path to the directory to delete

Implementation Reference

  • Handler implementation for the 'delete_directory' tool. It takes a directory path from arguments, uses Node.js fs.rm with recursive and force options to delete the directory and all contents, then returns a success message.
    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}`, }, ], }; }
  • Tool schema definition including name, description, and input schema requiring a 'path' string parameter. This is part of the TOOLS array used for tool registration and listing.
    { 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-262 (registration)
    Registration of all tools, including delete_directory, via the ListToolsRequestSchema handler that returns the TOOLS array containing the tool definitions.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: TOOLS };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/koopatroopa787/first_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server