Skip to main content
Glama

encode_point_size

Set node size encoding in Graphistry visualizations to represent data values like scores or categories through visual scaling for clearer graph analysis.

Instructions

Set node size encoding for a graph using Graphistry's encode_point_size API.

Args:
    graph_id (str): The ID of the graph to modify.
    column (str): The node column to use for size encoding (e.g., 'score', 'type').
    categorical_mapping (dict, optional): Map of category values to sizes. Example: {'mac': 50, 'macbook': 100}. If not provided, Graphistry will auto-assign sizes.
    default_mapping (float, optional): Size to use for values not in categorical_mapping. Example: 20.
    as_continuous (bool, optional): If True, treat the column as continuous and use a size gradient. Example: True for numeric columns like 'score'.

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

Example:
    encode_point_size(graph_id, column='score', as_continuous=True)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
graph_idYes
columnYes
categorical_mappingNo
default_mappingNo

Implementation Reference

  • The main handler function for the 'encode_point_size' tool. It is registered as an MCP tool via @mcp.tool() decorator. The function retrieves the graph from cache, applies node size encoding using Graphistry's encode_point_size method based on the specified column and mappings, updates the cache, and returns the updated graph URL.
    @mcp.tool()
    async def encode_point_size(
        graph_id: str,
        column: str,
        categorical_mapping: Optional[dict] = None,
        default_mapping: Optional[float] = None,
    ) -> Dict[str, Any]:
        """
        Set node size encoding for a graph using Graphistry's encode_point_size API.
    
        Args:
            graph_id (str): The ID of the graph to modify.
            column (str): The node column to use for size encoding (e.g., 'score', 'type').
            categorical_mapping (dict, optional): Map of category values to sizes. Example: {'mac': 50, 'macbook': 100}. If not provided, Graphistry will auto-assign sizes.
            default_mapping (float, optional): Size to use for values not in categorical_mapping. Example: 20.
            as_continuous (bool, optional): If True, treat the column as continuous and use a size gradient. Example: True for numeric columns like 'score'.
    
        Returns:
            dict: { 'graph_id': ..., 'url': ... } with the updated visualization URL.
    
        Example:
            encode_point_size(graph_id, column='score', as_continuous=True)
        """
        if graph_id not in graph_cache:
            raise ValueError(f"Graph not found: {graph_id}")
        g = graph_cache[graph_id]["graph"]
        kwargs = {"column": column}
        if categorical_mapping:
            kwargs["categorical_mapping"] = categorical_mapping
        if default_mapping is not None:
            kwargs["default_mapping"] = default_mapping
        g = g.encode_point_size(**kwargs)
        graph_cache[graph_id]["graph"] = g
        return {"graph_id": graph_id, "url": g.plot(render=False)}
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 of behavioral disclosure. It describes the action ('Set node size encoding') and mentions the API, but lacks details on permissions, rate limits, side effects, or error handling. It does specify the return format ('dict: { 'graph_id': ..., 'url': ... }'), which adds some behavioral context beyond the basic action.

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 clear sections (purpose, args, returns, example) and uses bullet points effectively. It's appropriately sized for a 4-parameter tool. Some minor verbosity exists (e.g., repeating 'Example:' in the example section), but overall it's efficient and front-loaded with the core purpose.

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 4 parameters with 0% schema coverage and no annotations, the description does a decent job explaining parameters and returns. However, it lacks context about when to use this tool versus siblings, doesn't mention authentication or rate limits, and provides minimal error handling information. For a mutation tool (implied by 'Set'), more behavioral context would be beneficial.

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 provides clear semantics for all 4 parameters: 'graph_id' as 'The ID of the graph to modify', 'column' as 'The node column to use for size encoding', 'categorical_mapping' with examples and auto-assign behavior, 'default_mapping' with examples, and 'as_continuous' with usage context. The description adds meaningful context beyond the bare schema titles.

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 tool's purpose: 'Set node size encoding for a graph using Graphistry's encode_point_size API.' It specifies the verb ('Set'), resource ('node size encoding for a graph'), and technology context ('Graphistry's encode_point_size API'). However, it doesn't explicitly differentiate from sibling tools like 'encode_point_color' or 'encode_point_icon' beyond the 'size' aspect.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'encode_point_color' or 'encode_point_icon' for other encoding types, nor does it explain when size encoding is appropriate compared to other visual properties. The example shows usage but lacks contextual decision-making advice.

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