mirascope.tools.system._file_system¶
FileSystemToolKitConfig
¶
Bases: _ConfigurableToolConfig
Configuration for file_system toolkit
FileOperation
¶
FileSystemToolKit
¶
Bases: ConfigurableToolKit[FileSystemToolKitConfig]
ToolKit for file system operations. Read, write, list, create, and delete files and directories.
ReadFile
¶
Bases: FileOperation
Tool for reading file contents.
call
¶
call() -> str
Read and return file contents.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
File contents or error message if operation fails |
Source code in mirascope/tools/system/_file_system.py
WriteFile
¶
Bases: FileOperation
Tool for writing content to a file.
call
¶
call() -> str
Write content to file and return status.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Success message or error message if operation fails |
Source code in mirascope/tools/system/_file_system.py
ListDirectory
¶
Bases: FileOperation
Tool for listing directory contents.
call
¶
call() -> str
List directory contents and return formatted string.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Formatted directory listing or error message if operation fails |
Source code in mirascope/tools/system/_file_system.py
CreateDirectory
¶
Bases: FileOperation
Tool for creating directories.
call
¶
call() -> str
Create directory and return status.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Success message or error message if operation fails |
Source code in mirascope/tools/system/_file_system.py
DeleteFile
¶
Bases: FileOperation
Tool for deleting files.
call
¶
call() -> str
Delete file and return status.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Success message or error message if operation fails |
Source code in mirascope/tools/system/_file_system.py
validate_base_directory
¶
Validates that the base directory exists and is a directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
v |
Path
|
The path to validate |
required |
Returns:
Name | Type | Description |
---|---|---|
Path |
Path
|
The validated path |
Raises:
Type | Description |
---|---|
ValueError
|
If the path doesn't exist or isn't a directory |