Skip to main content
Glama
MrGNSS

Desktop Commander MCP

read_multiple_files

Read multiple files at once to access their contents efficiently. Returns each file's content with its path, continues reading even if some files fail, and operates within specified directories.

Instructions

Read the contents of multiple files simultaneously. Each file's content is returned with its path as a reference. Failed reads for individual files won't stop the entire operation. Only works within allowed directories.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathsYes

Implementation Reference

  • MCP server handler for the 'read_multiple_files' tool: parses input arguments, calls the readMultipleFiles implementation, and formats the response.
    case "read_multiple_files": {
      const parsed = ReadMultipleFilesArgsSchema.parse(args);
      const results = await readMultipleFiles(parsed.paths);
      return {
        content: [{ type: "text", text: results.join("\n---\n") }],
      };
    }
  • Core implementation function that reads multiple files concurrently, validates paths, reads contents or returns errors for each file individually.
    export async function readMultipleFiles(paths: string[]): Promise<string[]> {
        return Promise.all(
            paths.map(async (filePath: string) => {
                try {
                    const validPath = await validatePath(filePath);
                    const content = await fs.readFile(validPath, "utf-8");
                    return `${filePath}:\n${content}\n`;
                } catch (error) {
                    const errorMessage = error instanceof Error ? error.message : String(error);
                    return `${filePath}: Error - ${errorMessage}`;
                }
            }),
        );
    }
  • Zod schema defining the input arguments for the read_multiple_files tool: an array of file paths.
    export const ReadMultipleFilesArgsSchema = z.object({
      paths: z.array(z.string()),
    });
  • src/server.ts:134-141 (registration)
    Tool registration in the MCP server's tools array, specifying name, description, and input schema.
      name: "read_multiple_files",
      description:
        "Read the contents of multiple files simultaneously. " +
        "Each file's content is returned with its path as a reference. " +
        "Failed reads for individual files won't stop the entire operation. " +
        "Only works within allowed directories.",
      inputSchema: zodToJsonSchema(ReadMultipleFilesArgsSchema),
    },
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behavioral traits: partial failure tolerance ('Failed reads for individual files won't stop the entire operation'), access restrictions ('Only works within allowed directories'), and the batch nature of the operation. It doesn't mention error handling details or performance characteristics, but covers the essential safety and reliability aspects.

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 perfectly concise with three sentences that each add distinct value: the core functionality, output format, and operational constraints. There's no wasted language, and the most important information (what the tool does) is front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with no annotations, no output schema, and minimal schema documentation, the description provides good coverage of the essential context: purpose, behavior, constraints, and parameter meaning. It doesn't describe the exact return format structure or error responses, but given the tool's relative simplicity, it's reasonably complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage for the single 'paths' parameter, the description compensates well by explaining what the parameter represents ('multiple files') and the operational context ('within allowed directories'). While it doesn't specify path format requirements or array size limits, it provides sufficient semantic meaning beyond the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Read the contents of multiple files simultaneously') and distinguishes it from the sibling 'read_file' tool by emphasizing batch processing. It also specifies the resource ('files') and the output format ('Each file's content is returned with its path as a reference').

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context about when to use this tool ('Only works within allowed directories') and implies an alternative by distinguishing it from 'read_file' for single-file operations. However, it doesn't explicitly state when NOT to use it or name specific alternatives beyond the obvious sibling.

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/MrGNSS/ClaudeDesktopCommander'

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