Skip to main content
Glama
Heht571
by Heht571

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": []},
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but only states what the tool does, not how it behaves. It doesn't disclose whether this is a read-only operation, if it requires specific permissions, what format the output is in, or any rate limits. For a system tool with zero annotation coverage, this is insufficient behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence in Chinese that directly states the purpose without any fluff. It's appropriately sized for a simple tool and front-loaded with the essential information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (0 parameters) but lack of annotations and output schema, the description is incomplete. It doesn't explain what memory information is returned (e.g., usage, capacity, stats), which is critical for an agent to understand the tool's utility. For a system monitoring tool, this gap reduces effectiveness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage, so the schema fully documents the absence of inputs. The description doesn't need to add parameter semantics, and it doesn't incorrectly imply any parameters. Baseline 4 is appropriate for a zero-parameter tool with complete schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description '获取本地服务器内存信息' (Get local server memory information) clearly states the verb ('获取' - get) and resource ('本地服务器内存信息' - local server memory information). It's specific about what information is retrieved, though it doesn't explicitly distinguish from siblings like 'get_system_load' or 'get_os_details' which might overlap in system monitoring.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention context, prerequisites, or exclusions, leaving the agent to infer usage from the name alone. This is a basic gap for a tool in a set with multiple system monitoring siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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