Skip to main content
Glama
batteryshark

System Information MCP Server

by batteryshark

get_storage_analysis

Analyze disk storage across all partitions to monitor capacity and usage for effective space management and troubleshooting.

Instructions

Get disk and storage analysis - all partitions, capacity, usage.

Comprehensive storage overview including all mounted volumes and usage stats. Critical for disk space management and storage troubleshooting.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'get_storage_analysis' tool, decorated with @mcp.tool which registers it with the FastMCP server. It adds a header with timestamp, calls the helper get_storage_info() to collect storage data, handles exceptions, and formats the output as a ToolResult using text_response.
    @mcp.tool def get_storage_analysis() -> ToolResult: """Get disk and storage analysis - all partitions, capacity, usage. Comprehensive storage overview including all mounted volumes and usage stats. Critical for disk space management and storage troubleshooting. """ info_sections = [] info_sections.append("# Storage Analysis") info_sections.append(f"*Generated: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}*\n") try: info_sections.extend(get_storage_info()) except Exception as e: info_sections.append(f"⚠️ **Storage detection error**: {str(e)}") return text_response("\n".join(info_sections))
  • Supporting utility function that implements the core storage analysis logic using psutil.disk_partitions() and disk_usage(). Iterates over all disk partitions, calculates capacity and usage statistics, determines disk types, skips temporary filesystems and inaccessible drives, and returns formatted list of storage information.
    def get_storage_info() -> List[str]: """Get disk and storage information""" info = [] info.append("\n## 💾 Storage") disk_partitions = psutil.disk_partitions() for partition in disk_partitions: try: disk_usage = psutil.disk_usage(partition.mountpoint) total_gb = disk_usage.total / (1024**3) free_gb = disk_usage.free / (1024**3) used_percent = (disk_usage.used / disk_usage.total) * 100 # Determine disk type disk_type = "Fixed" if partition.opts and 'removable' in partition.opts: disk_type = "Removable" elif partition.fstype in ['tmpfs', 'devtmpfs']: continue # Skip temporary filesystems info.append(f"\n### {partition.device} ({partition.mountpoint})") info.append(f"- **Type**: {disk_type} ({partition.fstype})") info.append(f"- **Total**: {total_gb:.1f} GB") info.append(f"- **Free**: {free_gb:.1f} GB ({100-used_percent:.1f}% free)") info.append(f"- **Used**: {used_percent:.1f}%") except (PermissionError, OSError): continue # Skip inaccessible drives return 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/batteryshark/mcp-sysinfo'

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