Skip to main content
Glama
masx200
by masx200

webdav_read_multiple_files

Read contents from multiple WebDAV files simultaneously to efficiently access and process multiple documents at once, saving time on individual file operations.

Instructions

Read the contents of multiple files simultaneously

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathsYesArray of file paths to read

Implementation Reference

  • The primary MCP tool handler implementation for 'webdav_read_multiple_files'. Includes tool registration with server.tool, input schema validation using Zod (paths: array of strings), execution logic that calls the service method, formats results with separators and error handling, and returns structured MCP response.
    server.tool(
      "webdav_read_multiple_files",
      "Read the contents of multiple files simultaneously",
      {
        paths: z.array(z.string()).min(
          1,
          "At least one file path must be provided",
        ).describe("Array of file paths to read"),
      },
      async ({ paths }) => {
        try {
          const results = await webdavService.readMultipleFiles(paths);
    
          const formattedResults = results.map((result) => {
            if (result.error) {
              return `${result.path}: Error - ${result.error}`;
            } else {
              return `${result.path}:\n${result.content}\n`;
            }
          });
    
          return {
            content: [{
              type: "text",
              text: formattedResults.join("\n---\n"),
            }],
          };
        } catch (error) {
          return {
            content: [{
              type: "text",
              text: `Error reading multiple files: ${(error as Error).message}`,
            }],
            isError: true,
          };
        }
      },
    );
  • Supporting utility method in WebDAVService class that implements the core logic for reading multiple files concurrently using Promise.allSettled, individual readFile calls, and returns array of results with path, content or error.
    async readMultipleFiles(
      paths: string[],
    ): Promise<{ path: string; content?: string; error?: string }[]> {
      logger.debug(`Reading multiple files`, { count: paths.length });
    
      const results = await Promise.allSettled(
        paths.map(async (path) => {
          try {
            const content = await this.readFile(path);
            return { path, content };
          } catch (error) {
            return {
              path,
              error: (error as Error).message,
            };
          }
        }),
      );
    
      const formattedResults = results.map((result) =>
        result.status === "fulfilled"
          ? result.value
          : { path: "", error: "Unknown error" }
      );
    
      logger.debug(`Multiple files read completed`, {
        success: formattedResults.filter((r) => !r.error).length,
        failed: formattedResults.filter((r) => r.error).length,
      });
    
      return formattedResults;
    }
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. While 'Read' implies a read-only operation, it doesn't specify authentication requirements, rate limits, error handling, or what happens when some files are inaccessible. For a batch operation on a remote file system, this leaves significant behavioral questions unanswered about partial successes, ordering guarantees, or performance implications.

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 communicates the core functionality without unnecessary words. It's front-loaded with the essential action and scope, making it immediately understandable. Every word earns its place in conveying the batch reading capability.

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?

For a batch file reading operation with no annotations and no output schema, the description is insufficient. It doesn't explain return format (array of contents? success/failure status per file?), error handling for partial failures, or performance considerations for simultaneous reading. Given the complexity of batch operations and lack of structured metadata, more contextual information would be valuable.

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 'multiple files' which aligns with the 'paths' parameter being an array, but adds no semantic detail beyond what the schema already provides. With 100% schema description coverage (the 'paths' parameter is well-described), the description doesn't enhance understanding of path formats, relative vs absolute paths, or file system constraints. Baseline 3 is appropriate when schema documentation is complete.

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 ('Read') and resource ('contents of multiple files'), making the purpose immediately understandable. It distinguishes from single-file read operations by specifying 'multiple files simultaneously', though it doesn't explicitly differentiate from all sibling tools like 'webdav_get_remote_file' or 'webdav_read_remote_file' which appear to be single-file variants.

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. With sibling tools like 'webdav_get_remote_file' and 'webdav_read_remote_file' that appear to handle single files, there's no indication whether this tool is preferred for batch operations or has different performance characteristics. No prerequisites, limitations, or comparison context is provided.

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/masx200/mcp-webdav-server'

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