prepare_for_new_conversation
Initiate a fresh conversation by resetting context and preparing for new interactions. Use this tool to start a clean dialogue with Serena, ensuring clarity and focus in coding discussions.
Instructions
Instructions for preparing for a new conversation. This tool should only be called on explicit user request.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The handler implementation: PrepareForNewConversationTool.apply() returns a generated prompt via the prompt factory for preparing context for a new conversation.class PrepareForNewConversationTool(Tool): """ Provides instructions for preparing for a new conversation (in order to continue with the necessary context). """ def apply(self) -> str: """ Instructions for preparing for a new conversation. This tool should only be called on explicit user request. """ return self.prompt_factory.create_prepare_for_new_conversation()
- Helper method in the generated prompt factory that renders the 'prepare_for_new_conversation' prompt template.def create_prepare_for_new_conversation(self) -> str: return self._render_prompt("prepare_for_new_conversation", locals())
- src/serena/tools/tools_base.py:362-370 (registration)ToolRegistry discovers and registers all Tool subclasses from serena.tools modules, mapping PrepareForNewConversationTool to 'prepare_for_new_conversation'.for cls in iter_subclasses(Tool): if not cls.__module__.startswith("serena.tools"): continue is_optional = issubclass(cls, ToolMarkerOptional) name = cls.get_name_from_cls() if name in self._tool_dict: raise ValueError(f"Duplicate tool name found: {name}. Tool classes must have unique names.") self._tool_dict[name] = RegisteredTool(tool_class=cls, is_optional=is_optional, tool_name=name)
- src/serena/agent.py:214-214 (registration)SerenaAgent instantiates all registered tools, including PrepareForNewConversationTool, during initialization.self._all_tools: dict[type[Tool], Tool] = {tool_class: tool_class(self) for tool_class in ToolRegistry().get_all_tool_classes()}
- src/serena/tools/__init__.py:8-8 (registration)Import of workflow_tools ensures PrepareForNewConversationTool is discoverable by ToolRegistry subclass scan.from .workflow_tools import *