get_calls_in_method_by_method_full_name
Retrieve all function calls within a specified method to analyze code dependencies and security vulnerabilities during code review.
Instructions
Get the calls info by the method full name which the call is in the method
@param method_full_name: The full name of the method
@return: The calls info of the method
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| method_full_name | Yes |
Implementation Reference
- server_tools.py:180-188 (handler)The MCP tool handler for 'get_calls_in_method_by_method_full_name'. It sends a query to the Joern server using joern_remote and processes the response with extract_list to return a list of calls in the specified method.@joern_mcp.tool() def get_calls_in_method_by_method_full_name(method_full_name:str) -> list[str]: """Get the calls info by the method full name which the call is in the method @param method_full_name: The full name of the method @return: The calls info of the method """ response = joern_remote(f'get_calls_in_method_by_method_full_name("{method_full_name}")') return extract_list(response)
- server.py:95-106 (registration)Dynamically registers the tool by executing the code in server_tools.py, which applies the @joern_mcp.tool() decorator to the handler function.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()
- server.py:38-71 (helper)Helper function joern_remote that sends the actual query to the Joern server and returns the 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