MCPcopy Create free account
hub / github.com/Ishabdullah/Codey-v2 / read

Method read

core/filesystem.py:133–166  ·  view source on GitHub ↗

Read file content. Args: path: Path to file (relative to workspace or absolute) Returns: File content as string Raises: FilesystemAccessError: If file cannot be read

(self, path: Union[str, Path])

Source from the content-addressed store, hash-verified

131 )
132
133 def read(self, path: Union[str, Path]) -> str:
134 """
135 Read file content.
136
137 Args:
138 path: Path to file (relative to workspace or absolute)
139
140 Returns:
141 File content as string
142
143 Raises:
144 FilesystemAccessError: If file cannot be read
145 """
146 try:
147 path = self._validate_path(path)
148
149 if not path.exists():
150 raise FilesystemAccessError(f"File not found: {path}")
151
152 if not path.is_file():
153 raise FilesystemAccessError(f"Not a file: {path}")
154
155 content = path.read_text(encoding='utf-8')
156 try:
157 rel = path.relative_to(self.workspace)
158 except ValueError:
159 rel = path
160 info(f"Read {rel} ({len(content)} chars)")
161 return content
162
163 except FilesystemAccessError:
164 raise
165 except Exception as e:
166 raise FilesystemAccessError(f"Failed to read {path}: {e}")
167
168 def write(self, path: Union[str, Path], content: str) -> str:
169 """

Callers 15

check_llama_embeddingsFunction · 0.80
_embed_via_llamaFunction · 0.80
tool_read_fileFunction · 0.80
startMethod · 0.80
inferMethod · 0.80
_handle_clientMethod · 0.80
_call_05bFunction · 0.80
_get_plan_remoteFunction · 0.80
get_planFunction · 0.80
startMethod · 0.80

Calls 5

_validate_pathMethod · 0.95
infoFunction · 0.90
existsMethod · 0.80
is_fileMethod · 0.80