Forked from taderich73/filesystem-access
Source code | LM Studio listing
Allows filesystem access for the following actions:
All tools now return a JSON string with one of the following shapes:
code: stable machine-readable error codemessage: human-readable explanationCurrent error codes include:
DIR_NOT_SETpath_exists can also return:
PATH_OUTSIDE_BASEmove_file can also return:
SOURCE_PATH_OUTSIDE_BASEDESTINATION_PATH_OUTSIDE_BASESOURCE_EQUALS_DESTINATIONSOURCE_FILE_NOT_FOUNDSOURCE_NOT_FILEcopy_file can also return:
SOURCE_PATH_OUTSIDE_BASEDESTINATION_PATH_OUTSIDE_BASESOURCE_EQUALS_DESTINATIONSOURCE_FILE_NOT_FOUNDSOURCE_NOT_FILEDESTINATION_IS_DIRECTORYDESTINATION_EXISTScopy_directory can also return:
SOURCE_PATH_OUTSIDE_BASEDESTINATION_PATH_OUTSIDE_BASESOURCE_EQUALS_DESTINATIONDESTINATION_INSIDE_SOURCEmove_directory can also return:
SOURCE_PATH_OUTSIDE_BASEDESTINATION_PATH_OUTSIDE_BASEmove_file moves a file from source_path to destination_path within the configured base directory.
source_path must exist and be a file.overwrite is not true, the tool returns DESTINATION_EXISTS.destination_path are created automatically.copy_file copies a file from source_path to destination_path within the configured base directory.
source_path must exist and be a file.overwrite is not true, the tool returns DESTINATION_EXISTS.destination_path are created automatically.copy_directory copies a directory from source_path to destination_path within the configured base directory.
source_path must exist and be a directory.overwrite is not true, the tool returns DESTINATION_EXISTS.move_directory moves a directory from source_path to destination_path within the configured base directory.
source_path must exist and be a directory.overwrite is not true, the tool returns DESTINATION_EXISTS.destination_path are created automatically.delete_file deletes a single file at file_name within the configured base directory.
deleted: true with file_name and relative_path.delete_directory deletes a directory at directory_path within the configured base directory.
recursive is false; non-empty directories return DIRECTORY_NOT_EMPTY.recursive: true to delete non-empty directories.find_file searches recursively inside the configured base directory:
Example find_file success payload:
write_file, read_file, find_file, and create_directory accept names with spaces and common path characters.
Path safety is enforced by keeping all resolved paths inside the configured base directory.
path_exists checks whether a path exists inside the configured base directory.
exists: true and path_type as file or directory.ok: true with and .This project uses vitest for unit tests.
Install dependencies and run tests:
Watch mode:
Coverage report:
Coverage output is generated in coverage/ with HTML (coverage/index.html) and lcov formats.
The coverage run includes a threshold gate and fails if global coverage drops below: statements 80%, lines 80%, functions 70%, branches 60%.
DIR_NOT_AVAILABLEFILE_PATH_OUTSIDE_BASEDIRECTORY_PATH_OUTSIDE_BASEFILE_NOT_FOUNDFILE_NOT_FILEDIRECTORY_NOT_FOUNDDIRECTORY_NOT_DIRECTORYDIRECTORY_NOT_EMPTYDELETE_FAILEDPATH_OUTSIDE_BASEDESTINATION_IS_DIRECTORYDESTINATION_EXISTSCROSS_DEVICE_MOVE_UNSUPPORTEDMOVE_FAILEDCOPY_FAILEDSOURCE_DIRECTORY_NOT_FOUNDSOURCE_NOT_DIRECTORYDESTINATION_NOT_DIRECTORYDESTINATION_EXISTSCOPY_FAILEDSOURCE_EQUALS_DESTINATIONDESTINATION_INSIDE_SOURCESOURCE_DIRECTORY_NOT_FOUNDSOURCE_NOT_DIRECTORYDESTINATION_NOT_DIRECTORYDESTINATION_EXISTSCROSS_DEVICE_MOVE_UNSUPPORTEDMOVE_FAILEDdestination_path are created automatically.file_name query supports spaces and common filename characters.matches with fields: file_name, relative_path, score.score: 1 and match_type: "exact".0 < score < 1 and match_type: "lax".ok remains true with match_type: "none" and matches: [].exists: falsepath_type: "missing"PATH_OUTSIDE_BASE.{
"ok": true,
"operation": "write_file",
"data": {}
}
{
"ok": false,
"operation": "read_file",
"error": {
"code": "FILE_NOT_FOUND",
"message": "File does not exist"
}
}
{
"ok": true,
"operation": "find_file",
"data": {
"query": "report_2026",
"match_type": "lax",
"count": 1,
"matches": [
{
"file_name": "report-final-2026.md",
"relative_path": "notes/report-final-2026.md",
"score": 0.83
}
]
}
}
npm install
npm test
npm run test:watch
npm run test:coverage