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

Function _tool_get_node

graphify/serve.py:1014–1029  ·  view source on GitHub ↗
(arguments: dict)

Source from the content-addressed store, hash-verified

1012 return result
1013
1014 def _tool_get_node(arguments: dict) -> str:
1015 label = arguments["label"].lower()
1016 matches = [(nid, d) for nid, d in G.nodes(data=True)
1017 if label in (d.get("label") or "").lower() or label == nid.lower()]
1018 if not matches:
1019 return f"No node matching '{label}' found."
1020 nid, d = matches[0]
1021 # Sanitise every LLM-derived field before concatenation (F-010).
1022 return "\n".join([
1023 f"Node: {sanitize_label(d.get('label', nid))}",
1024 f" ID: {sanitize_label(nid)}",
1025 f" Source: {sanitize_label(str(d.get('source_file', '')))} {sanitize_label(str(d.get('source_location', '')))}",
1026 f" Type: {sanitize_label(str(d.get('file_type', '')))}",
1027 f" Community: {sanitize_label(str(d.get('community_name') or d.get('community', '')))}",
1028 f" Degree: {G.degree(nid)}",
1029 ])
1030
1031 def _tool_get_neighbors(arguments: dict) -> str:
1032 label = arguments["label"].lower()

Callers

nothing calls this directly

Calls 2

sanitize_labelFunction · 0.90
getMethod · 0.45

Tested by

no test coverage detected