MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / _load_entry

Method _load_entry

graphify/serve.py:155–175  ·  view source on GitHub ↗

Build one entry for an already-resolved path and known file key. ``_load_graph`` is also used by the CLI, where invalid input terminates the process. A client-supplied ``project_path`` must instead become a tool error, so the shared MCP server can continue serving other grap

(self, resolved_path: str, key: tuple[int, int])

Source from the content-addressed store, hash-verified

153 self._loading: dict[tuple[str, bool], threading.Event] = {}
154
155 def _load_entry(self, resolved_path: str, key: tuple[int, int]) -> dict:
156 """Build one entry for an already-resolved path and known file key.
157
158 ``_load_graph`` is also used by the CLI, where invalid input terminates
159 the process. A client-supplied ``project_path`` must instead become a
160 tool error, so the shared MCP server can continue serving other graphs.
161 """
162 try:
163 graph = _load_graph(resolved_path)
164 except SystemExit as exc:
165 raise RuntimeError(f"could not load graph.json at {resolved_path}") from exc
166 # Warm the index before exposing the graph so its first query does not
167 # pay the expensive build cost.
168 _get_trigram_index(graph)
169 communities = _communities_from_graph(graph)
170 entry = {
171 "key": key,
172 "G": graph,
173 "communities": communities,
174 }
175 return entry
176
177 def load(self, resolved_path: str, *, pinned: bool = False) -> tuple[nx.Graph, dict[int, list[str]]]:
178 """Return a fresh context, retaining project contexts by LRU order.

Callers 1

loadMethod · 0.95

Calls 3

_get_trigram_indexFunction · 0.85
_communities_from_graphFunction · 0.85
_load_graphFunction · 0.70

Tested by

no test coverage detected