Skip to main content
Glama

get_derived_classes_by_class_full_name

Identify derived classes of a specified class by its fully qualified name. Retrieve detailed information including full name, name, and ID for analysis or code review purposes.

Instructions

Get the derived classes of a class

@param class_full_name: The fully qualified name of the class @return: The derived classes info of the class, including the full name, name and id

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
class_full_nameYes

Implementation Reference

  • The handler function for the 'get_derived_classes_by_class_full_name' tool. It is decorated with @joern_mcp.tool() for registration and implements the core logic by querying the Joern server via joern_remote and parsing the response with extract_list.
    @joern_mcp.tool() def get_derived_classes_by_class_full_name(class_full_name:str) -> list[str]: """Get the derived classes of a class @param class_full_name: The fully qualified name of the class @return: The derived classes info of the class, including the full name, name and id """ response = joern_remote(f'get_derived_classes_by_class_full_name("{class_full_name}")') return extract_list(response)
  • server.py:95-106 (registration)
    The dynamic registration mechanism that executes the server_tools.py file, which contains the decorated tool functions including get_derived_classes_by_class_full_name.
    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()
  • Helper function joern_remote used by the tool handler to send CPGQL queries to the Joern server.
    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
  • Helper function extract_list parses the Joern response into a list of strings, used in the tool handler's return statement.
    def extract_list(input_str): """Extract a list of elements from a string representation of a Scala List. Parameters: input_str -- The input string containing a Scala List representation Returns: A Python list containing the extracted elements with cleaned data """ # Check if input is empty or None if not input_str: return []

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