Skip to main content
Glama
LaubPlusCo

WebDAV MCP Server

by LaubPlusCo

webdav_get_remote_file

Retrieve content from files stored on remote WebDAV servers by specifying the file path to access and download data.

Instructions

Retrieve content from a file stored on a remote WebDAV server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Implementation Reference

  • The MCP tool handler function that executes the webdav_get_remote_file logic by calling WebDAVService.readFile(path) and returning the content or error.
    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
        };
      }
    }
  • Zod input schema validation for the tool parameters.
    {
      path: z.string().min(1, 'Path must not be empty')
    },
  • Registration of the webdav_get_remote_file tool with MCP server.tool, including name, description, schema, and handler reference.
    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
          };
        }
      }
    );
  • Core implementation of file reading in WebDAVService using WebDAVClient.getFileContents with text format, handling various response types.
    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}`);
      }
    }
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. It states the action 'retrieve content' but lacks details on permissions, error handling, rate limits, or output format. For a read operation with zero annotation coverage, this is insufficient to inform the agent adequately.

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 with zero wasted words. It's front-loaded with the core action and resource, making it easy to parse quickly. Every word earns its place, 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 complexity of remote file retrieval, lack of annotations, no output schema, and minimal parameter guidance, the description is incomplete. It doesn't cover authentication needs, error cases, or return values, leaving significant gaps for the agent to operate effectively.

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 mentions 'path' implicitly but doesn't elaborate beyond what the schema provides (a required string). With 0% schema description coverage, the description adds minimal value—it implies the path is to a file but doesn't specify format or constraints. This meets the baseline for low coverage without fully compensating.

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 verb 'retrieve' and the resource 'content from a file stored on a remote WebDAV server', making the purpose unambiguous. However, it doesn't explicitly differentiate from siblings like 'webdav_list_remote_directory' (which lists vs. retrieves content) or 'webdav_update_remote_file' (which modifies vs. reads), missing full sibling distinction for a 5.

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 scenarios like reading vs. listing files, prerequisites such as authentication or server access, or exclusions for non-file items. This leaves the agent with minimal context for selection.

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