Skip to main content
Glama

get_memory_info

Retrieve detailed memory usage data from the local server using OPS MCP Server. Monitor and analyze memory performance for efficient server management.

Instructions

获取本地服务器内存信息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Primary handler implementation for the 'get_memory_info' MCP tool. Uses psutil to fetch detailed local server memory statistics including total, used, free, usage percentage, available, cached, and buffers.
    @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 handler implementation for the 'get_memory_info' tool in the SSE variant codebase.
    @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) into the MCP server's tools_dict and subsequent dynamic registration loop using mcp.tool() decorator.
    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)
  • Descriptive schema for the get_memory_info tool used in list_available_tools function, specifying name, description, and empty parameters.
    {"name": "get_memory_info", "description": "获取本地服务器内存信息", "parameters": []},
  • Enum constant defining the tool name 'get_memory_info' in ServerTools enum for reference.
    MEMORY_INFO = "get_memory_info"

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