Skip to main content
Glama
Zhuoli

macOS Tools MCP Server

by Zhuoli

system_profile

Retrieve structured system information from macOS, including software, hardware, and configuration data, using the system_profiler command.

Instructions

Return structured data from system_profiler for the requested data type.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
data_typeNosoftware

Implementation Reference

  • Core implementation of the system_profile tool: validates data_type, runs system_profiler -json, parses and returns the output as dict.
    def system_profile(data_type: str = "software") -> dict:
        """Return structured JSON from ``system_profiler`` for a supported data type."""
        normalized = data_type.strip().lower()
        profiler_type = _ALLOWED_PROFILES.get(normalized, data_type.strip())
    
        if profiler_type not in _ALLOWED_PROFILES.values():
            supported = ", ".join(sorted(_ALLOWED_PROFILES))
            raise ToolError(
                f"Unsupported system_profiler data type {data_type!r}. Supported aliases: {supported}"
            )
    
        raw_output = _run_command(
            ["system_profiler", profiler_type, "-json"],
            timeout=_SYSTEM_PROFILER_TIMEOUT,
        )
    
        try:
            return json.loads(raw_output)
        except json.JSONDecodeError as exc:
            raise ToolError("Failed to parse system_profiler JSON output") from exc
  • MCP tool registration for system_profile, including name, description, input schema via type hints, and delegation to tools.system_profile.
    @app.tool(
        name="system_profile",
        description="Return structured data from `system_profiler` for the requested data type.",
    )
    def system_profile(data_type: str = "software", _: Context | None = None) -> dict:
        return tools.system_profile(data_type)
  • Helper mapping user-friendly data_type aliases to internal system_profiler data types used in the handler.
    _ALLOWED_PROFILES = {
        "software": "SPSoftwareDataType",
        "hardware": "SPHardwareDataType",
        "network": "SPNetworkDataType",
        "power": "SPPowerDataType",
    }
  • Timeout constant specifically for system_profiler commands.
    _SYSTEM_PROFILER_TIMEOUT = 120

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/Zhuoli/mcp101'

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