apply_group_in_a_box_layout
Organize complex graph data into clustered layouts for clear visualization using Graphistry's group-in-a-box API. Input a graph ID to generate an updated visual representation.
Instructions
Apply group-in-a-box layout to the graph using Graphistry's group_in_a_box_layout API.
Args:
graph_id (str): The ID of the graph to modify.
Returns:
dict: { 'graph_id': ..., 'url': ... } with the updated visualization URL.
Example:
apply_group_in_a_box_layout(graph_id)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| graph_id | Yes |
Implementation Reference
- The @mcp.tool() decorated handler function that executes the tool logic: checks if graph exists, applies group_in_a_box_layout using Graphistry, updates cache, and returns graph_id and visualization URL.@mcp.tool() async def apply_group_in_a_box_layout(graph_id: str) -> Dict[str, Any]: """ Apply group-in-a-box layout to the graph using Graphistry's group_in_a_box_layout API. Args: graph_id (str): The ID of the graph to modify. Returns: dict: { 'graph_id': ..., 'url': ... } with the updated visualization URL. Example: apply_group_in_a_box_layout(graph_id) """ if graph_id not in graph_cache: raise ValueError(f"Graph not found: {graph_id}") g = graph_cache[graph_id]["graph"] g = g.group_in_a_box_layout() graph_cache[graph_id]["graph"] = g return {"graph_id": graph_id, "url": g.plot(render=False)}
- src/graphistry_mcp_server/server.py:514-514 (registration)The @mcp.tool() decorator registers the apply_group_in_a_box_layout function as an MCP tool.@mcp.tool()