Skip to main content
Glama
ai-yliu

Filesystem MCP Server

by ai-yliu

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
NameRequiredDescriptionDefault
pathsYesArray of file paths to read

Implementation Reference

  • 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'], }, },
  • 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'],

Other Tools

Related 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/ai-yliu/filesystem-mcp-server'

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