Skip to main content
Glama

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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
graph_idYes

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
  • Registration of the get_graph_info tool using the FastMCP @mcp.tool() decorator.
    @mcp.tool()

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