Skip to main content
Glama
sfncat
by sfncat

get_class_methods_by_class_full_name

Retrieve all methods from a class by providing its fully qualified name. Returns method details including full name, signature, and ID for code analysis.

Instructions

Get the methods of a class by its fully qualified name

@param class_full_name: The fully qualified name of the class
@return: List of full name, name, signature and id of methods in the class

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
class_full_nameYes

Implementation Reference

  • The handler function implementing the 'get_class_methods_by_class_full_name' MCP tool. It is registered via the @joern_mcp.tool() decorator. The function sends a parameterized query to the Joern server using the joern_remote helper and parses the response into a list using extract_list.
    @joern_mcp.tool()
    def get_class_methods_by_class_full_name(class_full_name:str) -> list[str]:
        """Get the methods of a class by its fully qualified name
      
        @param class_full_name: The fully qualified name of the class
        @return: List of full name, name, signature and id of methods in the class
        """
        response = joern_remote(f'get_class_methods_by_class_full_name("{class_full_name}")')
        return extract_list(response)
  • server.py:94-106 (registration)
    The generate() function in server.py dynamically executes server_tools.py, which defines and registers the tool via its @joern_mcp.tool() decorator during server startup.
    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()
  • The joern_remote helper function, called by the tool handler to execute the actual Joern query on the remote 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
  • The extract_list helper function parses the Joern query response into a structured list of method information (fullName, name, signature, id). Used by the tool handler.
    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
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves methods but doesn't describe what happens if the class doesn't exist, if there are access restrictions, rate limits, or the format of the returned list. For a read operation with zero annotation coverage, this is a significant gap in transparency.

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

Conciseness5/5

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

The description is highly concise and well-structured: a clear purpose statement followed by parameter and return annotations. Every sentence adds value without redundancy, making it easy to parse and understand quickly.

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 complexity (a read operation with one parameter) and lack of annotations and output schema, the description is minimally adequate. It covers the purpose and parameter semantics but misses behavioral details and return value specifics. This leaves gaps for the agent to infer behavior, making it incomplete for optimal use.

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?

The description adds meaningful context for the single parameter: '@param class_full_name: The fully qualified name of the class.' Since schema description coverage is 0% (the schema only provides a title and type), this compensates well by explaining what the parameter represents. However, it doesn't detail format examples or constraints, keeping it from a perfect score.

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 tool's purpose: 'Get the methods of a class by its fully qualified name.' It specifies the verb ('Get') and resource ('methods of a class'), making the function unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'get_method_code_by_class_full_name_and_method_name' or 'get_method_by_call_id', which prevents a perfect score.

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, or exclusions, such as whether the class must be loaded or if there are limitations on class types. This leaves the agent without usage direction beyond the basic purpose.

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