Skip to content

file_read

file_read

File read tool — read file contents with path validation.

Classes

FileReadTool

FileReadTool(allowed_dirs: Optional[List[str]] = None)

Bases: BaseTool

Read file contents with optional directory restrictions.

Source code in src/openjarvis/tools/file_read.py
def __init__(
    self,
    allowed_dirs: Optional[List[str]] = None,
) -> None:
    self._allowed_dirs = [
        Path(d).expanduser().resolve() for d in resolve_allowed_dirs(allowed_dirs)
    ]

Functions