Skip to main content
Glama
batteryshark

System Information MCP Server

by batteryshark

get_user_environment

Retrieve user session details, timezone, and language settings to diagnose environment-specific issues and localization problems.

Instructions

Get user session and locale information - current user, timezone, language.

User context including session details, timezone, and system language settings. Important for environment-specific troubleshooting and localization issues.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The primary handler function for the get_user_environment tool. It is registered via the @mcp.tool decorator and orchestrates the collection of user environment data by calling helper functions get_user_session_info() and get_time_locale_info(), then formats and returns the result as ToolResult.
    @mcp.tool
    def get_user_environment() -> ToolResult:
        """Get user session and locale information - current user, timezone, language.
        
        User context including session details, timezone, and system language settings.
        Important for environment-specific troubleshooting and localization issues.
        """
        info_sections = []
        info_sections.append("# User Environment")
        info_sections.append(f"*Generated: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}*\n")
        
        try:
            info_sections.extend(get_user_session_info())
            info_sections.extend(get_time_locale_info())
        except Exception as e:
            info_sections.append(f"⚠️ **Environment detection error**: {str(e)}")
        
        return text_response("\n".join(info_sections))
  • Supporting helper function that collects current user details: username, full name (platform-specific), and approximate session start time using psutil.
    def get_user_session_info() -> List[str]:
        """Get current user and session information"""
        info = []
        info.append("\n## 👤 User & Session")
        
        # Current user
        current_user = getpass.getuser()
        info.append(f"- **Current User**: {current_user}")
        
        # Try to get full name
        full_name = _get_user_full_name(current_user)
        if full_name:
            info.append(f"- **Full Name**: {full_name}")
        
        # Session info
        try:
            current_process = psutil.Process()
            login_time = datetime.fromtimestamp(current_process.create_time())
            info.append(f"- **Session Start**: {login_time.strftime('%Y-%m-%d %H:%M:%S')}")
        except Exception:
            pass
        
        return info
  • Supporting helper function that gathers time-related information: current time, timezone name, UTC offset, and system locale/language settings.
    def get_time_locale_info() -> List[str]:
        """Get time, timezone, and locale information"""
        info = []
        info.append("\n## 🕐 Time & Locale")
        
        now = datetime.now()
        info.append(f"- **Current Time**: {now.strftime('%Y-%m-%d %H:%M:%S')}")
        
        # Timezone
        try:
            timezone_name = time.tzname[0] if not time.daylight else time.tzname[1]
            info.append(f"- **Timezone**: {timezone_name}")
            
            # UTC offset
            utc_offset = time.timezone if not time.daylight else time.altzone
            offset_hours = -utc_offset // 3600
            offset_sign = '+' if offset_hours >= 0 else '-'
            info.append(f"- **UTC Offset**: UTC{offset_sign}{abs(offset_hours):02d}:00")
        except Exception:
            pass
        
        # System language/locale
        try:
            system_locale = locale.getdefaultlocale()
            if system_locale[0]:
                info.append(f"- **System Language**: {system_locale[0]}")
            if system_locale[1]:
                info.append(f"- **Encoding**: {system_locale[1]}")
        except Exception:
            pass
        
        return info
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions that the tool retrieves 'user session and locale information' and is 'important for... troubleshooting and localization,' but it doesn't disclose key behavioral traits such as whether this is a read-only operation, if it requires specific permissions, potential rate limits, or what the output format looks like. For a tool with no annotation coverage, this leaves significant gaps.

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 appropriately sized and front-loaded: the first sentence clearly states the purpose, and the second adds context. There's minimal waste, but the second sentence could be slightly more concise (e.g., merging ideas). Overall, it's efficient and well-structured.

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 complexity (simple, no parameters) and the absence of annotations and output schema, the description is moderately complete. It explains what the tool does and its use cases, but it lacks details on behavioral aspects (e.g., safety, output format) that would be crucial for an agent to invoke it correctly without structured data. It's adequate but has clear gaps.

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, and the schema description coverage is 100% (as there are no parameters to describe). The description doesn't need to add parameter semantics, so it meets the baseline of 4 for having no parameters. It appropriately focuses on the tool's purpose without unnecessary parameter details.

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 clearly states the tool's purpose: 'Get user session and locale information - current user, timezone, language.' It uses specific verbs ('Get') and resources ('user session and locale information'), making the action and target explicit. However, it doesn't distinguish this tool from its siblings (e.g., get_display_info, get_system_summary), which also retrieve system/user information, so it doesn't reach the highest score.

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 provides implied usage guidance: 'Important for environment-specific troubleshooting and localization issues.' This suggests when the tool might be useful, but it doesn't explicitly state when to use this tool versus alternatives (e.g., get_system_summary for broader info) or any exclusions. The guidance is helpful but not comprehensive.

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/batteryshark/mcp-sysinfo'

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