Skip to main content
Glama

get_memory_info

Retrieve memory usage statistics and details from a server to monitor performance and identify resource constraints.

Instructions

获取本地服务器内存信息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler function implementing the get_memory_info tool using psutil.virtual_memory() to retrieve and format local server memory information.
    @handle_exceptions def get_memory_info() -> dict: """获取本地服务器内存信息""" mem = psutil.virtual_memory() return { "status": "success", "total": mem.total, "used": mem.used, "free": mem.free, "usage": mem.percent, "available": mem.available, "cached": getattr(mem, 'cached', 0), "buffers": getattr(mem, 'buffers', 0) }
  • Identical core handler function for get_memory_info tool in the SSE variant, using psutil to get memory stats.
    @handle_exceptions def get_memory_info() -> dict: """获取本地服务器内存信息""" mem = psutil.virtual_memory() return { "status": "success", "total": mem.total, "used": mem.used, "free": mem.free, "usage": mem.percent, "available": mem.available, "cached": getattr(mem, 'cached', 0), "buffers": getattr(mem, 'buffers', 0) }
  • Registration of the get_memory_info tool (line 43) within the tools_dict used to dynamically register all tools with the MCP server instance.
    tools_dict = { 'get_memory_info': get_memory_info, 'remote_server_inspection': remote_server_inspection, 'get_system_load': get_system_load, 'monitor_processes': monitor_processes, 'check_service_status': check_service_status, 'get_os_details': get_os_details, 'check_ssh_risk_logins': check_ssh_risk_logins, 'check_firewall_config': check_firewall_config, 'security_vulnerability_scan': security_vulnerability_scan, 'backup_critical_files': backup_critical_files, 'inspect_network': inspect_network, 'analyze_logs': analyze_logs, 'list_docker_containers': list_docker_containers, 'list_docker_images': list_docker_images, 'list_docker_volumes': list_docker_volumes, 'get_container_logs': get_container_logs, 'monitor_container_stats': monitor_container_stats, 'check_docker_health': check_docker_health } # 使用装饰器动态注册所有工具 for name, func in tools_dict.items(): mcp.tool()(func)
  • Enum constant defining the tool name 'get_memory_info' in ServerTools for schema/reference purposes.
    MEMORY_INFO = "get_memory_info"
  • Hardcoded tool description entry for get_memory_info in the list_available_tools helper function.
    {"name": "get_memory_info", "description": "获取本地服务器内存信息", "parameters": []},

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/Heht571/ops-mcp-server'

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