"""MCP tool registration smoke tests for extended modules."""

import asyncio

import pytest


def test_extended_mcp_tools_registered():
    try:
        from agomtradepro_mcp.server import server
    except ModuleNotFoundError as exc:
        if "mcp" in str(exc):
            pytest.skip("mcp package not installed in current test environment")
        raise

    tools = asyncio.run(server.list_tools())
    names = {t.name for t in tools}

    expected = {
        "list_accounts",
        "get_account",
        "create_account",
        "get_account_positions",
        "get_account_performance",
        "preview_broker_trades_csv",
        "import_broker_trades_csv",
        "preview_broker_trades_json",
        "import_broker_trades_json",
        "delete_simulated_account",
        "batch_delete_simulated_accounts",
        "run_decision_replay_backtest",
        "run_simulated_auto_trading",
        "list_ai_strategy_configs",
        "get_strategy_ai_config",
        "create_ai_strategy_config",
        "update_ai_strategy_config",
        "update_position_rule",
        "list_ai_providers",
        "list_prompt_templates",
        "get_audit_summary",
        "list_audit_execution_links",
        "publish_event",
        "submit_decision_request",
        "decision_workflow_precheck",
        "decision_workflow_list_recommendations",
        "decision_workflow_refresh_recommendations",
        "decision_workflow_apply_recommendation_action",
        "decision_workflow_generate_transition_plan",
        "decision_workflow_get_transition_plan",
        "decision_workflow_update_transition_plan",
        "decision_workflow_preview_execution",
        "decision_workflow_get_funnel_context",
        "list_beta_gate_configs",
        "list_alpha_triggers",
        "get_dashboard_summary_v1",
        "get_dashboard_alpha_decision_chain_v1",
        "get_dashboard_alpha_candidates",
        "get_dashboard_alpha_history",
        "get_dashboard_alpha_history_detail",
        "trigger_dashboard_alpha_refresh",
        "asset_multidim_screen",
        "analyze_sentiment",
        "get_task_monitor_statistics",
        "list_filters",
        "list_rotation_regimes",
        "get_account_rotation_config",
        "apply_rotation_template_to_account_config",
        "get_alpha_stock_scores",
        "upload_alpha_scores",
        "get_alpha_ops_inference_overview",
        "trigger_alpha_ops_inference",
        "get_alpha_ops_qlib_data_overview",
        "refresh_alpha_qlib_data",
        "get_pulse_current",
        "get_pulse_history",
        "get_regime_navigator",
        "get_action_recommendation",
        "explain_pulse_dimensions",
        "list_data_center_providers",
        "test_data_center_provider_connection",
        "get_data_center_provider_status",
        "data_center_get_quotes",
        "data_center_get_capital_flows",
        "rank_funds",
        "screen_funds",
        "get_fund_detail",
        "get_fund_nav_history",
        "analyze_fund",
        "get_fund_holdings",
        "get_fund_performance",
        "get_fund_recommendations",
    }

    missing = expected - names
    assert not missing, f"Missing MCP tools: {sorted(missing)}"
