Skip to main content
Glama
ai-yliu

Filesystem MCP Server

by ai-yliu

read_multiple_files

Read multiple files at once to access their contents simultaneously, saving time compared to reading files individually.

Instructions

Read multiple files simultaneously

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathsYesArray of file paths to read

Implementation Reference

  • The handler function for the 'read_multiple_files' tool. Extracts paths from input, loops through each validating access and reading content or capturing errors, then returns a JSON-formatted array of results with path, content, or error per file.
    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 ListTools response, specifying name, description, and input schema for an object with required 'paths' array of strings.
    { 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, requiring an object with a 'paths' property that is an array of strings.
    inputSchema: { type: 'object', properties: { paths: { type: 'array', items: { type: 'string', }, description: 'Array of file paths to read', }, }, required: ['paths'], },

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