Files
Agentic-OS/backend/app/agent/mcp_helpers.py
nearxos 6185b9b85a 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>
2026-06-14 22:11:07 +03:00

26 lines
811 B
Python

"""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