-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmcp.py
More file actions
58 lines (47 loc) · 1.65 KB
/
mcp.py
File metadata and controls
58 lines (47 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
"""
MCP registration for CLI module.
Provides tools for pipeline execution and health checking via MCP.
"""
import logging
from typing import Any, Dict
logger = logging.getLogger(__name__)
def cli_health_check(params: Dict[str, Any] = None) -> Dict[str, Any]:
"""Return CLI module health and available subcommands."""
subcommands = [
"run", "validate", "parse", "render", "report",
"reproduce", "preflight", "health", "serve", "lsp",
]
return {
"success": True,
"module": "cli",
"subcommands": subcommands,
"subcommand_count": len(subcommands),
}
def cli_preflight(params: Dict[str, Any] = None) -> Dict[str, Any]:
"""Run preflight checks for the pipeline environment."""
try:
# Return info without running the full check
return {
"success": True,
"preflight_available": True,
"message": "Use 'gnn preflight' to run full environment checks",
}
except Exception as e:
return {"success": False, "error": str(e)}
def register_tools(mcp_instance: Any) -> None:
"""Register CLI tools with the MCP instance."""
mcp_instance.register_tool(
"cli.health",
cli_health_check,
{"type": "object", "properties": {}},
"Return CLI module health and list of available subcommands",
module="cli", category="cli",
)
mcp_instance.register_tool(
"cli.preflight",
cli_preflight,
{"type": "object", "properties": {}},
"Check pipeline environment readiness",
module="cli", category="cli",
)
logger.info("cli module MCP tools registered (2 tools).")