Initial commit: Agentic OS troubleshooting platform
Self-hosted, Docker-based agentic troubleshooting platform: FastAPI backend + LangGraph agent, Next.js UI, tiered LLM routing (local Ollama -> Gemini -> DeepSeek -> OpenRouter), MCP server manager, encrypted device credentials, RBAC, audit log, project-memory + Obsidian integrations, and editable troubleshooting decision rules tuned for the GeneseasX vessel stack. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
25
backend/app/agent/mcp_helpers.py
Normal file
25
backend/app/agent/mcp_helpers.py
Normal file
@@ -0,0 +1,25 @@
|
||||
"""Shared helpers for interpreting MCP tool call results."""
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
def tool_result_ok(res: dict) -> bool:
|
||||
"""Return True when an MCP tool response indicates success."""
|
||||
if res.get("isError"):
|
||||
return False
|
||||
text = (res.get("text") or "").strip()
|
||||
if not text:
|
||||
return True
|
||||
lower = text.lower()
|
||||
if "unknown tool:" in lower:
|
||||
return False
|
||||
if text.startswith("Error executing tool"):
|
||||
return False
|
||||
if '"status": "error"' in text or '"status":"error"' in text:
|
||||
return False
|
||||
if " api error " in lower and any(code in text for code in ("401", "403", "500")):
|
||||
return False
|
||||
if "authentication failed" in lower:
|
||||
return False
|
||||
if "permission denied" in lower:
|
||||
return False
|
||||
return True
|
||||
Reference in New Issue
Block a user