Skip to main content
Glama
LaubPlusCo

WebDAV MCP Server

by LaubPlusCo

webdav_create_remote_file

Create new files on remote WebDAV servers by specifying file paths and content, with optional overwrite control for existing files.

Instructions

Create a new file on a remote WebDAV server at the specified path

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
contentYes
overwriteNo

Implementation Reference

  • Primary handler implementation for the 'webdav_create_remote_file' tool, including input schema validation, existence check with overwrite option, delegation to WebDAVService.writeFile, success/error responses.
      'webdav_create_remote_file',
      'Create a new file on a remote WebDAV server at the specified path',
      {
        path: z.string().min(1, 'Path must not be empty'),
        content: z.string(),
        overwrite: z.boolean().optional().default(false)
      },
      async ({ path, content, overwrite }) => {
        try {
          // Check if file exists and respect overwrite flag
          const exists = await webdavService.exists(path);
          if (exists && !overwrite) {
            return {
              content: [{
                type: 'text',
                text: `Error: File already exists at ${path}. Use overwrite=true to replace it.`
              }],
              isError: true
            };
          }
    
          await webdavService.writeFile(path, content);
          
          return {
            content: [{
              type: 'text',
              text: `File created successfully at ${path}`
            }]
          };
        } catch (error) {
          return {
            content: [{
              type: 'text',
              text: `Error creating file: ${(error as Error).message}`
            }],
            isError: true
          };
        }
      }
    );
  • Core helper function WebDAVService.writeFile that resolves full path, logs operation, calls WebDAVClient.putFileContents to create/update the remote file, and handles response validation and errors.
    async writeFile(path: string, content: string | Buffer): Promise<void> {
      const fullPath = this.getFullPath(path);
      const contentLength = typeof content === 'string' ? content.length : content.length;
      logger.debug(`Writing file: ${fullPath}`, { contentLength });
      
      try {
        // putFileContents in v5.x returns a boolean indicating success
        const result = await this.client.putFileContents(fullPath, content);
        
        // Check result based on type
        if (typeof result === 'boolean' && !result) {
          throw new Error("Failed to write file: server returned failure status");
        } else if (this.isResponseData(result) && 
                   result.status !== undefined && 
                   result.status !== 201 && 
                   result.status !== 204) {
          throw new Error(`Failed to write file: server returned status ${result.status}`);
        }
        
        logger.debug(`Successfully wrote file: ${fullPath}`);
      } catch (error) {
        logger.error(`Error writing to file ${fullPath}:`, error);
        throw new Error(`Failed to write file: ${(error as Error).message}`);
      }
    }
  • src/lib.ts:75-80 (registration)
    Top-level server initialization where setupToolHandlers is invoked to register all tools, including webdav_create_remote_file.
    logger.debug('Setting up MCP handlers');
    
    setupResourceHandlers(server, webdavService);
    setupToolHandlers(server, webdavService);
    setupPromptHandlers(server);
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 action is to 'create a new file' but doesn't mention authentication requirements, error conditions (e.g., path conflicts), rate limits, or what happens with the 'overwrite' parameter. For a mutation tool with zero annotation coverage, this leaves significant behavioral gaps.

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, well-structured sentence that efficiently conveys the core purpose without unnecessary words. It's front-loaded with the main action and resource, making it easy to parse quickly.

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 complexity of a file creation tool with 3 parameters, 0% schema description coverage, no annotations, and no output schema, the description is incomplete. It doesn't address key aspects like authentication needs, error handling, the meaning of parameters, or what the tool returns, leaving 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?

The schema description coverage is 0%, so the description must compensate for undocumented parameters. It only mentions 'path' and implies file creation, but doesn't explain the 'content' parameter (what type of content, encoding) or 'overwrite' (behavior when true/false). With 3 parameters and no schema descriptions, this adds minimal semantic value beyond the tool name.

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 ('Create a new file') and resource ('on a remote WebDAV server at the specified path'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from siblings like 'webdav_update_remote_file' or 'webdav_create_remote_directory', which would require mentioning file creation vs. directory creation or updating existing files.

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 this over 'webdav_update_remote_file' for modifying files, 'webdav_create_remote_directory' for creating folders, or other siblings like 'webdav_copy_remote_item'. There's no context about prerequisites or exclusions.

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