Skip to main content
Glama
dknell

System Information MCP Server

by dknell

get_temperature_info_tool

Get system temperature sensor data to monitor hardware heat levels and prevent overheating.

Instructions

Retrieve system temperature sensors (when available).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The tool handler/endpoint registered with FastMCP's @app.tool() decorator. It delegates to the get_temperature_info() function in tools.py.
    @app.tool()
    def get_temperature_info_tool() -> Dict[str, Any]:
        """Retrieve system temperature sensors (when available)."""
        return get_temperature_info()
  • The core implementation that gathers temperature sensor data (using psutil.sensors_temperatures) and fan data (using psutil.sensors_fans), returning a dict with 'temperatures' and 'fans' arrays.
    @cache_result("temperature_info", ttl=10)
    def get_temperature_info() -> Dict[str, Any]:
        """Retrieve system temperature sensors (when available)."""
        if not config.enable_temperatures:
            return {"temperatures": [], "fans": []}
    
        try:
            temperatures = []
            fans = []
    
            # Try to get temperature sensors
            try:
                if hasattr(psutil, 'sensors_temperatures'):
                    sensors_temps = psutil.sensors_temperatures()
                    if sensors_temps:
                        for sensor_name, temps in sensors_temps.items():
                            for temp in temps:
                                temp_info = {
                                    "name": temp.label or sensor_name,
                                    "current": round(temp.current, 1),
                                    "unit": "celsius",
                                }
                                if temp.high:
                                    temp_info["high"] = round(temp.high, 1)
                                if temp.critical:
                                    temp_info["critical"] = round(temp.critical, 1)
                                temperatures.append(temp_info)
            except (AttributeError, OSError) as e:
                logger.debug(f"Temperature sensors not available: {e}")
    
            # Try to get fan sensors
            try:
                if hasattr(psutil, 'sensors_fans'):
                    sensors_fans = psutil.sensors_fans()
                    if sensors_fans:
                        for fan_name, fan_list in sensors_fans.items():
                            for fan in fan_list:
                                fan_info = {
                                    "name": fan.label or fan_name,
                                    "current_speed": safe_int(fan.current),
                                    "unit": "rpm",
                                }
                                fans.append(fan_info)
            except (AttributeError, OSError) as e:
                logger.debug(f"Fan sensors not available: {e}")
    
            return {"temperatures": temperatures, "fans": fans}
    
        except Exception as e:
            logger.error(f"Error getting temperature info: {e}")
            raise
  • Import of get_temperature_info from the tools module, making it available for the tool handler.
    from .tools import (
        get_cpu_info,
        get_memory_info,
        get_disk_info,
        get_network_info,
        get_process_list,
        get_system_uptime,
        get_temperature_info,
    )
  • Imports used by get_temperature_info including cache_result (for caching), safe_int (for fan speed conversion), and logger.
    from .utils import (
        bytes_to_gb,
        bytes_to_mb,
        format_uptime,
        timestamp_to_iso,
        cache_result,
        safe_float,
        safe_int,
        filter_sensitive_cmdline,
  • The function signature and return type (Dict[str, Any]) defines the output schema. Returns dict with two keys: 'temperatures' (list of temp objects with name/current/unit/high/critical) and 'fans' (list of fan objects with name/current_speed/unit).
    @cache_result("temperature_info", ttl=10)
    def get_temperature_info() -> Dict[str, Any]:
        """Retrieve system temperature sensors (when available)."""
        if not config.enable_temperatures:
            return {"temperatures": [], "fans": []}
    
        try:
            temperatures = []
            fans = []
    
            # Try to get temperature sensors
            try:
                if hasattr(psutil, 'sensors_temperatures'):
                    sensors_temps = psutil.sensors_temperatures()
                    if sensors_temps:
                        for sensor_name, temps in sensors_temps.items():
                            for temp in temps:
                                temp_info = {
                                    "name": temp.label or sensor_name,
                                    "current": round(temp.current, 1),
                                    "unit": "celsius",
                                }
                                if temp.high:
                                    temp_info["high"] = round(temp.high, 1)
                                if temp.critical:
                                    temp_info["critical"] = round(temp.critical, 1)
                                temperatures.append(temp_info)
            except (AttributeError, OSError) as e:
                logger.debug(f"Temperature sensors not available: {e}")
    
            # Try to get fan sensors
            try:
                if hasattr(psutil, 'sensors_fans'):
                    sensors_fans = psutil.sensors_fans()
                    if sensors_fans:
                        for fan_name, fan_list in sensors_fans.items():
                            for fan in fan_list:
                                fan_info = {
                                    "name": fan.label or fan_name,
                                    "current_speed": safe_int(fan.current),
                                    "unit": "rpm",
                                }
                                fans.append(fan_info)
            except (AttributeError, OSError) as e:
                logger.debug(f"Fan sensors not available: {e}")
    
            return {"temperatures": temperatures, "fans": fans}
    
        except Exception as e:
            logger.error(f"Error getting temperature info: {e}")
            raise
Behavior2/5

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

No annotations are provided, so the description must fully disclose behavior. It only mentions 'when available,' leaving unclear what happens when sensors are unavailable (e.g., returns null, empty, or error). No details on permissions, rate limits, or other side effects are given, which is a significant gap for a retrieve operation.

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

Conciseness4/5

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

The description is a single, front-loaded sentence that conveys the essential purpose without unnecessary words. It earns its place by being minimal and clear, though a slightly longer explanation of fallback behavior could be beneficial without harming conciseness.

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

Completeness3/5

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

Given the tool's simplicity, no parameters, and presence of an output schema (so return format is defined elsewhere), the description is mostly complete. However, it lacks clarity on what happens when temperature sensors are not available, which is a notable gap for a system info tool.

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 zero parameters, so the baseline is 4. The description adds no parameter info, but none is needed since the schema has no properties. The 100% schema description coverage is irrelevant here.

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 'Retrieve system temperature sensors (when available)' uses a specific verb and clearly identifies the resource (system temperature sensors), distinguishing it from sibling tools like get_cpu_info_tool and get_memory_info_tool. The 'when available' qualifier adds useful context, though it doesn't fully elaborate on error handling.

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

Usage Guidelines3/5

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

The description implies usage for retrieving temperature data when sensors are present, but provides no explicit guidance on when to use this tool versus alternatives. Siblings are clearly different info tools, so context is implied, but no exclusions or when-not-to-use scenarios are mentioned.

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

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