apply_ring_categorical_layout
Apply a categorical ring layout to visualize graph nodes grouped by attributes like 'type' or 'group', updating the graph visualization for clearer network pattern analysis.
Instructions
Apply a categorical ring layout to the graph using Graphistry's ring_categorical_layout API.
Args:
graph_id (str): The ID of the graph to modify.
ring_col (str): The node column to use for determining ring membership (e.g., a categorical attribute like 'type' or 'group').
Returns:
dict: { 'graph_id': ..., 'url': ... } with the updated visualization URL.
Example:
apply_ring_categorical_layout(graph_id, ring_col='type')
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| graph_id | Yes | ||
| ring_col | Yes |
Implementation Reference
- The handler function decorated with @mcp.tool(), implementing the apply_ring_categorical_layout tool by applying Graphistry's ring_categorical_layout to the cached graph object based on the specified categorical column.@mcp.tool() async def apply_ring_categorical_layout(graph_id: str, ring_col: str) -> Dict[str, Any]: """ Apply a categorical ring layout to the graph using Graphistry's ring_categorical_layout API. Args: graph_id (str): The ID of the graph to modify. ring_col (str): The node column to use for determining ring membership (e.g., a categorical attribute like 'type' or 'group'). Returns: dict: { 'graph_id': ..., 'url': ... } with the updated visualization URL. Example: apply_ring_categorical_layout(graph_id, ring_col='type') """ if graph_id not in graph_cache: raise ValueError(f"Graph not found: {graph_id}") g = graph_cache[graph_id]["graph"] g = g.ring_categorical_layout(ring_col) graph_cache[graph_id]["graph"] = g return {"graph_id": graph_id, "url": g.plot(render=False)}
- src/graphistry_mcp_server/server.py:492-492 (registration)The @mcp.tool() decorator registers the apply_ring_categorical_layout function as an MCP tool.@mcp.tool()