read_multiple_files
Read multiple files simultaneously from specified paths using the Filesystem MCP Server. This tool enables efficient batch file processing for streamlined data access and handling.
Instructions
Read multiple files simultaneously
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| paths | Yes | Array of file paths to read |
Implementation Reference
- src/index.ts:252-278 (handler)Handler for the 'read_multiple_files' tool. Validates each path, reads file contents asynchronously, collects results or errors per file, and returns JSON-formatted response.case 'read_multiple_files': { const { paths } = request.params.arguments as { paths: string[] }; const results: { path: string; content?: string; error?: string }[] = []; for (const filePath of paths) { try { validatePath(filePath); const content = await fs.readFile(filePath, 'utf8'); results.push({ path: filePath, content }); } catch (error) { results.push({ path: filePath, error: error instanceof Error ? error.message : String(error) }); } } return { content: [ { type: 'text', text: JSON.stringify(results, null, 2), }, ], }; }
- src/index.ts:109-125 (registration)Registration of the 'read_multiple_files' tool in the tools list, including description and input schema requiring an array of paths.{ name: 'read_multiple_files', description: 'Read multiple files simultaneously', inputSchema: { type: 'object', properties: { paths: { type: 'array', items: { type: 'string', }, description: 'Array of file paths to read', }, }, required: ['paths'], }, },
- src/index.ts:112-123 (schema)Input schema definition for the 'read_multiple_files' tool, specifying an object with a required 'paths' array of strings.inputSchema: { type: 'object', properties: { paths: { type: 'array', items: { type: 'string', }, description: 'Array of file paths to read', }, }, required: ['paths'],