"""The host_agent plugin's MCP tools.""" from datetime import datetime, timedelta, timezone from types import SimpleNamespace as NS from unittest.mock import MagicMock import plugins.host_agent as agent_plugin from plugins.host_agent.mcp_tools import agent_state NOW = datetime(2026, 10, 6, 12, 0, tzinfo=timezone.utc) def test_agent_state(): assert agent_state(NS(last_seen_at=None), NOW, 180) == "pending" assert agent_state(NS(last_seen_at=NOW - timedelta(seconds=60)), NOW, 180) == "reporting" assert agent_state(NS(last_seen_at=NOW - timedelta(minutes=10)), NOW, 180) == "stale" def test_plugin_exposes_the_mcp_hooks(): reg = MagicMock() agent_plugin.register_mcp_tools(reg) assert [c.args[0].__name__ for c in reg.call_args_list] == ["list_agents"] assert callable(agent_plugin.mcp_overview)