codemap_read_multiple

Read content from multiple files in one call.

ioreadbatchmultiple

Parameters

NameTypeRequiredDescription
targetstring✅ RequiredComma-separated list of file paths (e.g., 'src/a.ts,src/b.ts,src/c.ts')
maxLinesnumber❌ OptionalMaximum lines per file (default: 1000) (default: 1000)

Usage Examples

MCP Usage (for AI Agents like Claude)

json
{
  "name": "codemap_read_multiple",
  "arguments": {
    "target": "src/config/dev.ts,src/config/staging.ts,src/config/prod.ts"
  }
}

Example Output

JSON Response

json
{
  "success": true,
  "data": {
    "files": {
      "src/config/dev.ts": {
        "content": "export const API_URL = 'http://localhost:3000';",
        "totalLines": 5,
        "truncated": false
      },
      "src/config/prod.ts": {
        "content": "export const API_URL = 'https://api.prod.com';",
        "totalLines": 5,
        "truncated": false
      }
    },
    "count": 2
  }
}
ℹ️When to Use This Tool
    Use codemap_read_multiple when you need to:
  • Compare multiple related files (configs, versions)
  • Analyze file sets in batch operations
  • Read all files in a category simultaneously
  • Reduce round-trip overhead for multiple reads
💡Common Patterns
Config Comparison
1. List all config files
2. Read multiple with one call
3. Compare contents


Batch Processing
1. Get list of files to process
2. Read all with read_multiple
3. Process results in parallel
💡Pro Tips
  • Use comma-separated paths: Separate file paths with commas, spaces are trimmed
  • Set maxLines for large files: Default 1000 lines per file prevents memory issues
  • Check truncated flag: Each file result includes truncated boolean
  • Handle errors per file: Individual file errors don't fail entire operation
✅Best Practices
  • Limit batch size to 10-20 files for performance
  • Use maxLines parameter for large files
  • Check truncated flag before processing
  • Handle individual file errors gracefully
⚠️Common Mistakes
❌ Mistake: Reading 100+ files in one call, causing timeout
✅ Instead: Batch reads into groups of 10-20 files

❌ Mistake: Not setting maxLines for large files
✅ Instead: Set appropriate maxLines based on your needs

❌ Mistake: Assuming all files succeed
✅ Instead: Check each file result for errors

❌ Mistake: Not checking truncated flag
✅ Instead: Verify truncated=false when you need complete content

Related Tools