Skip to main content
Glama
alxspiker

MCP Server for FTP Access

delete-directory

Remove directories from FTP servers by specifying the remote path to delete. This tool helps manage server storage by eliminating unwanted folders through the MCP Server for FTP Access.

Instructions

Delete a directory from the FTP server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
remotePathYesPath of the directory to delete

Implementation Reference

  • The handler function for the 'delete-directory' tool, which invokes ftpClient.deleteDirectory and formats success or error responses.
    async ({ remotePath }) => {
      try {
        await ftpClient.deleteDirectory(remotePath);
        
        return {
          content: [
            {
              type: "text",
              text: `Directory successfully deleted from ${remotePath}`
            }
          ]
        };
      } catch (error) {
        return {
          isError: true,
          content: [
            {
              type: "text",
              text: `Error deleting directory: ${error instanceof Error ? error.message : String(error)}`
            }
          ]
        };
      }
  • Input schema definition using Zod for the remotePath parameter.
    {
      remotePath: z.string().describe("Path of the directory to delete"),
    },
  • src/index.ts:199-229 (registration)
    Registration of the 'delete-directory' tool on the MCP server using server.tool.
    server.tool(
      "delete-directory",
      "Delete a directory from the FTP server",
      {
        remotePath: z.string().describe("Path of the directory to delete"),
      },
      async ({ remotePath }) => {
        try {
          await ftpClient.deleteDirectory(remotePath);
          
          return {
            content: [
              {
                type: "text",
                text: `Directory successfully deleted from ${remotePath}`
              }
            ]
          };
        } catch (error) {
          return {
            isError: true,
            content: [
              {
                type: "text",
                text: `Error deleting directory: ${error instanceof Error ? error.message : String(error)}`
              }
            ]
          };
        }
      }
    );
  • Supporting method in FtpClient class that handles the actual FTP directory deletion using basic-ftp's removeDir.
    async deleteDirectory(remotePath: string): Promise<boolean> {
      try {
        await this.connect();
        await this.client.removeDir(remotePath);
        await this.disconnect();
        return true;
      } catch (error) {
        console.error("Delete directory error:", error);
        throw new Error(`Failed to delete directory: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
Behavior2/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 states the destructive action ('Delete') but lacks critical details: whether deletion is permanent or reversible, if the directory must be empty, what permissions are required, error conditions (e.g., non-existent path), or what the response looks like. For a destructive tool with zero annotation coverage, this is a significant gap.

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 a single, clear sentence with zero waste. It's front-loaded with the core action and resource, making it immediately scannable. Every word earns its place without redundancy or unnecessary elaboration.

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

Completeness2/5

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

Given this is a destructive tool with no annotations and no output schema, the description is incomplete. It doesn't address behavioral risks (e.g., irreversible deletion), prerequisites, error handling, or response format. The agent lacks sufficient context to use this tool safely and effectively without additional assumptions.

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%, with the single parameter 'remotePath' documented as 'Path of the directory to delete'. The description adds no additional parameter semantics beyond what the schema provides, such as path format examples or constraints. The baseline score of 3 reflects adequate coverage when the schema does the heavy lifting.

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

Purpose4/5

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

The description clearly states the action ('Delete') and resource ('a directory from the FTP server'), making the tool's purpose immediately understandable. It distinguishes from siblings like 'delete-file' by specifying directory deletion rather than file deletion. However, it doesn't explicitly contrast with 'list-directory' or other siblings beyond the obvious action difference.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., directory must be empty), when not to use it, or direct comparisons to siblings like 'delete-file' for file deletion or 'list-directory' for checking contents first. The agent must infer usage from the tool name alone.

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/alxspiker/mcp-server-ftp'

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