summaryrefslogtreecommitdiff
path: root/docs/tools/multi-file.md
diff options
context:
space:
mode:
authorcperry-goog <[email protected]>2025-05-15 20:04:33 -0700
committerGitHub <[email protected]>2025-05-15 20:04:33 -0700
commit58ef39e2a964386a1026ba68419e4d64c4612551 (patch)
tree5c00113b2a92a33ee9bc4f0d4dc03782d3b342b2 /docs/tools/multi-file.md
parent3674fb0c7e230651f1f33c4d46b24ca003dd532a (diff)
Docs: Add initial project documentation structure and content (#368)
Co-authored-by: Taylor Mullen <[email protected]>
Diffstat (limited to 'docs/tools/multi-file.md')
-rw-r--r--docs/tools/multi-file.md36
1 files changed, 36 insertions, 0 deletions
diff --git a/docs/tools/multi-file.md b/docs/tools/multi-file.md
new file mode 100644
index 00000000..7eaad714
--- /dev/null
+++ b/docs/tools/multi-file.md
@@ -0,0 +1,36 @@
+# Multi-File Read Tool
+
+This document provides details on the `read_many_files` tool.
+
+## `read_many_files`
+
+- **Purpose:** Reads content from multiple text files specified by paths or glob patterns and concatenates them into a single string. This is useful for getting an overview of a codebase, finding where specific functionality is implemented, reviewing documentation, or gathering context from multiple configuration files.
+- **Arguments:**
+ - `paths` (list[string], required): An array of glob patterns or paths relative to the tool's target directory (e.g., `["src/**/*.ts"]`, `["README.md", "docs/"]`).
+ - `exclude` (list[string], optional): Glob patterns for files/directories to exclude (e.g., `["**/*.log", "temp/"]`). These are added to default excludes if `useDefaultExcludes` is true.
+ - `include` (list[string], optional): Additional glob patterns to include. These are merged with `paths` (e.g., `["*.test.ts"]` to specifically add test files if they were broadly excluded).
+ - `recursive` (boolean, optional): Whether to search recursively. This is primarily controlled by `**` in glob patterns. Defaults to `true`.
+ - `useDefaultExcludes` (boolean, optional): Whether to apply a list of default exclusion patterns (e.g., `node_modules`, `.git`, binary files). Defaults to `true`.
+- **Behavior:**
+ - The tool searches for files matching the provided `paths` and `include` patterns, while respecting `exclude` patterns and default excludes (if enabled).
+ - It reads the content of each matched text file (attempting to skip binary files).
+ - The content of all successfully read files is concatenated into a single string, with a separator `--- {filePath} ---` between the content of each file.
+ - Uses UTF-8 encoding by default.
+- **Examples:**
+ - Reading all TypeScript files in the `src` directory:
+ ```
+ read_many_files(paths=["src/**/*.ts"])
+ ```
+ - Reading the main README and all Markdown files in the `docs` directory, excluding a specific file:
+ ```
+ read_many_files(paths=["README.md", "docs/**/*.md"], exclude=["docs/OLD_README.md"])
+ ```
+ - Reading all JavaScript files but explicitly including test files that might otherwise be excluded by a global pattern:
+ ```
+ read_many_files(paths=["**/*.js"], include=["**/*.test.js"], useDefaultExcludes=False)
+ ```
+- **Important Notes:**
+ - **Binary Files:** This tool is designed for text files and attempts to skip binary files. Its behavior with binary content is not guaranteed.
+ - **Performance:** Reading a very large number of files or very large individual files can be resource-intensive.
+ - **Path Specificity:** Ensure paths and glob patterns are correctly specified relative to the tool's target directory.
+ - **Default Excludes:** Be aware of the default exclusion patterns (like `node_modules`, `.git`) and use `useDefaultExcludes=False` if you need to override them, but do so cautiously.