Skip to main content
Glama
sfncat
by sfncat

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}")'))
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but lacks critical behavioral details. It mentions the conditional loading logic but doesn't disclose error handling, performance characteristics, authentication needs, or what 'successfully loaded' entails. The return value description is minimal and doesn't explain failure modes.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately concise with three sentences that each serve a purpose: stating the action, describing the parameter, and specifying the return value. It's front-loaded with the core functionality. Minor improvements could include combining sentences for better flow.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with no annotations, no output schema, and minimal sibling context, the description provides basic operational information but lacks completeness. It covers what the tool does and the parameter meaning but misses details about CPG format, error conditions, side effects, and integration with other tools in the server.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage and only 1 parameter, the description adds significant value by explaining that cpg_filepath is 'the path to the CPG file' and 'the filepath is absolute path'. This clarifies the parameter's purpose and format beyond what the bare schema provides, though it could elaborate on file format expectations.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Loads' and resource 'CPG from a file', making the purpose understandable. It distinguishes from siblings by focusing on file loading rather than querying or connection checking. However, it doesn't explicitly differentiate from all sibling tools that might involve CPG operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides implied usage context with 'if the cpg is not loaded or the cpg is not the same as the filepath', suggesting when to use it based on current state. However, it doesn't explicitly state when to use this tool versus alternatives like check_connection or other get_* tools, nor does it mention prerequisites or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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