Skip to main content
Glama
sfncat
by sfncat

get_method_full_name_by_id

Retrieve the fully qualified name of a method using its unique identifier. This tool helps identify methods in code analysis by converting method IDs to complete method signatures.

Instructions

Retrieves the fully qualified name of a method by its ID

@param id: The unique identifier of the method, the id is a Long int string, like '111669149702L'
@return: The fully qualified name of the method (e.g., com.android.nfc.NfcService$6.onReceive:void(android.content.Context,android.content.Intent))

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
method_idYes

Implementation Reference

  • The handler function for the get_method_full_name_by_id tool. It uses the @joern_mcp.tool() decorator for automatic registration and schema inference from type hints and docstring. The logic queries the Joern server remotely and extracts the result.
    @joern_mcp.tool()
    def get_method_full_name_by_id(method_id:str) -> str:
        """Retrieves the fully qualified name of a method by its ID
        
        @param id: The unique identifier of the method, the id is a Long int string, like '111669149702L'
        @return: The fully qualified name of the method (e.g., com.android.nfc.NfcService$6.onReceive:void(android.content.Context,android.content.Intent))
        """
        response = joern_remote(f'get_method_full_name_by_id("{method_id}")')
        return extract_value(response)
  • server.py:32-32 (registration)
    Creation of the FastMCP server instance named 'joern_mcp' which is used to register all tools via decorators.
    joern_mcp = FastMCP("joern-mcp", log_level=log_level)
  • server.py:96-106 (registration)
    Dynamic registration of tools from server_tools.py by executing its code, which applies the @joern_mcp.tool() decorators to register get_method_full_name_by_id and others.
    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 to send HTTP POST requests to the Joern server with the query and return cleaned stdout response, used by the tool handler.
    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 utility to parse and extract the value from Joern query responses based on patterns, used in the tool handler to process the response.
    def extract_value(input_str: str) -> str:
        """Extract value from a string based on its pattern.
        
        This function automatically selects the appropriate extraction method based on
        the input string format:
        * If contains 'Long =', uses extract_long_value
        * If contains triple quotes, uses extract_code_between_triple_quotes
        * If contains single quotes, uses extract_quoted_string
        
        Args:
            input_str (str): Input string containing a value to extract
            
        Returns:
            str: Extracted value based on the detected pattern
        """
        if 'Long =' in input_str:
            return extract_long_value(input_str)
        elif 'String = """' in input_str:
            return extract_code_between_triple_quotes(input_str)
        elif 'String = "' in input_str:
            return extract_quoted_string(input_str)
        else:
            return input_str
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 the retrieval action and return format, but doesn't mention potential errors (e.g., invalid ID), performance characteristics, or authentication needs. It adds basic context about the return value format, which is helpful but not comprehensive for a tool with zero annotation coverage.

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 efficiently structured with a clear purpose statement followed by parameter and return documentation. Every sentence adds value: the first states what the tool does, the second explains the parameter with an example, and the third describes the return format with an example. No wasted words or redundancy.

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?

For a single-parameter retrieval tool with no annotations and no output schema, the description is reasonably complete. It covers purpose, parameter details with examples, and return format with an example. However, it lacks error handling information and doesn't fully address behavioral aspects like performance or side effects, leaving minor gaps in completeness.

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 has 0% description coverage, so the description must fully compensate. It explicitly documents the single parameter 'id' with its type (Long int string) and provides a concrete example ('111669149702L'), adding crucial meaning beyond the schema's generic 'string' type. This fully addresses the parameter semantics gap.

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 specific action ('Retrieves') and resource ('fully qualified name of a method by its ID'), distinguishing it from siblings like get_method_code_by_id (which retrieves code) or get_method_by_call_id (which retrieves method details by call ID). The verb+resource combination is precise and unambiguous.

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

Usage Guidelines3/5

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

The description implies usage when you have a method ID and need its fully qualified name, but it doesn't explicitly state when to use this tool versus alternatives like get_method_full_name_by_call_id or get_method_code_by_id. No exclusions or prerequisites are mentioned, leaving usage context somewhat inferred rather than clearly defined.

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