Skip to main content
Glama
StrawHatAI

Claude Desktop Commander MCP

by StrawHatAI

read_multiple_files

Read contents from multiple files at once, returning each file's content with its path. Individual file read failures don't stop the entire operation, working within allowed 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

  • Core handler function that asynchronously reads multiple files, validates each path for security, reads content or catches and reports errors for each.
    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: an array of file paths.
    export const ReadMultipleFilesArgsSchema = z.object({
      paths: z.array(z.string()),
    });
  • src/server.ts:133-141 (registration)
    Tool registration in the listTools handler, defining name, description, and input schema for discovery.
    {
      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),
    },
  • Server-side dispatcher handler that parses input args, calls the core readMultipleFiles function, and formats the response for MCP.
    case "read_multiple_files": {
      const parsed = ReadMultipleFilesArgsSchema.parse(args);
      const results = await readMultipleFiles(parsed.paths);
      return {
        content: [{ type: "text", text: results.join("\n---\n") }],
      };
    }
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by disclosing key behavioral traits: partial failure tolerance ('failed reads for individual files won't stop the entire operation'), directory restrictions, and output format ('each file's content is returned with its path'). It doesn't mention error handling details or performance characteristics.

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?

Three sentences that are front-loaded with core functionality, followed by important behavioral details, and ending with constraints. Every sentence adds value with zero wasted words or redundancy.

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 read operation with no annotations and no output schema, the description provides good coverage of purpose, behavior, and constraints. It could be more complete by specifying error response format or performance expectations, but covers the essentials well given the tool's moderate complexity.

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 schema has 0% description coverage for the single 'paths' parameter. The description adds some context by implying these are file paths and mentioning directory restrictions, but doesn't specify path format requirements, maximum array size, or other constraints beyond what's obvious from the parameter name.

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 tool's purpose with specific verbs ('read', 'return') and resource ('multiple files simultaneously'), distinguishing it from sibling 'read_file' which handles single files. It specifies the scope of operation and output format.

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 ('read multiple files simultaneously') and mentions constraints ('only works within allowed directories'), but doesn't explicitly contrast with alternatives like 'read_file' for single files or 'search_files' for finding files.

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/StrawHatAI/claude-dev-tools'

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