Skip to main content
Glama

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

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