Skip to main content
Glama
sfncat
by sfncat

get_method_callers

Identify methods that invoke a specified function to analyze code dependencies and trace call relationships in software systems.

Instructions

Retrieves a list of methods that call the specified method

@param method_full_name: The fully qualified name of the source method(e.g., com.android.nfc.NfcService$6.onReceive:void(android.content.Context,android.content.Intent))
@return: List of full name, name, signature and id of methods called by the source method

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
method_full_nameYes

Implementation Reference

  • Handler function for 'get_method_callers' tool. Takes method_full_name, queries Joern server via joern_remote for callers, and returns extracted list using extract_list. The decorator @joern_mcp.tool() registers it as an MCP tool. The docstring provides input/output schema details.
    @joern_mcp.tool()
    def get_method_callers(method_full_name: str) -> list[str]:
        """Retrieves a list of methods that call the specified method
        
        @param method_full_name: The fully qualified name of the source method(e.g., com.android.nfc.NfcService$6.onReceive:void(android.content.Context,android.content.Intent))
        @return: List of full name, name, signature and id of methods called by the source method
        """
        responses = joern_remote(f'get_method_callers("{method_full_name}")')
        return extract_list(responses)
  • server_tools.py:47-47 (registration)
    Decorator that registers the get_method_callers function as an MCP tool with the joern_mcp FastMCP instance.
    @joern_mcp.tool()
  • Helper function joern_remote used by get_method_callers to execute the Joern query 'get_method_callers("{method_full_name}")' against 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
Behavior3/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 describes a read-only retrieval operation ('Retrieves') and specifies the return format, which is helpful. However, it does not mention potential limitations like rate limits, authentication needs, or error conditions, leaving some behavioral aspects unclear.

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 front-loaded with the core purpose, followed by parameter and return details in a structured format. Every sentence adds value without redundancy, making it efficient and easy to parse. The use of annotations like '@param' and '@return' enhances clarity without verbosity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (single parameter, no output schema, no annotations), the description is largely complete: it explains the purpose, parameter, and return value. However, it could improve by addressing behavioral aspects like error handling or performance considerations, which are not covered.

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 schema description coverage is 0%, so the description must compensate fully. It provides a detailed parameter description with an example format for 'method_full_name' and explains what it represents, adding significant meaning beyond the bare schema. This effectively documents the single parameter's purpose and format.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/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 resource ('list of methods that call the specified method'), making the purpose explicit. It distinguishes from siblings like 'get_method_callees' (which would find methods called by a method) by focusing on callers rather than callees, providing clear differentiation.

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

Usage Guidelines4/5

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

The description implies usage context by specifying the parameter format and return type, but does not explicitly state when to use this tool versus alternatives like 'get_method_callees' or other sibling tools. It provides clear input requirements but lacks explicit guidance on tool selection scenarios.

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