Skip to main content
Glama

apply_time_ring_layout

Arrange graph nodes in circular rings based on timestamp data to visualize temporal patterns and relationships over time.

Instructions

Apply a time ring layout to the graph using Graphistry's time_ring_layout API.

Args:
    graph_id (str): The ID of the graph to modify.
    time_col (str): The node column to use for determining ring position (should be a datetime or timestamp attribute, e.g., 'created_at').

Returns:
    dict: { 'graph_id': ..., 'url': ... } with the updated visualization URL.

Example:
    apply_time_ring_layout(graph_id, time_col='created_at')

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
graph_idYes
time_colYes

Implementation Reference

  • This is the main handler function for the 'apply_time_ring_layout' tool, decorated with @mcp.tool() which registers it in the MCP server. It applies a time ring layout to a graph using Graphistry's API, handling datetime coercion if necessary, and returns the updated graph ID and visualization URL.
    @mcp.tool()
    async def apply_time_ring_layout(graph_id: str, time_col: str) -> Dict[str, Any]:
        """
        Apply a time ring layout to the graph using Graphistry's time_ring_layout API.
    
        Args:
            graph_id (str): The ID of the graph to modify.
            time_col (str): The node column to use for determining ring position (should be a datetime or timestamp attribute, e.g., 'created_at').
    
        Returns:
            dict: { 'graph_id': ..., 'url': ... } with the updated visualization URL.
    
        Example:
            apply_time_ring_layout(graph_id, time_col='created_at')
        """
        if graph_id not in graph_cache:
            raise ValueError(f"Graph not found: {graph_id}")
        g = graph_cache[graph_id]["graph"]
        # Ensure the time_col is datetime64 for Graphistry
        nodes_df = graph_cache[graph_id].get("nodes_df")
        if nodes_df is not None and time_col in nodes_df.columns:
            if not pd.api.types.is_datetime64_any_dtype(nodes_df[time_col]):
                # Coerce to datetime64
                nodes_df[time_col] = pd.to_datetime(nodes_df[time_col], errors="coerce")
                # Update the graph's nodes table
                g = g.nodes(nodes_df)
        g = g.time_ring_layout(time_col)
        graph_cache[graph_id]["graph"] = g
        return {"graph_id": graph_id, "url": g.plot(render=False)}
  • The @mcp.tool() decorator registers the apply_time_ring_layout function as an MCP tool with that name.
    @mcp.tool()
  • The function signature and docstring define the input schema (graph_id: str, time_col: str) and output (Dict[str, Any] with graph_id and url).
    async def apply_time_ring_layout(graph_id: str, time_col: str) -> Dict[str, Any]:
        """
        Apply a time ring layout to the graph using Graphistry's time_ring_layout API.
    
        Args:
            graph_id (str): The ID of the graph to modify.
            time_col (str): The node column to use for determining ring position (should be a datetime or timestamp attribute, e.g., 'created_at').
    
        Returns:
            dict: { 'graph_id': ..., 'url': ... } with the updated visualization URL.
    
        Example:
            apply_time_ring_layout(graph_id, time_col='created_at')
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It implies a mutation ('apply...to modify') and specifies the return format, but lacks details on permissions, side effects, error conditions, or rate limits. The description adds some context (e.g., API reference and example) but is incomplete for behavioral transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with sections for Args, Returns, and Example, making it easy to scan. It's appropriately sized with no redundant information, though the example could be more concise by omitting the function name repetition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description provides basic purpose, parameters, and return format, but lacks details on usage context, error handling, or behavioral traits. It's minimally adequate for a 2-parameter tool but could be more complete, especially for a mutation tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It explains both parameters: 'graph_id' as 'The ID of the graph to modify' and 'time_col' as 'The node column to use for determining ring position' with an example ('created_at'), adding meaningful semantics beyond the schema's basic types.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('apply a time ring layout') and the target resource ('the graph'), specifying it uses Graphistry's API. It distinguishes from some siblings like 'apply_ring_categorical_layout' by mentioning 'time' and 'datetime/timestamp', but doesn't explicitly differentiate from all layout tools like 'apply_layout' or 'apply_tree_layout'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus alternatives is provided. The description mentions the tool's function but doesn't indicate scenarios where it's preferred over other layout tools (e.g., 'apply_ring_categorical_layout' or 'apply_tree_layout') or when it should not be used.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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