Skip to main content
Glama

get_jvm_status

Retrieve comprehensive JVM status reports for Java processes, including thread analysis, memory monitoring, and performance diagnostics. Specify a process ID or use the first Java process found.

Instructions

获取JVM整体状态报告

        Args:
            pid (str): 进程ID,使用字符串形式(如:"12345")。
                如果不指定则自动选择第一个Java进程
        
        Returns:
            Dict: 包含JVM状态信息的字典(暂未实现)
        

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pidNo

Implementation Reference

  • Handler function for the 'get_jvm_status' MCP tool. Currently a stub that returns an error indicating it is not yet implemented.
    @self.mcp.tool()
    def get_jvm_status(pid: str = "") -> Dict:
        """获取JVM整体状态报告
        
        Args:
            pid (str): 进程ID,使用字符串形式(如:"12345")。
                如果不指定则自动选择第一个Java进程
        
        Returns:
            Dict: 包含JVM状态信息的字典(暂未实现)
        """
        return {"success": False, "error": "未实现/不支持"}
  • Full implementation of 'get_jvm_status' tool in the demo server using Arthas client. Aggregates thread, JVM, and memory info from other tools.
    @mcp.tool()
    def get_jvm_status(pid: Optional[int] = None) -> Dict:
        """获取JVM整体状态报告
        
        Args:
            pid: 可选的进程ID,如果不指定则自动选择第一个非arthas的Java进程
        
        Returns:
            包含JVM状态信息的字典
        """
        if pid is None:
            # 如果没有指定PID,获取第一个非arthas的Java进程
            processes = list_java_processes()
            for process in processes:
                if "arthas" not in process["name"].lower():
                    pid = int(process["pid"])
                    break
            if pid is None:
                return {"error": "No valid Java process found"}
    
        thread_info = get_thread_info(pid)
        jvm_info = get_jvm_info(pid)
        memory_info = get_memory_info(pid)
        
        return {
            "pid": pid,
            "thread_info": thread_info,
            "jvm_info": jvm_info,
            "memory_info": memory_info,
            "timestamp": time.time()
        }
  • Usage of get_jvm_status in the jvm_analysis_prompt function within the demo.
    status = get_jvm_status()
    status_json = json.dumps(status, indent=2)

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