fix recon mcp
This commit is contained in:
@@ -67,6 +67,7 @@ class GraylogMcpClient:
|
||||
return f"Basic {credentials}"
|
||||
|
||||
def probe(self) -> dict[str, object]:
|
||||
self.session_id = None
|
||||
initialized = self._call(
|
||||
"initialize",
|
||||
{"protocolVersion": "2025-06-18", "capabilities": {}, "clientInfo": {"name": "fgAI", "version": "0.1"}},
|
||||
@@ -84,4 +85,14 @@ class GraylogMcpClient:
|
||||
return {"status": "connected", "tools": names, "tool_schemas": schemas, "server_version": version}
|
||||
|
||||
def call_tool(self, name: str, arguments: dict[str, object]) -> dict[str, object]:
|
||||
return self._call("tools/call", {"name": name, "arguments": arguments})
|
||||
try:
|
||||
return self._call("tools/call", {"name": name, "arguments": arguments})
|
||||
except RuntimeError as exc:
|
||||
if not self._should_reconnect(str(exc)):
|
||||
raise
|
||||
self.probe()
|
||||
return self._call("tools/call", {"name": name, "arguments": arguments})
|
||||
|
||||
@staticmethod
|
||||
def _should_reconnect(error_text: str) -> bool:
|
||||
return any(token in error_text for token in ("http_400", "http_404", "http_409", "connection_error"))
|
||||
|
||||
@@ -310,6 +310,7 @@ def build_status(
|
||||
summary["aggregate_backed"] = True
|
||||
status = {
|
||||
"status_schema": 2,
|
||||
"stale": False,
|
||||
"generated_at": int(time.time()),
|
||||
"log_path": log_path,
|
||||
"policy_path": policy_path,
|
||||
@@ -341,6 +342,7 @@ def build_status(
|
||||
"cross_source_correlations": correlations,
|
||||
"incidents": incidents,
|
||||
"data_quality": assess_data_quality(events, mcp_status),
|
||||
"status_cache": {"served_from_cache": False, "reason": ""},
|
||||
"anomalies": [
|
||||
{
|
||||
"subject": finding.subject,
|
||||
|
||||
Reference in New Issue
Block a user