Skip to main content
Glama
koopatroopa787

MCP PC Control Server

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

Implementation Reference

  • 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}`,
          },
        ],
      };
    }
  • 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 };
    });

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