Skip to main content
Glama
LaubPlusCo

WebDAV MCP Server

by LaubPlusCo

webdav_list_remote_directory

List files and directories from a remote WebDAV server path to view available content and navigate the file system.

Instructions

List files and directories at the specified path on a remote WebDAV server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNo/

Implementation Reference

  • MCP tool handler implementation for 'webdav_list_remote_directory'. Registers the tool with Zod input schema (path optional, defaults to '/'), executes webdavService.list(path), formats results as JSON, and returns as text content or error.
    server.tool(
      'webdav_list_remote_directory',
      'List files and directories at the specified path on a remote WebDAV server',
      {
        path: z.string().optional().default('/')
      },
      async ({ path }) => {
        try {
          const files = await webdavService.list(path);
          
          // Format response
          const formattedFiles = files.map(file => ({
            name: file.basename,
            path: file.filename,
            type: file.type,
            size: file.size,
            lastModified: file.lastmod
          }));
          
          return {
            content: [{
              type: 'text',
              text: JSON.stringify(formattedFiles, null, 2)
            }]
          };
        } catch (error) {
          return {
            content: [{
              type: 'text',
              text: `Error listing directory: ${(error as Error).message}`
            }],
            isError: true
          };
        }
      }
    );
  • Core helper method implementing directory listing using WebDAVClient.getDirectoryContents, handling response formats, converting to FileStat[], with full path resolution and logging.
    async list(path: string = '/'): Promise<FileStat[]> {
      const fullPath = this.getFullPath(path);
      logger.debug(`Listing directory: ${fullPath}`);
      
      try {
        // In v5.x we need to handle the response differently
        const result = await this.client.getDirectoryContents(fullPath);
        
        // Convert the result to our FileStat interface
        const fileStats = Array.isArray(result) 
          ? result.map(item => this.convertToFileStat(item))
          : this.isResponseData(result) && Array.isArray(result.data)
            ? result.data.map(item => this.convertToFileStat(item))
            : [];
            
        logger.debug(`Listed ${fileStats.length} items in directory: ${fullPath}`);
        return fileStats;
      } catch (error) {
        logger.error(`Error listing directory ${fullPath}:`, error);
        throw new Error(`Failed to list directory: ${(error as Error).message}`);
      }
    }
  • src/lib.ts:77-79 (registration)
    Top-level server initialization calls setupToolHandlers(server, webdavService), which registers the 'webdav_list_remote_directory' tool among others.
    setupResourceHandlers(server, webdavService);
    setupToolHandlers(server, webdavService);
    setupPromptHandlers(server);
  • Zod input schema for the tool: path as optional string defaulting to '/'.
    {
      path: z.string().optional().default('/')
    },
  • Supporting utility for basename extraction used in FileStat conversion.
    private getBasenameFromPath(path: string): string {
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states what the tool does but doesn't describe how it behaves: no information about pagination, error handling, rate limits, authentication requirements, or what the output looks like. For a read operation on a remote server, this leaves significant gaps in understanding the tool's behavior.

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 states the core functionality without unnecessary words. It's appropriately sized for a simple listing tool and front-loads the essential information. Every word earns its place in conveying the tool's purpose.

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 moderate complexity (remote server interaction), lack of annotations, and no output schema, the description is incomplete. It doesn't address authentication needs, error conditions, output format, or limitations. For a tool that interacts with external systems, more contextual information would be necessary for an agent to use it 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 'specified path' which maps to the single 'path' parameter in the schema. However, schema description coverage is 0%, so the schema provides no documentation about this parameter. The description adds minimal semantic context (it's a path on the remote server) but doesn't specify format, constraints, or default behavior. This meets the baseline 3 since it compensates somewhat for the schema gap.

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 ('List') and resource ('files and directories') with specific scope ('at the specified path on a remote WebDAV server'). It distinguishes from siblings like webdav_get_remote_file (which retrieves file contents) and webdav_delete_remote_item (which removes items). However, it doesn't explicitly contrast with all siblings, keeping it at 4 rather than 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 prerequisites like authentication, nor does it differentiate from potential overlapping functionality with other listing or browsing tools that might exist in a broader context. The agent receives no usage context beyond the basic purpose.

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