Skip to main content
Glama

apply_group_in_a_box_layout

Organizes graph nodes into clustered box layouts to visualize grouped network data clearly and improve analytical insights.

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
NameRequiredDescriptionDefault
graph_idYes

Implementation Reference

  • The handler function decorated with @mcp.tool(), implementing the core logic: checks graph existence, applies g.group_in_a_box_layout(), updates cache, returns graph_id and plot 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)}
  • The @mcp.tool() decorator registers this function as the MCP tool named 'apply_group_in_a_box_layout', using the function name and type hints for schema.
    @mcp.tool()

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/graphistry/graphistry-mcp'

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