Skip to main content
Glama
ConnorBoetig-dev

Unrestricted Development MCP Server

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
NameRequiredDescriptionDefault
pathYesAbsolute or relative path to the file to delete

Implementation Reference

  • 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
        };
      }
    }
  • 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);
  • 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')
    });

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