get_current_config
Retrieve the current agent configuration to view active projects, available tools, contexts, and operational modes.
Instructions
Print the current configuration of the agent, including the active and available projects, tools, contexts, and modes.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/serena/tools/config_tools.py:58-68 (handler)The GetCurrentConfigTool class defines the MCP tool 'get_current_config'. Its apply() method executes the tool logic by delegating to the agent's get_current_config_overview().class GetCurrentConfigTool(Tool): """ Prints the current configuration of the agent, including the active and available projects, tools, contexts, and modes. """ def apply(self) -> str: """ Print the current configuration of the agent, including the active and available projects, tools, contexts, and modes. """ return self.agent.get_current_config_overview()
- src/serena/agent.py:610-652 (helper)Core logic that generates a detailed string overview of the current Serena agent configuration, including version, log level, projects, context, modes, and active/available tools. Called by the tool handler.def get_current_config_overview(self) -> str: """ :return: a string overview of the current configuration, including the active and available configuration options """ result_str = "Current configuration:\n" result_str += f"Serena version: {serena_version()}\n" result_str += f"Loglevel: {self.serena_config.log_level}, trace_lsp_communication={self.serena_config.trace_lsp_communication}\n" if self._active_project is not None: result_str += f"Active project: {self._active_project.project_name}\n" else: result_str += "No active project\n" result_str += "Available projects:\n" + "\n".join(list(self.serena_config.project_names)) + "\n" result_str += f"Active context: {self._context.name}\n" # Active modes active_mode_names = [mode.name for mode in self.get_active_modes()] result_str += "Active modes: {}\n".format(", ".join(active_mode_names)) + "\n" # Available but not active modes all_available_modes = SerenaAgentMode.list_registered_mode_names() inactive_modes = [mode for mode in all_available_modes if mode not in active_mode_names] if inactive_modes: result_str += "Available but not active modes: {}\n".format(", ".join(inactive_modes)) + "\n" # Active tools result_str += "Active tools (after all exclusions from the project, context, and modes):\n" active_tool_names = self.get_active_tool_names() # print the tool names in chunks chunk_size = 4 for i in range(0, len(active_tool_names), chunk_size): chunk = active_tool_names[i : i + chunk_size] result_str += " " + ", ".join(chunk) + "\n" # Available but not active tools all_tool_names = sorted([tool.get_name_from_cls() for tool in self._all_tools.values()]) inactive_tool_names = [tool for tool in all_tool_names if tool not in active_tool_names] if inactive_tool_names: result_str += "Available but not active tools:\n" for i in range(0, len(inactive_tool_names), chunk_size): chunk = inactive_tool_names[i : i + chunk_size] result_str += " " + ", ".join(chunk) + "\n" return result_str
- src/serena/tools/tools_base.py:372-373 (registration)ToolRegistry automatically discovers all Tool subclasses in serena.tools package (including GetCurrentConfigTool) via iter_subclasses(Tool) and registers them for instantiation in SerenaAgent.return list(t.tool_class for t in self._tool_dict.values())
- src/serena/agent.py:227-227 (registration)SerenaAgent instantiates all registered tools, including GetCurrentConfigTool, using ToolRegistry.get_all_tool_classes() during agent initialization.self._all_tools: dict[type[Tool], Tool] = {tool_class: tool_class(self) for tool_class in ToolRegistry().get_all_tool_classes()}