Skip to main content
Glama

search_method

Search for Java methods within running JVM processes using pattern matching to inspect class and method information for debugging and analysis.

Instructions

查看类的方法信息

        Args:
            pid (str): 进程ID,使用字符串形式(如:"12345")
            class_pattern (str): 类名表达式匹配
            method_pattern (Optional[str]): 可选的方法名表达式
            show_detail (bool): 是否展示每个方法的详细信息
            use_regex (bool): 是否开启正则表达式匹配,默认为通配符匹配
            classloader_hash (Optional[str]): 指定class的ClassLoader的hashcode
            classloader_class (Optional[str]): 指定执行表达式的ClassLoader的class name
            max_matches (str): 匹配类的最大数量,使用字符串形式(如:"100")

        Returns:
            Dict: 包含方法信息的字典(暂未实现)
        

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pidNo
class_patternNo
method_patternNo
show_detailNo
use_regexNo
classloader_hashNo
classloader_classNo
max_matchesNo

Implementation Reference

  • Handler function for the 'search_method' MCP tool. It is currently a stub implementation that returns an error message indicating it is not yet supported/implemented. The function signature and docstring define the expected inputs and outputs.
    @self.mcp.tool()
    def search_method(pid: str = "", 
                     class_pattern: str = "", 
                     method_pattern: Optional[str] = None, show_detail: bool = False,
                     use_regex: bool = False, classloader_hash: Optional[str] = None,
                     classloader_class: Optional[str] = None,
                     max_matches: str = "") -> Dict:
        """查看类的方法信息
        
        Args:
            pid (str): 进程ID,使用字符串形式(如:"12345")
            class_pattern (str): 类名表达式匹配
            method_pattern (Optional[str]): 可选的方法名表达式
            show_detail (bool): 是否展示每个方法的详细信息
            use_regex (bool): 是否开启正则表达式匹配,默认为通配符匹配
            classloader_hash (Optional[str]): 指定class的ClassLoader的hashcode
            classloader_class (Optional[str]): 指定执行表达式的ClassLoader的class name
            max_matches (str): 匹配类的最大数量,使用字符串形式(如:"100")
    
        Returns:
            Dict: 包含方法信息的字典(暂未实现)
        """
        return {"success": False, "error": "未实现/不支持"}
  • The @self.mcp.tool() decorator registers the 'search_method' function as an MCP tool in 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 full burden for behavioral disclosure. While it mentions the tool returns a dictionary of method information, it adds '暂未实现' (not yet implemented), creating uncertainty about actual functionality. It doesn't describe permissions needed, whether this is a read-only operation, potential performance impacts, or error conditions for a tool that searches Java processes.

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 brief but followed by extensive parameter documentation. While all content is relevant, it could be more front-loaded with clearer usage context before diving into parameter details. The Chinese documentation is clear but could be more efficiently organized.

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 of 8 parameters, no annotations, and no output schema, the description provides good parameter semantics but lacks broader context. The '暂未实现' (not yet implemented) note creates uncertainty about actual functionality. For a tool that searches Java process methods, more behavioral context about what 'search' entails and typical use cases 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?

The description provides comprehensive parameter documentation with clear explanations for all 8 parameters, including format examples (e.g., '使用字符串形式(如:"12345")'), optional status, defaults, and matching behavior details. This fully compensates for the 0% schema description coverage, giving the agent sufficient understanding of each parameter's purpose and usage.

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

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states '查看类的方法信息' (view class method information), which provides a basic purpose but is vague about scope and specificity. It doesn't clearly distinguish this tool from sibling tools like 'get_class_info' or 'get_stack_trace_by_method', leaving ambiguity about when this particular search tool should be used versus alternatives.

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?

No guidance is provided about when to use this tool versus alternatives. With sibling tools like 'get_class_info' and 'decompile_class' available, the description offers no context about when this search-focused tool is appropriate versus those other inspection tools. The description only lists parameters without usage context.

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