From e62f518e4e4a8ca0b821599854eb86205acfc3d6 Mon Sep 17 00:00:00 2001 From: Michael Panchenko Date: Fri, 20 Feb 2026 14:56:10 +0100 Subject: [PATCH] FindReferences tools - remove include_info parameter Rationale: requesting the info is just not worth it. The risk of the tool being slow or the info bloating the answer unnecessarily are too high. If an agent needs more info about the found references, it can get this info by itself in subsequent tool calls, --- src/serena/tools/jetbrains_tools.py | 5 +---- src/serena/tools/symbol_tools.py | 11 ----------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/src/serena/tools/jetbrains_tools.py b/src/serena/tools/jetbrains_tools.py index 67f7ac28..8ec84a07 100644 --- a/src/serena/tools/jetbrains_tools.py +++ b/src/serena/tools/jetbrains_tools.py @@ -98,7 +98,6 @@ class JetBrainsFindReferencingSymbolsTool(Tool, ToolMarkerSymbolicRead, ToolMark self, name_path: str, relative_path: str, - include_info: bool = False, max_answer_chars: int = -1, ) -> str: """ @@ -108,8 +107,6 @@ class JetBrainsFindReferencingSymbolsTool(Tool, ToolMarkerSymbolicRead, ToolMark :param name_path: name path of the symbol for which to find references; matching logic as described in find symbol tool. :param relative_path: the relative path to the file containing the symbol for which to find references. Note that here you can't pass a directory but must pass a file. - :param include_info: whether to include info (hover-like, typically including docstring and signature) - about the referencing symbols. Default False. :param max_answer_chars: max characters for the JSON result. If exceeded, no content is returned. -1 means the default value from the config will be used. :return: a list of JSON objects with the symbols referencing the requested symbol @@ -118,7 +115,7 @@ class JetBrainsFindReferencingSymbolsTool(Tool, ToolMarkerSymbolicRead, ToolMark response_dict = client.find_references( name_path=name_path, relative_path=relative_path, - include_quick_info=False, # TODO: Hotfix for serena-jetbrains-plugin/issues/13; revert once fixed + include_quick_info=False, ) symbol_dicts = response_dict["symbols"] result = self.symbol_dict_grouper.group(symbol_dicts) diff --git a/src/serena/tools/symbol_tools.py b/src/serena/tools/symbol_tools.py index 434f8afe..07d6ad8c 100644 --- a/src/serena/tools/symbol_tools.py +++ b/src/serena/tools/symbol_tools.py @@ -180,7 +180,6 @@ class FindReferencingSymbolsTool(Tool, ToolMarkerSymbolicRead): self, name_path: str, relative_path: str, - include_info: bool = False, include_kinds: list[int] = [], # noqa: B006 exclude_kinds: list[int] = [], # noqa: B006 max_answer_chars: int = -1, @@ -192,8 +191,6 @@ class FindReferencingSymbolsTool(Tool, ToolMarkerSymbolicRead): :param name_path: for finding the symbol to find references for, same logic as in the `find_symbol` tool. :param relative_path: the relative path to the file containing the symbol for which to find references. Note that here you can't pass a directory but must pass a file. - :param include_info: whether to include additional info (hover-like, typically including docstring and signature), - about the referencing symbols; can be slow depending on the language (e.g. C/C++). :param include_kinds: same as in the `find_symbol` tool. :param exclude_kinds: same as in the `find_symbol` tool. :param max_answer_chars: same as in the `find_symbol` tool. @@ -212,12 +209,6 @@ class FindReferencingSymbolsTool(Tool, ToolMarkerSymbolicRead): exclude_kinds=parsed_exclude_kinds, ) - # Batch-request hover info for referencing symbols (optional and potentially slow). - info_by_symbol = {} - if not include_body and include_info: - ref_symbols = [ref.symbol for ref in references_in_symbols] - info_by_symbol = symbol_retriever.request_info_for_symbol_batch(ref_symbols) - reference_dicts = [] for ref in references_in_symbols: ref_dict_orig = ref.symbol.to_dict(kind=True, relative_path=True, depth=0, body=include_body, body_location=True) @@ -225,8 +216,6 @@ class FindReferencingSymbolsTool(Tool, ToolMarkerSymbolicRead): if not include_body: ref_relative_path = ref.symbol.location.relative_path assert ref_relative_path is not None, f"Referencing symbol {ref.symbol.name} has no relative path, this is likely a bug." - if include_info and (referencing_symbol_info := info_by_symbol.get(ref.symbol)): - ref_dict["info"] = referencing_symbol_info content_around_ref = self.project.retrieve_content_around_line( relative_file_path=ref_relative_path, line=ref.line, context_lines_before=1, context_lines_after=1 )