MCPcopy Create free account
hub / github.com/FSoft-AI4Code/HyperAgent / _run

Method _run

src/hyperagent/tools/nav_tools.py:225–243  ·  view source on GitHub ↗

Run the tool to get all symbols of a Python file. Args: path_to_file (str): The path to the Python file. preview_size (int, optional): The number of symbols to preview. Defaults to 5. Returns: Union[List[str], str]: The list of symbols o

(self, path_to_file: str, keyword: Optional[str] = None)

Source from the content-addressed store, hash-verified

223 self.path = path
224
225 def _run(self, path_to_file: str, keyword: Optional[str] = None):
226 """
227 Run the tool to get all symbols of a Python file.
228
229 Args:
230 path_to_file (str): The path to the Python file.
231 preview_size (int, optional): The number of symbols to preview. Defaults to 5.
232
233 Returns:
234 Union[List[str], str]: The list of symbols or an error message.
235 """
236 try:
237 return get_symbol_verbose(osp.join(self.path, path_to_file), self.path, keyword)
238 except IsADirectoryError:
239 return "The relative path is a folder, please specify the file path instead. Consider using get_tree_structure to find the file name then use this tool one file path at a time"
240 except FileNotFoundError:
241 return "The file is not found, please check the path again"
242 except lsp_protocol_handler.server.Error:
243 return "Internal error, please use other tool"
244
245class GetTreeStructureArgs(BaseModel):
246 relative_path: str = Field(..., description="The relative path of the folder we want to explore")

Callers

nothing calls this directly

Calls 1

get_symbol_verboseFunction · 0.90

Tested by

no test coverage detected