File indexing completed on 2026-04-27 07:41:42
0001 """
0002 MCP Tools for ePIC Streaming Workflow Testbed Monitor and PanDA Monitor.
0003
0004 This package provides LLM-based natural language interaction with the testbed
0005 and the PanDA production system, allowing users to query system state, agents,
0006 workflows, runs, STF files, TF slices, messages, PanDA jobs, error diagnostics,
0007 and manage AI dialogue memory.
0008
0009 ARCHITECTURE PRINCIPLE:
0010 - Monitor consumes ALL workflow messages from ActiveMQ
0011 - MCP provides access to everything monitor captures
0012 - Use MCP tools for diagnostics, NOT log files
0013 - PanDA MCP tools query the doma_panda schema directly for ePIC production monitoring
0014
0015 Module structure:
0016 - common.py: Shared utilities and tool discovery list
0017 - system.py: System state, agents, namespaces, logs, testbed management
0018 - workflows.py: Workflow definitions, executions, messages, runs, files, slices
0019 - ai_memory.py: AI dialogue recording and retrieval for session context
0020 - pandamon.py: PanDA job monitoring and error diagnostics for ePIC production
0021 - pcs.py: PCS (Physics Configuration System) tag browsing and lookup
0022 """
0023
0024 from mcp_server import mcp_server as mcp
0025
0026
0027 from .common import (
0028 _parse_time,
0029 _default_start_time,
0030 _monitor_url,
0031 _get_testbed_config_path,
0032 get_available_tools_list,
0033 )
0034
0035
0036
0037 from .system import (
0038 swf_get_system_state,
0039 swf_list_agents,
0040 swf_get_agent,
0041 swf_list_namespaces,
0042 swf_get_namespace,
0043 swf_list_logs,
0044 swf_get_log_entry,
0045 swf_kill_agent,
0046 swf_check_agent_manager,
0047 swf_start_user_testbed,
0048 swf_stop_user_testbed,
0049 swf_get_testbed_status,
0050 )
0051
0052
0053 from .workflows import (
0054 swf_list_workflow_definitions,
0055 swf_list_workflow_executions,
0056 swf_get_workflow_execution,
0057 swf_list_messages,
0058 swf_list_runs,
0059 swf_get_run,
0060 swf_list_stf_files,
0061 swf_get_stf_file,
0062 swf_list_tf_slices,
0063 swf_get_tf_slice,
0064 swf_start_workflow,
0065 swf_stop_workflow,
0066 swf_end_execution,
0067 swf_get_workflow_monitor,
0068 swf_list_workflow_monitors,
0069 swf_send_message,
0070 )
0071
0072
0073 from .ai_memory import (
0074 swf_record_ai_memory,
0075 swf_get_ai_memory,
0076 )
0077
0078
0079 from .pandamon import (
0080 panda_list_jobs,
0081 panda_diagnose_jobs,
0082 panda_list_tasks,
0083 panda_error_summary,
0084 panda_get_activity,
0085 panda_study_job,
0086 )
0087
0088
0089 from .pcs import (
0090 pcs_list_tags,
0091 pcs_get_tag,
0092 pcs_search_tags,
0093 )
0094
0095
0096
0097 @mcp.tool()
0098 async def swf_list_available_tools() -> list:
0099 """
0100 List all available MCP tools with descriptions.
0101
0102 Use this tool to discover what tools are available and what they do.
0103 Returns a summary of each tool to help you choose the right one.
0104
0105 Returns list of tools with: name, description, parameters
0106 """
0107 return get_available_tools_list()
0108
0109
0110
0111 __all__ = [
0112
0113 'swf_list_available_tools',
0114
0115 'swf_get_system_state',
0116 'swf_list_agents',
0117 'swf_get_agent',
0118 'swf_list_namespaces',
0119 'swf_get_namespace',
0120 'swf_list_logs',
0121 'swf_get_log_entry',
0122 'swf_kill_agent',
0123 'swf_check_agent_manager',
0124 'swf_start_user_testbed',
0125 'swf_stop_user_testbed',
0126 'swf_get_testbed_status',
0127
0128 'swf_list_workflow_definitions',
0129 'swf_list_workflow_executions',
0130 'swf_get_workflow_execution',
0131 'swf_list_messages',
0132 'swf_list_runs',
0133 'swf_get_run',
0134 'swf_list_stf_files',
0135 'swf_get_stf_file',
0136 'swf_list_tf_slices',
0137 'swf_get_tf_slice',
0138 'swf_start_workflow',
0139 'swf_stop_workflow',
0140 'swf_end_execution',
0141 'swf_get_workflow_monitor',
0142 'swf_list_workflow_monitors',
0143 'swf_send_message',
0144
0145 'swf_record_ai_memory',
0146 'swf_get_ai_memory',
0147
0148 'panda_list_jobs',
0149 'panda_diagnose_jobs',
0150 'panda_list_tasks',
0151 'panda_error_summary',
0152 'panda_get_activity',
0153 'panda_study_job',
0154
0155 'pcs_list_tags',
0156 'pcs_get_tag',
0157 'pcs_search_tags',
0158 ]