From cda58b867f6decf6d9df918bcb32e7a000d161a2 Mon Sep 17 00:00:00 2001 From: Dominik Jain Date: Thu, 27 Mar 2025 23:19:14 +0100 Subject: [PATCH] Use relative paths in ListDirTool, improve docstring of find_symbol --- src/serena/mcp.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/serena/mcp.py b/src/serena/mcp.py index fdfec2dc..8457b7a1 100644 --- a/src/serena/mcp.py +++ b/src/serena/mcp.py @@ -214,7 +214,10 @@ def list_dir(ctx: Context, relative_path: str, recursive: bool, max_answer_chars class ListDirTool(Tool): def _execute(self) -> str: dirs, files = scan_directory( - os.path.join(self.project_root, relative_path), recursive=recursive, ignored_dirs=self.project_config["ignored_dirs"] + os.path.join(self.project_root, relative_path), + relative_to=self.project_root, + recursive=recursive, + ignored_dirs=self.project_config["ignored_dirs"], ) return json.dumps({"dirs": dirs, "files": files}) @@ -278,7 +281,10 @@ def find_symbol( max_answer_chars: int = _DEFAULT_MAX_ANSWER_LENGTH, ) -> str: """ - Retrieves information on all symbols/code entities with the given name. + Retrieves information on all symbols/code entities, i.e. classes, methods, attributes, variables, etc. + with the given name. + The returned symbol location information can subsequently be used to edit the returned symbols + or to retrieve further information using other tools. :param ctx: the context object, which will be created and provided automatically :param name: the name of the symbols to find