Skip to main content
Glama
LaubPlusCo

WebDAV MCP Server

by LaubPlusCo

webdav_delete_remote_item

Delete files or directories from a remote WebDAV server by specifying their path to manage storage and organize content.

Instructions

Delete a file or directory from a remote WebDAV server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Implementation Reference

  • MCP tool handler function that checks if the path exists, deletes the item using WebDAVService, and returns success or error messages.
    async ({ path }) => {
      try {
        // Check if path exists
        const exists = await webdavService.exists(path);
        if (!exists) {
          return {
            content: [{
              type: 'text',
              text: `Error: Path does not exist at ${path}`
            }],
            isError: true
          };
        }
    
        await webdavService.delete(path);
        
        return {
          content: [{
            type: 'text',
            text: `Successfully deleted ${path}`
          }]
        };
      } catch (error) {
        return {
          content: [{
            type: 'text',
            text: `Error deleting: ${(error as Error).message}`
          }],
          isError: true
        };
      }
  • Zod input schema defining the 'path' parameter for the tool.
    {
      path: z.string().min(1, 'Path must not be empty')
    },
  • Registration of the 'webdav_delete_remote_item' tool with the MCP server, including name, description, schema, and handler.
      'webdav_delete_remote_item',
      'Delete a file or directory from a remote WebDAV server',
      {
        path: z.string().min(1, 'Path must not be empty')
      },
      async ({ path }) => {
        try {
          // Check if path exists
          const exists = await webdavService.exists(path);
          if (!exists) {
            return {
              content: [{
                type: 'text',
                text: `Error: Path does not exist at ${path}`
              }],
              isError: true
            };
          }
    
          await webdavService.delete(path);
          
          return {
            content: [{
              type: 'text',
              text: `Successfully deleted ${path}`
            }]
          };
        } catch (error) {
          return {
            content: [{
              type: 'text',
              text: `Error deleting: ${(error as Error).message}`
            }],
            isError: true
          };
        }
      }
    );
  • Supporting WebDAVService.delete method called by the tool handler to perform the actual deletion via WebDAV client.
    async delete(path: string): Promise<void> {
      const fullPath = this.getFullPath(path);
      logger.debug(`Deleting: ${fullPath}`);
      
      try {
        // Get type before deleting for better logging
        const stat = await this.stat(fullPath).catch(() => null);
        const itemType = stat?.type || 'item';
        
        // deleteFile in v5.x returns a boolean indicating success
        const result = await this.client.deleteFile(fullPath);
        
        // Check result based on type
        if (typeof result === 'boolean' && !result) {
          throw new Error("Failed to delete: server returned failure status");
        } else if (this.isResponseData(result) && 
                   result.status !== undefined && 
                   result.status !== 204) {
          throw new Error(`Failed to delete: server returned status ${result.status}`);
        }
        
        logger.debug(`Successfully deleted ${itemType}: ${fullPath}`);
      } catch (error) {
        logger.error(`Error deleting ${fullPath}:`, error);
        throw new Error(`Failed to delete: ${(error as Error).message}`);
      }
    }
  • Registration of prompt handler for 'webdav_delete_remote_item' with MCP server.
        'webdav_delete_remote_item',
        // The issue is with boolean not being compatible with the prompt schema
        // Using string as a workaround
        {
          path: z.string().min(1, 'Path must not be empty'),
          confirm: z.string().optional()
        },
        (args) => {
          const confirmationEnabled = args.confirm !== 'false';
          const pathValue = args.path;
          const isDirectory = pathValue.endsWith('/');
          
          return {
            messages: [
              {
                role: 'user',
                content: {
                  type: 'text',
                  text: `Delete the ${isDirectory ? 'directory' : 'file'} at "${pathValue}" from the remote WebDAV server.
    ${confirmationEnabled ? 'Please confirm this action to proceed with deletion.' : 'Execute this remote deletion operation.'}
    
    Please confirm when the remote WebDAV deletion is complete.`
                }
              }
            ]
          };
        }
      );
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'Delete' implies a destructive operation, the description doesn't specify whether deletion is permanent or reversible, what permissions are required, or how errors are handled. This leaves significant gaps in understanding the tool's behavior.

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 that efficiently conveys the core purpose without unnecessary words. It's front-loaded and appropriately sized for a simple tool, with no wasted verbiage.

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 the destructive nature implied by 'Delete', the lack of annotations, no output schema, and incomplete parameter documentation, the description is insufficient. It doesn't address critical aspects like safety, permissions, or error handling, making it inadequate for a tool that performs irreversible operations.

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?

The description doesn't mention the 'path' parameter at all, and with 0% schema description coverage, the parameter is undocumented in both the schema and description. However, since there's only one parameter, the baseline is 4, but the lack of any parameter information in the description reduces this to 3, as it adds no value beyond the schema.

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 file or directory from a remote WebDAV server'), making the purpose immediately understandable. However, it doesn't explicitly distinguish this tool from its siblings like 'webdav_move_remote_item' or 'webdav_copy_remote_item' in terms of when deletion is appropriate versus moving or copying.

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. With siblings like 'webdav_move_remote_item' and 'webdav_copy_remote_item', there's no indication of when deletion is preferred over moving or copying, nor any mention of prerequisites or constraints for safe usage.

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/LaubPlusCo/mcp-webdav-server'

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