Skip to content

Graph-Native Infrastructure for Context and Accountable AI Systems

fix(mcp): read the analytics tool's edge count from stats()

hiro-nikaitou7a665a504e54
diff --git a/semantica/mcp_server/__init__.py b/semantica/mcp_server/__init__.py
index bf539386..d151b9fe 100644
--- a/semantica/mcp_server/__init__.py
+++ b/semantica/mcp_server/__init__.py
@@ -419,6 +419,8 @@ def _tool_get_graph_analytics(args: dict) -> dict:
communities = CommunityDetector().detect_communities(graph)
node_count = len(list(graph.find_nodes()))
edge_count = getattr(graph, "edge_count", lambda: 0)()
+ if not hasattr(graph, "edge_count") and hasattr(graph, "stats"):
+ edge_count = graph.stats().get("edge_count", 0)
return {
"node_count": node_count,
"edge_count": edge_count,