Skip to main content
Glama
LaubPlusCo

WebDAV MCP Server

by LaubPlusCo

webdav_copy_remote_item

Copy files or directories between locations on a remote WebDAV server. Specify source and destination paths to duplicate items within the server's file system.

Instructions

Copy a file or directory to a new location on a remote WebDAV server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fromPathYes
toPathYes
overwriteNo

Implementation Reference

  • Registers and implements the 'webdav_copy_remote_item' MCP tool handler. Defines input schema with Zod, performs pre-copy validation (source/dest existence, overwrite check), executes the copy via WebDAVService, and returns formatted success/error responses.
      'webdav_copy_remote_item',
      'Copy a file or directory to a new location on a remote WebDAV server',
      {
        fromPath: z.string().min(1, 'Source path must not be empty'),
        toPath: z.string().min(1, 'Destination path must not be empty'),
        overwrite: z.boolean().optional().default(false)
      },
      async ({ fromPath, toPath, overwrite }) => {
        try {
          // Check if source exists
          const sourceExists = await webdavService.exists(fromPath);
          if (!sourceExists) {
            return {
              content: [{
                type: 'text',
                text: `Error: Source path does not exist at ${fromPath}`
              }],
              isError: true
            };
          }
    
          // Check if destination exists and respect overwrite flag
          const destExists = await webdavService.exists(toPath);
          if (destExists && !overwrite) {
            return {
              content: [{
                type: 'text',
                text: `Error: Destination already exists at ${toPath}. Use overwrite=true to replace it.`
              }],
              isError: true
            };
          }
    
          await webdavService.copy(fromPath, toPath);
          
          return {
            content: [{
              type: 'text',
              text: `Successfully copied ${fromPath} to ${toPath}`
            }]
          };
        } catch (error) {
          return {
            content: [{
              type: 'text',
              text: `Error copying: ${(error as Error).message}`
            }],
            isError: true
          };
        }
      }
    );
  • Zod input schema for the webdav_copy_remote_item tool parameters.
    {
      fromPath: z.string().min(1, 'Source path must not be empty'),
      toPath: z.string().min(1, 'Destination path must not be empty'),
      overwrite: z.boolean().optional().default(false)
    },
  • Core copy implementation in WebDAVService class. Normalizes paths, logs operation, performs copy using WebDAVClient.copyFile, validates response, handles errors.
    async copy(fromPath: string, toPath: string): Promise<void> {
      const fullFromPath = this.getFullPath(fromPath);
      const fullToPath = this.getFullPath(toPath);
      logger.debug(`Copying from ${fullFromPath} to ${fullToPath}`);
      
      try {
        // Get type before copying for better logging
        const stat = await this.stat(fromPath).catch(() => null);
        const itemType = stat?.type || 'item';
        
        // copyFile in v5.x returns a boolean indicating success
        const result = await this.client.copyFile(fullFromPath, fullToPath);
        
        // Check result based on type
        if (typeof result === 'boolean' && !result) {
          throw new Error("Failed to copy: server returned failure status");
        } else if (this.isResponseData(result) && 
                   result.status !== undefined && 
                   result.status !== 201 && 
                   result.status !== 204) {
          throw new Error(`Failed to copy: server returned status ${result.status}`);
        }
        
        logger.debug(`Successfully copied ${itemType} from ${fullFromPath} to ${fullToPath}`);
      } catch (error) {
        logger.error(`Error copying from ${fullFromPath} to ${fullToPath}:`, error);
        throw new Error(`Failed to copy: ${(error as Error).message}`);
      }
    }
  • src/lib.ts:78-78 (registration)
    Top-level call to setupToolHandlers which registers all WebDAV tools including webdav_copy_remote_item.
    setupToolHandlers(server, webdavService);
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 mentions the copy action but doesn't describe key behaviors: whether it requires specific permissions, how it handles errors (e.g., if source doesn't exist), if it preserves metadata, or what the return value indicates. The 'overwrite' parameter hints at conflict behavior, but the description doesn't explain this. For a mutation tool with zero annotation coverage, this is inadequate.

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, efficient sentence that directly states the tool's function without unnecessary words. It's front-loaded with the core action and resource, making it easy to parse. Every part of the sentence contributes essential information, achieving optimal conciseness.

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 tool's complexity (a remote file operation with 3 parameters), lack of annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects like error handling, permissions, or return values, and parameter semantics are poorly addressed. For a mutation tool in a sibling-rich environment, this leaves significant gaps for an AI agent.

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

Parameters2/5

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

Schema description coverage is 0%, so the schema provides no parameter documentation. The description mentions 'file or directory' and 'new location' which loosely map to fromPath and toPath, but it doesn't explain path formats, validation rules, or the meaning of 'overwrite' beyond its name. It adds minimal semantic value, failing to compensate for the lack of schema descriptions.

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 ('Copy') and the resource ('a file or directory') with the destination context ('to a new location on a remote WebDAV server'). It distinguishes from siblings like 'move' or 'delete' by specifying the copy operation, though it doesn't explicitly contrast with all siblings. The purpose is specific but could be more differentiated.

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 when to choose copy over move (webdav_move_remote_item) or how it relates to creation tools (webdav_create_remote_file/directory). There's no context about prerequisites, error conditions, or typical use cases, leaving the agent with minimal usage direction.

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