Skip to main content
Glama

webdav_get_remote_file

Retrieve content from files stored on remote WebDAV servers by specifying the file path, enabling access to remote file data through simple path-based requests.

Instructions

Retrieve content from a file stored on a remote WebDAV server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Implementation Reference

  • MCP server.tool call that registers the webdav_get_remote_file tool, provides its description, input schema using Zod, and defines the inline execution handler.
    server.tool( "webdav_get_remote_file", "Retrieve content from a file stored on a remote WebDAV server", { path: z.string().min(1, "Path must not be empty"), }, async ({ path }) => { try { const content = await webdavService.readFile(path); return { content: [{ type: "text", text: content, }], }; } catch (error) { return { content: [{ type: "text", text: `Error reading file: ${(error as Error).message}`, }], isError: true, }; } }, );
  • The WebDAVService.readFile method implements the core file reading logic using WebDAVClient.getFileContents with text format, handles response formats, and includes logging and error handling. This is called by the tool handler.
    async readFile(path: string): Promise<string> { const fullPath = this.getFullPath(path); logger.debug(`Reading file: ${fullPath}`); try { // v5.x returns buffer by default, need to use format: 'text' const content = await this.client.getFileContents(fullPath, { format: "text", }); // Handle both direct string response and detailed response let result: string; if (typeof content === "string") { result = content; } else if (this.isResponseData(content)) { result = String(content.data); } else { throw new Error("Unexpected response format from server"); } const contentLength = result.length; logger.debug(`Read file: ${fullPath}`, { contentLength }); return result; } catch (error) { logger.error(`Error reading file ${fullPath}:`, error); throw new Error(`Failed to read file: ${(error as Error).message}`); } }
  • src/lib.ts:79-79 (registration)
    Top-level call to setupToolHandlers which registers all WebDAV tools, including webdav_get_remote_file, on the MCP server instance.
    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/masx200/mcp-webdav-server'

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