set_graph_settings
Customize and update graph visualization settings using Graphistry's API. Specify parameters like pointSize and edgeInfluence to modify interactive graph displays. Returns the updated graph URL for instant preview.
Instructions
Set visualization settings for a graph using Graphistry's settings API.
Args:
graph_id (str): The ID of the graph to modify.
url_params (dict): Dictionary of Graphistry URL parameters to control visualization. Example: {'pointSize': 0.5, 'edgeInfluence': 2, 'play': 0}.
Returns:
dict: { 'graph_id': ..., 'url': ... } with the updated visualization URL.
Example:
set_graph_settings(graph_id, url_params={'pointSize': 0.5, 'play': 0})
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| graph_id | Yes | ||
| url_params | Yes |
Implementation Reference
- The handler function for the 'set_graph_settings' MCP tool. It is decorated with @mcp.tool() which also serves as registration. The function retrieves the graph object from cache, applies the provided url_params using Graphistry's settings method, updates the cache, and returns the updated graph ID and URL.@mcp.tool() async def set_graph_settings(graph_id: str, url_params: dict) -> Dict[str, Any]: """ Set visualization settings for a graph using Graphistry's settings API. Args: graph_id (str): The ID of the graph to modify. url_params (dict): Dictionary of Graphistry URL parameters to control visualization. Example: {'pointSize': 0.5, 'edgeInfluence': 2, 'play': 0}. Returns: dict: { 'graph_id': ..., 'url': ... } with the updated visualization URL. Example: set_graph_settings(graph_id, url_params={'pointSize': 0.5, 'play': 0}) """ if graph_id not in graph_cache: raise ValueError(f"Graph not found: {graph_id}") g = graph_cache[graph_id]["graph"] g = g.settings(url_params=url_params) graph_cache[graph_id]["graph"] = g return {"graph_id": graph_id, "url": g.plot(render=False)}
- src/graphistry_mcp_server/server.py:629-629 (registration)The @mcp.tool() decorator registers the set_graph_settings function as an MCP tool.@mcp.tool()