96f21e8a54
Ports #63234 forward onto current main per teknium1's review. gateway/session.py hard-coded the stale-API disclaimer for every Slack session regardless of whether Slack tools were actually loaded. This contradicted the system prompt when MCP or native slack tools were present, causing the agent to refuse Slack API actions it could actually perform (issue #6536). Per review, the original predicate only checked the native 'slack' toolset, missing Slack MCP servers (registered under mcp-<server> in tools/mcp_tool.py) entirely. _slack_tools_loaded() now checks two independent paths: 1. Native 'slack' toolset + SLACK_BOT_TOKEN (as before, but now calls _get_platform_tools() with include_default_mcp_servers=True instead of False, so a default-enabled MCP server also counts). 2. A connected MCP server that has ACTUALLY registered tools into the live registry (new tools.mcp_tool.get_registered_mcp_server_names()), whose name suggests Slack. This is session-scoped in the sense that matters here: MCP servers connect once per gateway process (not per-session), so checking the live per-server tool-registration map is the correct availability-filtered signal -- unlike the earlier get_all_tool_names() approach this replaces, which conflated ALL built-in tool names process-wide, this only inspects the small, purpose-built MCP server-name map. Added a real regression test that registers a tool via the actual tools.mcp_tool._track_mcp_tool_server() tracking function (not a mock of the capability check) to verify a genuine Slack MCP server is detected, plus a negative case for an unrelated MCP server. 5/5 Slack-specific tests pass; 126/126 in the full tests/gateway/test_session.py file.