initial_instructions
Access essential instructions for using the Serena toolbox to understand its capabilities and proper operation.
Instructions
Provides the 'Serena Instructions Manual', which contains essential information on how to use the Serena toolbox. IMPORTANT: If you have not yet read the manual, call this tool immediately after you are given your task by the user, as it will critically inform you!.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The core handler for the 'initial_instructions' tool. The apply() method executes the tool logic by calling self.agent.create_system_prompt(), providing the initial instructions manual.class InitialInstructionsTool(Tool, ToolMarkerDoesNotRequireActiveProject): """ Provides instructions on how to use the Serena toolbox. Should only be used in settings where the system prompt is not read automatically by the client. NOTE: Some MCP clients (including Claude Desktop) do not read the system prompt automatically! """ def apply(self) -> str: """ Provides the 'Serena Instructions Manual', which contains essential information on how to use the Serena toolbox. IMPORTANT: If you have not yet read the manual, call this tool immediately after you are given your task by the user, as it will critically inform you! """ return self.agent.create_system_prompt()
- src/serena/tools/tools_base.py:359-367 (registration)ToolRegistry discovers and registers all Tool subclasses from serena.tools packages, including InitialInstructionsTool as 'initial_instructions' (derived from class name). This is where the tool gets registered in the agent's tool set.for cls in iter_subclasses(Tool): if not any(cls.__module__.startswith(pkg) for pkg in tool_packages): 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)
- The get_name_from_cls method derives the MCP tool name 'initial_instructions' from the class name InitialInstructionsTool.def get_name_from_cls(cls) -> str: name = cls.__name__ if name.endswith("Tool"): name = name[:-4] # convert to snake_case name = "".join(["_" + c.lower() if c.isupper() else c for c in name]).lstrip("_") return name def get_name(self) -> str: return self.get_name_from_cls()