Skip to main content
Glama

get_stack_trace_by_method

Retrieve Java method call stacks by specifying process ID, class and method patterns, with optional filtering conditions for debugging and performance analysis in JVM applications.

Instructions

获取方法的调用路径

        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: 包含方法调用路径信息的字典(暂未实现)
        

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pidNo
class_patternNo
method_patternNo
conditionNo
use_regexNo
max_matchesNo
max_timesNo

Implementation Reference

  • Handler function decorated with @self.mcp.tool(), which registers the tool. This is the exact implementation (currently a stub indicating '未实现/不支持' - not implemented). Defines input parameters with type hints and docstring describing schema. Executes by returning an error.
    @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": "未实现/不支持"}
  • The @self.mcp.tool() decorator registers the 'get_stack_trace_by_method' tool with the FastMCP server.
    @self.mcp.tool()
Behavior2/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 mentions the return format ('Dict: 包含方法调用路径信息的字典') and notes '暂未实现' (not yet implemented), which is important context. However, it doesn't disclose whether this is a read-only operation, potential performance impacts, error conditions, or what happens when parameters are invalid. For a 7-parameter tool with zero annotation coverage, this is insufficient.

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

Conciseness3/5

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

The description is appropriately sized but not optimally structured. The purpose statement is clear but brief, followed by a detailed parameter section. However, the structure mixes English and Chinese inconsistently, and the '暂未实现' (not yet implemented) note is buried at the end rather than front-loaded. Every sentence earns its place, but the organization could be more agent-friendly.

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 complexity (7 parameters, no annotations, no output schema), the description is partially complete. It covers parameter semantics well but lacks behavioral context, usage guidelines, and clear output expectations. The '暂未实现' note is crucial but doesn't fully compensate for missing information about what the tool actually does when invoked. For a debugging/tracing tool with many parameters, more context would be helpful.

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?

With 0% schema description coverage, the description compensates well by providing detailed parameter documentation in the Args section. Each parameter gets a clear explanation with examples (e.g., '如:"12345"' for pid, '例如:'params[0]<0' 或 '#cost>10'' for condition). This adds significant value beyond the bare schema. The main gap is that some parameter purposes could be clearer (e.g., max_matches vs max_times distinction).

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 as '获取方法的调用路径' (get method call path/stack trace), which is a specific verb+resource combination. It distinguishes from siblings like 'get_stack_trace' (general stack trace) and 'search_method' (method searching) by focusing on call paths for specific methods. However, the title is null, which slightly reduces clarity.

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 like 'get_stack_trace' or 'search_method'. It doesn't mention prerequisites, typical use cases, or exclusions. The only contextual information is the parameter documentation, which doesn't constitute usage guidelines.

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/xzq-xu/jvm-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server