visualize_graph
Create interactive GPU-accelerated graph visualizations from structured data to analyze and explore complex network relationships, including standard graphs and hypergraphs.
Instructions
Visualize a graph using Graphistry's GPU-accelerated renderer.
Args:
graph_type (str, optional): Type of graph to visualize. Must be one of "graph" (two-way edges, default), "hypergraph" (many-to-many edges).
graph_data (dict): Dictionary describing the graph to visualize. Fields:
- edges (list, required): List of edges, each as a dict with at least 'source' and 'target' keys (e.g., [{"source": "A", "target": "B"}, ...]) and any other columns you want to include in the edge table
- nodes (list, optional): List of nodes, each as a dict with at least 'id' key (e.g., [{"id": "A"}, ...]) and any other columns you want to include in the node table
- node_id (str, optional): Column name for node IDs, if nodes are provided, must be provided.
- source (str, optional): Column name for edge source (default: "source")
- destination (str, optional): Column name for edge destination (default: "target")
- columns (list, optional): List of column names for hypergraph edge table, use if graph_type is hypergraph.
- title (str, optional): Title for the visualization
- description (str, optional): Description for the visualization
ctx: MCP context for progress reporting
Example (graph):
graph_data = {
"graph_type": "graph",
"edges": [
{"source": "A", "target": "B", "weight": 1},
{"source": "A", "target": "C", "weight": 2},
...
],
"nodes": [
{"id": "A", "label": "Node A"},
{"id": "B", "label": "Node B"},
...
],
"node_id": "id",
"source": "source",
"destination": "target",
"title": "My Graph",
"description": "A simple example graph."
}
Example (hypergraph):
graph_data = {
"graph_type": "hypergraph",
"edges": [
{"source": "A", "target": "B", "group": "G1", "weight": 1},
{"source": "A", "target": "C", "group": "G1", "weight": 1},
...
],
"columns": ["source", "target", "group"],
"title": "My Hypergraph",
"description": "A simple example hypergraph."
}
Input Schema
Name | Required | Description | Default |
---|---|---|---|
ctx | No | ||
graph_data | Yes |
Input Schema (JSON Schema)
{
"$defs": {
"Context": {
"description": "Context object providing access to MCP capabilities.\n\nThis provides a cleaner interface to MCP's RequestContext functionality.\nIt gets injected into tool and resource functions that request it via type hints.\n\nTo use context in a tool function, add a parameter with the Context type annotation:\n\n```python\n@server.tool()\ndef my_tool(x: int, ctx: Context) -> str:\n # Log messages to the client\n ctx.info(f\"Processing {x}\")\n ctx.debug(\"Debug info\")\n ctx.warning(\"Warning message\")\n ctx.error(\"Error message\")\n\n # Report progress\n ctx.report_progress(50, 100)\n\n # Access resources\n data = ctx.read_resource(\"resource://data\")\n\n # Get request info\n request_id = ctx.request_id\n client_id = ctx.client_id\n\n return str(x)\n```\n\nThe context parameter name can be anything as long as it's annotated with Context.\nThe context is optional - tools that don't need it can omit the parameter.",
"properties": {},
"title": "Context",
"type": "object"
}
},
"properties": {
"ctx": {
"anyOf": [
{
"$ref": "#/$defs/Context"
},
{
"type": "null"
}
],
"default": null
},
"graph_data": {
"additionalProperties": true,
"title": "Graph Data",
"type": "object"
}
},
"required": [
"graph_data"
],
"title": "visualize_graphArguments",
"type": "object"
}