Skip to main content
Glama

read_multiple

Read multiple files simultaneously to retrieve content from specified paths with configurable encoding and error handling options.

Instructions

Read multiple files at once

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathsYesArray of file paths
encodingNoFile encoding
fail_on_errorNoFail if any file errors

Implementation Reference

  • The implementation of the read_multiple tool handler.
    async function readMultipleImpl(input: {
      paths: string[];
      encoding?: string;
      fail_on_error?: boolean;
    }): Promise<ToolResult> {
      const results: Array<{
        path: string;
        success: boolean;
        content?: string;
        error?: string;
      }> = [];
    
      for (const filePath of input.paths) {
        const result = await readFileImpl({
          path: filePath,
          encoding: input.encoding ?? 'utf-8',
          max_size_kb: 10240,
        });
    
        if ('isError' in result && result.isError) {
          if (input.fail_on_error) {
            return result;
          }
          results.push({
            path: filePath,
            success: false,
            error: result.content[0].text,
          });
        } else {
          results.push({
            path: filePath,
            success: true,
            content: result.content[0].text,
          });
        }
      }
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(results, null, 2),
          },
        ],
      };
    }
  • Registration of the read_multiple tool.
    // read_multiple tool
    server.tool(
      'read_multiple',
      'Read multiple files at once',
      {
        paths: z.array(z.string()).describe('Array of file paths'),
        encoding: z.string().optional().describe('File encoding'),
        fail_on_error: z.boolean().optional().describe('Fail if any file errors'),
      },
      async (args) => {
        return await readMultipleImpl(args);
      }
    );
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: whether it returns concatenated content or structured results, how errors are handled (beyond the 'fail_on_error' parameter), or performance implications of reading multiple files simultaneously. This is inadequate for a tool with mutation potential (reading files).

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 functionality and appropriately sized for a straightforward tool. Every word earns its place.

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 a batch file-reading operation with no annotations and no output schema, the description is insufficient. It doesn't explain what format the results take (array of contents? object with paths as keys?), how encoding applies across multiple files, or what happens when some files succeed and others fail. For a tool with 3 parameters and file system interaction, this leaves significant gaps.

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?

Schema description coverage is 100%, so all parameters are documented in the schema. The description adds no additional parameter semantics beyond what's already in the schema descriptions. This meets the baseline expectation when the schema does the heavy lifting, but provides no extra value.

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 'Read multiple files at once' clearly states the verb ('Read') and resource ('multiple files'), making the purpose immediately understandable. However, it doesn't distinguish this tool from its sibling 'read_file' beyond the 'multiple' aspect, missing an opportunity to clarify the batch operation versus single-file reading.

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 like 'read_file' or 'read_directory'. It doesn't mention prerequisites, performance considerations, or error handling scenarios, leaving the agent to infer usage from the tool name alone.

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/mcp-tool-shop-org/mcp-file-forge'

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