Skip to main content
Glama

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
NameRequiredDescriptionDefault
categoryNoFilter by category

Implementation Reference

  • 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,
                ),
            )
        ]
  • 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"}},
        },
    ),
  • 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()]

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/For-Sunny/hebbian-mind-enterprise'

If you have feedback or need assistance with the MCP directory API, please join our Discord server