Commit ·
8886ce5
1
Parent(s): d4e911d
missing endpoints added in main
Browse files- server/main.py +74 -0
server/main.py
CHANGED
|
@@ -49,6 +49,80 @@ async def root():
|
|
| 49 |
return {"status": "healthy", "environment": "cicd-debug-env"}
|
| 50 |
|
| 51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
@app.post("/reset", response_model=ResetResponse)
|
| 53 |
async def reset(request: Optional[ResetRequest] = None):
|
| 54 |
global env
|
|
|
|
| 49 |
return {"status": "healthy", "environment": "cicd-debug-env"}
|
| 50 |
|
| 51 |
|
| 52 |
+
@app.get("/health")
|
| 53 |
+
async def health():
|
| 54 |
+
return {"status": "healthy"}
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
@app.get("/metadata")
|
| 58 |
+
async def metadata():
|
| 59 |
+
return {
|
| 60 |
+
"name": "cicd-debug-env",
|
| 61 |
+
"description": "Debug broken GitHub Actions workflows and Dockerfiles. AI agents identify and fix CI/CD infrastructure issues.",
|
| 62 |
+
"version": "1.0.0",
|
| 63 |
+
"author": "Krishna",
|
| 64 |
+
"tags": ["devops", "docker", "github-actions", "debugging", "infrastructure"],
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
@app.get("/schema")
|
| 69 |
+
async def schema():
|
| 70 |
+
return {
|
| 71 |
+
"action": Action.model_json_schema(),
|
| 72 |
+
"observation": Observation.model_json_schema(),
|
| 73 |
+
"state": StateResponse.model_json_schema(),
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
@app.post("/mcp")
|
| 78 |
+
async def mcp(request: dict = None):
|
| 79 |
+
"""JSON-RPC 2.0 MCP endpoint."""
|
| 80 |
+
request = request or {}
|
| 81 |
+
method = request.get("method", "")
|
| 82 |
+
req_id = request.get("id", 1)
|
| 83 |
+
|
| 84 |
+
if method == "initialize":
|
| 85 |
+
return {
|
| 86 |
+
"jsonrpc": "2.0",
|
| 87 |
+
"id": req_id,
|
| 88 |
+
"result": {
|
| 89 |
+
"protocolVersion": "2024-11-05",
|
| 90 |
+
"capabilities": {"tools": {}},
|
| 91 |
+
"serverInfo": {"name": "cicd-debug-env", "version": "1.0.0"},
|
| 92 |
+
},
|
| 93 |
+
}
|
| 94 |
+
elif method == "tools/list":
|
| 95 |
+
return {
|
| 96 |
+
"jsonrpc": "2.0",
|
| 97 |
+
"id": req_id,
|
| 98 |
+
"result": {
|
| 99 |
+
"tools": [
|
| 100 |
+
{
|
| 101 |
+
"name": "reset",
|
| 102 |
+
"description": "Reset the environment and start a new episode",
|
| 103 |
+
"inputSchema": ResetRequest.model_json_schema(),
|
| 104 |
+
},
|
| 105 |
+
{
|
| 106 |
+
"name": "step",
|
| 107 |
+
"description": "Take an action in the environment",
|
| 108 |
+
"inputSchema": Action.model_json_schema(),
|
| 109 |
+
},
|
| 110 |
+
{
|
| 111 |
+
"name": "get_state",
|
| 112 |
+
"description": "Get the current environment state",
|
| 113 |
+
"inputSchema": {"type": "object", "properties": {}},
|
| 114 |
+
},
|
| 115 |
+
]
|
| 116 |
+
},
|
| 117 |
+
}
|
| 118 |
+
else:
|
| 119 |
+
return {
|
| 120 |
+
"jsonrpc": "2.0",
|
| 121 |
+
"id": req_id,
|
| 122 |
+
"error": {"code": -32601, "message": f"Method not found: {method}"},
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
|
| 126 |
@app.post("/reset", response_model=ResetResponse)
|
| 127 |
async def reset(request: Optional[ResetRequest] = None):
|
| 128 |
global env
|