Skip to main content
Glama
ConnorBoetig-dev

Unrestricted Development MCP Server

fs_delete_directory

Remove directories and optionally delete all contents recursively to manage file system structure during development.

Instructions

Delete a directory. Can recursively delete all contents. WARNING: Use with caution as this is irreversible.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute or relative path to the directory to delete
recursiveNoDelete directory and all contents recursively

Implementation Reference

  • The core handler function that implements the fs_delete_directory tool logic. It deletes the specified directory using Node.js fs.promises.rm (recursive with force if specified) or fs.rmdir (non-recursive), and returns a standardized ToolResponse.
    export async function deleteDirectory(args: z.infer<typeof deleteDirectorySchema>): Promise<ToolResponse> {
      try {
        if (args.recursive) {
          await fs.rm(args.path, { recursive: true, force: true });
        } else {
          await fs.rmdir(args.path);
        }
    
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify({
                success: true,
                path: args.path,
                message: 'Directory 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
        };
      }
    }
  • Zod schema used for input validation in the deleteDirectory handler and dispatch.
    export const deleteDirectorySchema = z.object({
      path: z.string().describe('Absolute or relative path to the directory to delete'),
      recursive: z.boolean().default(false).describe('Delete directory and all contents recursively')
    });
  • JSON schema definition for the fs_delete_directory tool, part of the exported filesystemTools array used for MCP tool registration.
    {
      name: 'fs_delete_directory',
      description: 'Delete a directory. Can recursively delete all contents. WARNING: Use with caution as this is irreversible.',
      inputSchema: {
        type: 'object',
        properties: {
          path: {
            type: 'string',
            description: 'Absolute or relative path to the directory to delete'
          },
          recursive: {
            type: 'boolean',
            default: false,
            description: 'Delete directory and all contents recursively'
          }
        },
        required: ['path']
      }
    },
  • src/index.ts:329-332 (registration)
    Dispatch/registration logic in the main server handler that matches tool name 'fs_delete_directory', validates input with deleteDirectorySchema, and invokes the deleteDirectory handler.
    if (name === 'fs_delete_directory') {
      const validated = deleteDirectorySchema.parse(args);
      return await deleteDirectory(validated);
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively communicates key traits: the operation is destructive ('Delete'), irreversible ('irreversible'), and supports recursive deletion ('Can recursively delete all contents'). It doesn't cover error handling, permissions, or return values, but provides essential safety warnings.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose ('Delete a directory'), followed by key behavioral details and a warning. Every sentence earns its place: the first states the action, the second explains capability, and the third provides critical caution. It's efficiently structured with zero waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive tool with no annotations and no output schema, the description does well by highlighting irreversibility and recursive behavior. It could improve by mentioning error cases (e.g., non-existent directory, permission issues) or return values, but given the schema's full parameter coverage and the clear warning, it's mostly complete for safe usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents both parameters (path and recursive). The description adds marginal value by mentioning recursive deletion, which aligns with the schema's description for the recursive parameter. No additional syntax or format details are provided beyond what the schema offers.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific verb ('Delete') and resource ('a directory'), distinguishing it from sibling tools like fs_delete_file (which deletes files) and fs_list_directory (which lists contents). It precisely communicates the tool's function without ambiguity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context with the warning about irreversibility, indicating when to use caution. However, it doesn't explicitly mention when to use this tool versus alternatives like fs_delete_file for files or shell_execute for command-line deletion, nor does it specify prerequisites like directory existence or permissions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/ConnorBoetig-dev/mcp2'

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