Skip to main content
Glama
sfncat
by sfncat

get_class_full_name_by_id

Retrieve the fully qualified class name from a class ID in code analysis. Input a class identifier to get the complete class name for security review and debugging.

Instructions

Retrieves the fully name of a class by its ID

@param id: The unique identifier of the class (typeDecl), the id is a Long int string, like '111669149702L'
@return: The fully name of the class (e.g., com.android.nfc.NfcService$6)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
class_idYes

Implementation Reference

  • The core handler function implementing the 'get_class_full_name_by_id' tool. It uses the joern_remote helper to query the Joern server and extract_value to parse the response.
    @joern_mcp.tool()
    def get_class_full_name_by_id(class_id:str) -> str:
        """Retrieves the fully name of a class by its ID
        
        @param id: The unique identifier of the class (typeDecl), the id is a Long int string, like '111669149702L'
        @return: The fully name of the class (e.g., com.android.nfc.NfcService$6)
        """
        response =  joern_remote(f'get_class_full_name_by_id("{class_id}")')
        return extract_value(response)
  • server.py:94-106 (registration)
    Registers all tools from server_tools.py, including 'get_class_full_name_by_id', by dynamically executing the file containing the @joern_mcp.tool() decorators.
    SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
    GENERATED_PY = os.path.join(SCRIPT_DIR, "server_tools.py")
    def generate():
        """Generate and execute additional server tools from server_tools.py file.
        
        This function reads the content of server_tools.py and executes it to add
        more functionality to the server.
        """
        with open(GENERATED_PY, "r") as f:
            code = f.read()
            exec(compile(code, GENERATED_PY, "exec"))
    
    generate()
  • Key helper function used by the tool handler to send the actual query to the Joern server via HTTP.
    def joern_remote(query):
        """
        Execute remote query and return results
        
        Parameters:
        query -- The query string to execute
        
        Returns:
        Returns the server response stdout content on success
        Returns None on failure, error message will be output to stderr
        """
        data = {"query": query}
        headers = {'Content-Type': 'application/json'}
    
        try:
            response = requests.post(
                f'http://{server_endpoint}/query-sync',
                data=json.dumps(data),
                headers=headers,
                auth=basic_auth,
                timeout=timeout
            )
            response.raise_for_status()  
            
            result = response.json()
            return remove_ansi_escape_sequences(result.get('stdout', ''))
            
        except requests.exceptions.RequestException as e:
            sys.stderr.write(f"Request Error: {str(e)}\n")
        except json.JSONDecodeError:
            sys.stderr.write("Error: Invalid JSON response\n")
        
        return None
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the return type but doesn't cover error handling, performance, or other behavioral traits like whether the ID must exist or what happens on invalid input. The description adds minimal context beyond the basic operation.

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 two sentences: one for the purpose and one detailing parameters and return. It's front-loaded with the main function. However, there are minor issues like typos ('fully name' instead of 'full name') and redundant phrasing that slightly reduce efficiency.

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 the tool's low complexity (1 parameter, no output schema, no annotations), the description is moderately complete. It covers the purpose and parameter details well but lacks information on error cases, return format nuances, or integration with sibling tools, leaving some gaps for an AI agent to infer usage.

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 meaning beyond the input schema, which has 0% description coverage. It specifies that the parameter 'id' (mapped to 'class_id' in schema) is a 'unique identifier of the class (typeDecl)', provides the data type 'Long int string', and gives an example format '111669149702L'. 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 verb 'retrieves' and the resource 'fully name of a class by its ID', making the purpose understandable. However, it doesn't explicitly distinguish this tool from sibling tools like 'get_method_full_name_by_id' or 'get_class_methods_by_class_full_name', which also retrieve class-related information but for different aspects.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, context for selecting this over similar sibling tools (e.g., 'get_method_full_name_by_id'), or any exclusions. Usage is implied only by the purpose statement.

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