get_graph_info
Retrieve details about a stored graph visualization from Graphistry MCP to access and analyze network data properties.
Instructions
Get information about a stored graph visualization.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"graph_id": "<graph_id>"
},
"name": "get_graph_info"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| graph_id | Yes |
Implementation Reference
- The handler function for the 'get_graph_info' tool. It retrieves cached graph data and computes node and edge counts, returning graph metadata. Registered with @mcp.tool() decorator, which also implies schema from signature and docstring.
@mcp.tool() async def get_graph_info(graph_id: str) -> Dict[str, Any]: """Get information about a stored graph visualization.""" try: if graph_id not in graph_cache: raise ValueError(f"Graph not found: {graph_id}") graph_data = graph_cache[graph_id] edges_df = graph_data["edges_df"] source = graph_data["source"] destination = graph_data["destination"] # Get node and edge counts if edges_df is not None: node_count = len(set(edges_df[source].unique()) | set(edges_df[destination].unique())) edge_count = len(edges_df) else: node_count = 0 edge_count = 0 return { "graph_id": graph_id, "title": graph_data["title"], "description": graph_data["description"], "node_count": node_count, "edge_count": edge_count } except Exception as e: logger.error(f"Error in get_graph_info: {e}") raise - src/graphistry_mcp_server/server.py:176-176 (registration)Registration of the get_graph_info tool using the FastMCP @mcp.tool() decorator.
@mcp.tool()