Skip to main content
Glama
dknell

System Information MCP Server

by dknell

get_memory_info_tool

Retrieve real-time memory usage statistics for system monitoring and analysis using the MCP server's interface.

Instructions

Retrieve memory usage statistics.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'get_memory_info_tool' tool, decorated with @app.tool() which also serves as registration. It delegates to the get_memory_info helper.
    @app.tool() def get_memory_info_tool() -> Dict[str, Any]: """Retrieve memory usage statistics.""" return get_memory_info()
  • Core helper function implementing the memory information retrieval using psutil.virtual_memory() and psutil.swap_memory(), with formatting utilities.
    @cache_result("memory_info", ttl=1) def get_memory_info() -> Dict[str, Any]: """Retrieve memory usage statistics.""" try: # Get virtual memory info virtual_mem = psutil.virtual_memory() # Get swap memory info swap_mem = psutil.swap_memory() return { "virtual_memory": { "total": virtual_mem.total, "available": virtual_mem.available, "used": virtual_mem.used, "percent": round(virtual_mem.percent, 1), "total_gb": bytes_to_gb(virtual_mem.total), "available_gb": bytes_to_gb(virtual_mem.available), "used_gb": bytes_to_gb(virtual_mem.used), }, "swap_memory": { "total": swap_mem.total, "used": swap_mem.used, "free": swap_mem.free, "percent": round(swap_mem.percent, 1), "total_gb": bytes_to_gb(swap_mem.total), }, } except Exception as e: logger.error(f"Error getting memory info: {e}") raise

Other Tools

Related 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/dknell/mcp-system-info'

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