Skip to main content
Glama
utils.py675 B
"""Common utility functions for Linux MCP tools.""" def format_bytes(bytes_value: int) -> str: """ Format bytes into human-readable format. Args: bytes_value: Number of bytes to format Returns: Human-readable string representation (e.g., "1.5GB", "256.0MB") Examples: >>> format_bytes(1024) '1.0KB' >>> format_bytes(1536) '1.5KB' >>> format_bytes(1073741824) '1.0GB' """ for unit in ['B', 'KB', 'MB', 'GB', 'TB']: if bytes_value < 1024.0: return f"{bytes_value:.1f}{unit}" bytes_value /= 1024.0 return f"{bytes_value:.1f}PB"

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/narmaku/linux-mcp-server'

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