{"record":{"id":"2aaa51ab688d10ee","repo":"oraios/serena","slug":"tool-self-get-name-from-cls-is-not-active-a","errorCode":null,"errorMessage":"Tool '{self.get_name_from_cls()}' is not active. Active tools: {self.agent.get_active_tool_names()}","messagePattern":"Tool '(.+?)' is not active\\. Active tools: (.+?)","errorType":"exception","errorClass":"ToolCallError","httpStatus":null,"severity":"error","filePath":"src/serena/tools/tools_base.py","lineNumber":359,"sourceCode":"        if mcp_ctx is not None:\n            try:\n                session_id = \"%x\" % id(mcp_ctx.session)\n                client_params = mcp_ctx.session.client_params\n                if client_params is not None:\n                    client_info = cast(Implementation, client_params.clientInfo)\n                    client_str = client_info.title if client_info.title else client_info.name + \" \" + client_info.version\n                    if client_str != self.get_last_tool_call_client_str():\n                        log.debug(f\"Updating client info: {client_info}\")\n                        self.set_last_tool_call_client_str(client_str)\n            except Exception as e:\n                log.info(f\"Failed to get client info: {e}.\")\n\n        def task() -> str:\n            apply_fn = self.get_apply_fn()\n\n            try:\n                if not self.is_active():\n                    raise ToolCallError(\n                        f\"Tool '{self.get_name_from_cls()}' is not active. Active tools: {self.agent.get_active_tool_names()}\"\n                    )\n\n                if log_call:\n                    self._log_tool_application(inspect.currentframe(), session_id)\n\n                # check whether the tool requires an active project and language server\n                if not isinstance(self, ToolMarkerDoesNotRequireActiveProject):\n                    if self.agent.get_active_project() is None:\n                        raise ToolCallError(\n                            \"No active project. Ask the user to provide the project path or to select a project from this list of known projects: \"\n                            + f\"{self.agent.serena_config.project_names}\"\n                        )\n\n                # construct apply kwargs, adding session_id if the tool is session-aware\n                apply_kwargs = dict(kwargs)\n                if self._is_session_aware:\n                    apply_kwargs[\"session_id\"] = session_id","sourceCodeStart":341,"sourceCodeEnd":377,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/serena/tools/tools_base.py#L341-L377","documentation":"Every tool execution goes through task(), which checks self.is_active() before dispatching to apply. If the tool's name is not in the agent's active-tools set (disabled via config or the toggle_tool tool), the call is rejected with ToolCallError listing the currently active tools.","triggerScenarios":"Calling an apply/execute method of a tool excluded by the project's enabled_tools/disabled_tools config; a tool was deactivated at runtime via tool toggling; calling the wrong agent instance whose tool set doesn't include it.","commonSituations":"Project config restricts tools for safety; agents try memory or shell tools that are disabled by default; stale agent code references a tool renamed or disabled in a newer serena version.","solutions":["Enable the tool in the serena/project configuration (active_tools/enabled_tools)","Use the tool-management mechanism (e.g. activate_tool / config edit) to turn it on at runtime","Pick an alternative tool that is already active — the message lists active tool names"],"exampleFix":"// before\nresult = inactive_tool.apply(...)  # tool disabled in project config\n// ToolCallError: Tool 'x' is not active...\n\n// after (config, .serena/project.yml)\n# remove 'x' from excluded_tools / add to activated_tools, then\nresult = agent.get_tool(XTool).apply(...)","handlingStrategy":"try-catch","validationCode":"tool_cls = type(agent.get_tool(MyTool))\nname = tool_cls.get_name_from_cls()\nif name not in agent.get_active_tool_names():\n    raise SkipToolCall(f'{name} disabled; use an alternative')","typeGuard":"def tool_active(agent, tool_cls) -> bool:\n    return tool_cls.get_name_from_cls() in agent.get_active_tool_names()","tryCatchPattern":"try:\n    result = tool.apply(...)\nexcept ToolCallError as e:\n    if 'is not active' in str(e):\n        enable_tool_in_config(name)  # or pick alternative tool\n        result = tool.apply(...)\n    else:\n        raise","preventionTips":["Check the project's enabled/disabled tool lists before relying on a tool","Inspect agent.get_active_tool_names() at startup","Update agent prompts when the tool set changes"],"tags":["python","configuration","tool-availability","serena"],"backgroundTag":"tool-not-enabled","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}