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
| Name | Required | Description | Default |
|---|---|---|---|
| data_type | No | software |
Implementation Reference
- macos_tools_mcp/tools.py:88-108 (handler)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
- macos_tools_mcp/server.py:61-66 (registration)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)
- macos_tools_mcp/tools.py:15-20 (helper)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", }
- macos_tools_mcp/tools.py:13-13 (helper)Timeout constant specifically for system_profiler commands._SYSTEM_PROFILER_TIMEOUT = 120