Skip to main content
Glama

load_cpg

Loads a Code Property Graph (CPG) from a specified file path for security analysis and code review in the Joern MCP Server.

Instructions

Loads a CPG from a file if the cpg is not loaded or the cpg is not the same as the filepath. Args: cpg_filepath (str): The path to the CPG file, the filepath is absolute path. Returns: str: True if the CPG is loaded successfully, False otherwise.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cpg_filepathYes

Implementation Reference

  • The load_cpg tool handler function, decorated with @joern_mcp.tool() for registration. It executes joern_remote to load the CPG file and extracts the value.
    @joern_mcp.tool() def load_cpg(cpg_filepath: str) -> str: """ Loads a CPG from a file if the cpg is not loaded or the cpg is not the same as the filepath. Args: cpg_filepath (str): The path to the CPG file, the filepath is absolute path. Returns: str: True if the CPG is loaded successfully, False otherwise. """ # return extract_value(joern_remote(f'val cpg = CpgLoader.load("{cpg_filepath}")')) return extract_value(joern_remote(f'load_cpg("{cpg_filepath}")'))

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/sfncat/mcp-joern'

If you have feedback or need assistance with the MCP directory API, please join our Discord server