get_stack_trace_by_method
Trace the call path of specific methods in Java processes by specifying process ID, class/method patterns, and conditions for targeted debugging and performance analysis.
Instructions
获取方法的调用路径
Args:
pid: 进程ID
class_pattern: 类名表达式匹配
method_pattern: 方法名表达式匹配
condition: 条件表达式,例如:'params[0]<0' 或 '#cost>10'
use_regex: 是否开启正则表达式匹配,默认为通配符匹配
max_matches: 指定Class最大匹配数量,默认值为50
max_times: 执行次数限制
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| class_pattern | Yes | ||
| condition | No | ||
| max_matches | No | ||
| max_times | No | ||
| method_pattern | Yes | ||
| pid | Yes | ||
| use_regex | No |
Implementation Reference
- src/jvm_mcp_server/server.py:467-488 (handler)Stub handler function for the 'get_stack_trace_by_method' tool, decorated with @self.mcp.tool() for automatic registration in the FastMCP server. Currently returns a 'not implemented' response.@self.mcp.tool() def get_stack_trace_by_method(pid: str = "", class_pattern: str = "", method_pattern: str = "", condition: Optional[str] = None, use_regex: bool = False, max_matches: str = "", max_times: str = "") -> Dict: """获取方法的调用路径 Args: pid (str): 进程ID,使用字符串形式(如:"12345") class_pattern (str): 类名表达式匹配 method_pattern (str): 方法名表达式匹配 condition (Optional[str]): 条件表达式,例如:'params[0]<0' 或 '#cost>10' use_regex (bool): 是否开启正则表达式匹配,默认为通配符匹配 max_matches (str): Class最大匹配数量,使用字符串形式(如:"50") max_times (str): 执行次数限制,使用字符串形式 Returns: Dict: 包含方法调用路径信息的字典(暂未实现) """ return {"success": False, "error": "未实现/不支持"}
- src/jvm_mcp_server/server.py:467-467 (registration)The @self.mcp.tool() decorator registers the get_stack_trace_by_method function as an MCP tool.@self.mcp.tool()