list_nodes
Retrieve concept nodes from the Hebbian learning memory system, with optional filtering by category to organize associative knowledge.
Instructions
List all concept nodes, optionally filtered by category.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category | No | Filter by category |
Implementation Reference
- src/hebbian_mind/server.py:1419-1447 (handler)Handler logic for the "list_nodes" tool, implemented within the call_tool function in src/hebbian_mind/server.py. It calls db.get_all_nodes() and optionally filters by category.
elif name == "list_nodes": category = arguments.get("category") nodes = db.get_all_nodes() if category: nodes = [n for n in nodes if n["category"] == category] by_category: Dict[str, List[Dict[str, Any]]] = {} for node in nodes: cat = node["category"] if cat not in by_category: by_category[cat] = [] by_category[cat].append( { "node_id": node["node_id"], "name": node["name"], "activation_count": node["activation_count"], } ) return [ types.TextContent( type="text", text=json.dumps( {"success": True, "total_nodes": len(nodes), "categories": by_category}, indent=2, ), ) ] - src/hebbian_mind/server.py:1090-1096 (registration)Registration of the "list_nodes" tool in the list_tools function in src/hebbian_mind/server.py.
name="list_nodes", description="List all concept nodes, optionally filtered by category.", inputSchema={ "type": "object", "properties": {"category": {"type": "string", "description": "Filter by category"}}, }, ), - src/hebbian_mind/server.py:480-490 (helper)Helper method in HebbianMindDatabase class that retrieves all nodes from the database.
def get_all_nodes(self, limit: int = 10000) -> List[Dict]: """Get all concept nodes with safety limit. Args: limit: Maximum number of nodes to return (default 10000). Prevents unbounded memory consumption on large graphs. """ cursor = self.read_conn.cursor() cursor.execute("SELECT * FROM nodes ORDER BY category, name LIMIT ?", (limit,)) return [dict(row) for row in cursor.fetchall()]