Skip to main content
Glama

encode_point_icon

Set custom icons for graph nodes based on column values to visually distinguish categories or continuous data ranges in Graphistry visualizations.

Instructions

Set node icon encoding for a graph using Graphistry's encode_point_icon API.

Args:
    graph_id (str): The ID of the graph to modify.
    column (str): The node column to use for icon encoding (e.g., 'type', 'origin').
    categorical_mapping (dict, optional): Map of category values to icon names or URLs. Example: {'macbook': 'laptop', 'Canada': 'flag-icon-ca'}. See FontAwesome 4 or ISO country codes for built-ins.
    default_mapping (str, optional): Icon to use for values not in categorical_mapping. Example: 'question'.
    as_text (bool, optional): If True, use text as the icon (for continuous binning or direct text display).
    continuous_binning (list, optional): List of [threshold, icon] pairs for binning continuous values. Example: [[33, 'low'], [66, 'mid'], [None, 'high']].

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

Example:
    encode_point_icon(graph_id, column='type', categorical_mapping={'macbook': 'laptop', 'Canada': 'flag-icon-ca'}, default_mapping='question')

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
graph_idYes
columnYes
categorical_mappingNo
default_mappingNo
as_textNo
continuous_binningNo

Implementation Reference

  • MCP tool handler for 'encode_point_icon'. Decorated with @mcp.tool() for registration. Implements node icon encoding using Graphistry's encode_point_icon method on cached graph object. The docstring provides input schema details.
    @mcp.tool()
    async def encode_point_icon(
        graph_id: str,
        column: str,
        categorical_mapping: Optional[dict] = None,
        default_mapping: Optional[str] = None,
        as_text: Optional[bool] = False,
        continuous_binning: Optional[list] = None
    ) -> Dict[str, Any]:
        """
        Set node icon encoding for a graph using Graphistry's encode_point_icon API.
    
        Args:
            graph_id (str): The ID of the graph to modify.
            column (str): The node column to use for icon encoding (e.g., 'type', 'origin').
            categorical_mapping (dict, optional): Map of category values to icon names or URLs. Example: {'macbook': 'laptop', 'Canada': 'flag-icon-ca'}. See FontAwesome 4 or ISO country codes for built-ins.
            default_mapping (str, optional): Icon to use for values not in categorical_mapping. Example: 'question'.
            as_text (bool, optional): If True, use text as the icon (for continuous binning or direct text display).
            continuous_binning (list, optional): List of [threshold, icon] pairs for binning continuous values. Example: [[33, 'low'], [66, 'mid'], [None, 'high']].
    
        Returns:
            dict: { 'graph_id': ..., 'url': ... } with the updated visualization URL.
    
        Example:
            encode_point_icon(graph_id, column='type', categorical_mapping={'macbook': 'laptop', 'Canada': 'flag-icon-ca'}, default_mapping='question')
        """
        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:
            kwargs["default_mapping"] = default_mapping
        if as_text:
            kwargs["as_text"] = as_text
        if continuous_binning:
            kwargs["continuous_binning"] = continuous_binning
        g = g.encode_point_icon(**kwargs)
        graph_cache[graph_id]["graph"] = g
        return {"graph_id": graph_id, "url": g.plot(render=False)}
  • The @mcp.tool() decorator registers the encode_point_icon function as an MCP tool.
    @mcp.tool()
Behavior3/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It clearly indicates this is a mutation operation ('modify'), describes the return format, and provides implementation details about FontAwesome 4 and ISO country codes. However, it doesn't mention permissions needed, whether changes are reversible, rate limits, or error conditions that might occur.

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 purpose statement, parameter documentation, return value, and example. While comprehensive, it's appropriately sized for a 6-parameter tool with complex options. Every section earns its place, though the example could be slightly more concise.

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

Completeness4/5

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

For a mutation tool with 6 parameters, 0% schema coverage, and no output schema, the description provides excellent coverage of parameters and return values. It explains the transformation behavior, provides concrete examples, and documents the response format. The main gap is lack of behavioral context around permissions, side effects, or error handling.

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

Parameters5/5

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

With 0% schema description coverage, the description fully compensates by providing detailed semantic explanations for all 6 parameters. Each parameter gets clear documentation with examples (categorical_mapping, continuous_binning), usage guidance (column examples), and optional behavior explanations (default_mapping, as_text). The description adds substantial value beyond the bare schema.

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

Purpose5/5

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

The description clearly states the specific action ('Set node icon encoding'), target resource ('for a graph using Graphistry's encode_point_icon API'), and distinguishes from siblings like encode_point_color and encode_point_size by focusing specifically on icon encoding. The first sentence provides a complete purpose statement.

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

Usage Guidelines4/5

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

The description provides clear context about when to use this tool (for setting icon encoding on graph nodes) and includes an example showing typical usage. However, it doesn't explicitly state when NOT to use it or mention alternatives like encode_point_badge for different encoding types, though the sibling tool names provide some implicit context.

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