Skip to main content
Glama
LaubPlusCo

WebDAV MCP Server

by LaubPlusCo

webdav_create_remote_directory

Generate a new directory on a remote WebDAV server by specifying the desired path, enabling organized file management and structured data storage.

Instructions

Create a new directory on a remote WebDAV server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Implementation Reference

  • Full MCP tool registration and handler for 'webdav_create_remote_directory'. Includes input schema validation with Zod, execution logic that calls WebDAVService.createDirectory, and formatted success/error responses.
    server.tool( 'webdav_create_remote_directory', 'Create a new directory on a remote WebDAV server', { path: z.string().min(1, 'Path must not be empty') }, async ({ path }) => { try { await webdavService.createDirectory(path); return { content: [{ type: 'text', text: `Directory created successfully at ${path}` }] }; } catch (error) { return { content: [{ type: 'text', text: `Error creating directory: ${(error as Error).message}` }], isError: true }; } } );
  • Input schema for the tool using Zod: requires a non-empty path string.
    { path: z.string().min(1, 'Path must not be empty') },
  • Core implementation of directory creation in WebDAVService class. Normalizes the path, calls WebDAVClient.createDirectory, handles various response formats, and provides comprehensive logging and error handling.
    async createDirectory(path: string): Promise<void> { const fullPath = this.getFullPath(path); logger.debug(`Creating directory: ${fullPath}`); try { // createDirectory in v5.x returns a boolean indicating success const result = await this.client.createDirectory(fullPath); // Check result based on type if (typeof result === 'boolean' && !result) { throw new Error("Failed to create directory: server returned failure status"); } else if (this.isResponseData(result) && result.status !== undefined && result.status !== 201 && result.status !== 204) { throw new Error(`Failed to create directory: server returned status ${result.status}`); } logger.debug(`Successfully created directory: ${fullPath}`); } catch (error) { logger.error(`Error creating directory ${fullPath}:`, error); throw new Error(`Failed to create directory: ${(error as Error).message}`); } }
  • src/lib.ts:78-78 (registration)
    Top-level registration where setupToolHandlers is called on the main McpServer instance, which in turn registers the webdav_create_remote_directory tool.
    setupToolHandlers(server, webdavService);

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