Skip to main content
Glama
sfncat
by sfncat

get_call_code_by_id

Retrieve source code for a specific call node using its unique identifier from the loaded CPG, enabling targeted code review and analysis.

Instructions

Get the source code of a specific call node from the loaded CPG by the call id

@param id: The unique identifier of the call node, the id is a Long int string, like '111669149702L'
@return: The source code of the specified call

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
code_idYes

Implementation Reference

  • The handler function for 'get_call_code_by_id' tool. It is decorated with @joern_mcp.tool(), which registers it as an MCP tool. The function takes a code_id (str), queries the Joern server using joern_remote, and returns the extracted source code of the call node.
    @joern_mcp.tool()
    def get_call_code_by_id(code_id:str) -> str:
        """Get the source code of a specific call node from the loaded CPG by the call id
        
        @param id: The unique identifier of the call node, the id is a Long int string, like '111669149702L'
        @return: The source code of the specified call
        """
        response =  joern_remote(f'get_call_code_by_id("{code_id}")')
        return extract_value(response)
  • The @joern_mcp.tool() decorator registers the get_call_code_by_id function as an MCP tool.
    @joern_mcp.tool()
  • Type hints define the input schema (code_id: str) and output (str), with detailed documentation in the docstring.
    def get_call_code_by_id(code_id:str) -> str:
Behavior3/5

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

With no annotations provided, the description carries full burden. It discloses that it retrieves source code (a read operation) and mentions the CPG must be loaded, which is useful context. However, it doesn't describe error behavior (e.g., what happens if the ID doesn't exist), performance characteristics, or any limitations like rate limits or authentication needs, leaving gaps for a tool with no annotation coverage.

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 sized with three sentences: purpose statement, parameter explanation, and return value. It's front-loaded with the main purpose first. The @param and @return annotations are slightly redundant but still efficient. There's minimal waste, though it could be slightly more streamlined.

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?

Given no annotations, 0% schema coverage, and no output schema, the description does well by explaining the parameter and return value. However, for a tool that retrieves data from a loaded CPG, it lacks details on prerequisites (e.g., CPG must be loaded), error handling, or output format beyond 'source code'. This leaves gaps in completeness for effective agent use.

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

Parameters5/5

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

The description adds significant value beyond the input schema, which has 0% description coverage. It explains that the parameter 'id' (mapped to 'code_id' in schema) is 'The unique identifier of the call node' and provides a concrete example format ('111669149702L'), clarifying it's a 'Long int string'. This compensates fully for the schema's lack of documentation.

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 action ('Get the source code') and resource ('of a specific call node from the loaded CPG by the call id'), making the purpose understandable. It distinguishes from siblings like 'get_method_code_by_id' by specifying it retrieves call node source code rather than method code. However, it doesn't explicitly contrast with all similar tools like 'get_method_code_by_full_name'.

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 implies usage context by mentioning 'from the loaded CPG', suggesting the CPG must be loaded first (likely via 'load_cpg' sibling tool). However, it doesn't provide explicit guidance on when to use this tool versus alternatives like 'get_method_code_by_id' or 'get_method_code_by_full_name', nor does it specify when not to use it.

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