Skip to main content
Glama
g0t4

macOS Defaults MCP Server

by g0t4

defaults-read

Read macOS system preferences and application settings using the defaults command to access configuration values for domains and keys.

Instructions

use the defaults read <domain> <key> command

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYesDomain to read from
keyNoKey to read from

Implementation Reference

  • The handler function that executes the 'defaults-read' tool logic by running the macOS 'defaults read' command with the provided domain and optional key, capturing and formatting the output.
    def defaults_read(arguments: dict | None) -> list[types.TextContent]:
        if arguments is None:
            return []
        domain = arguments["domain"]
        key = arguments.get("key")
    
        if key is None:
            result = subprocess.run(["defaults", "read", domain], capture_output=True)
            return [types.TextContent(type="text", text=result.stdout.decode("utf-8"))]
    
        result = subprocess.run(["defaults", "read", domain, key], capture_output=True)
        value = result.stdout.decode("utf-8").strip()
        return [types.TextContent(type="text", text=f"{key}: {value}")]
  • Registers the 'defaults-read' tool in the list_tools handler, specifying its name, description, and input schema (domain required, key optional).
    types.Tool(
        name="defaults-read",
        description = "use the `defaults read <domain> <key>` command",
        inputSchema = {
            "type": "object",
            "properties": {
                "domain": {
                    "type": "string",
                    "description": "Domain to read from",
                },
                "key": {
                    "type": "string",
                    "description": "Key to read from",
                },
            },
            "required": ["domain"],
        },
    ),
  • JSON schema for the 'defaults-read' tool inputs, defining properties for 'domain' (required) and 'key' (optional).
    inputSchema = {
        "type": "object",
        "properties": {
            "domain": {
                "type": "string",
                "description": "Domain to read from",
            },
            "key": {
                "type": "string",
                "description": "Key to read from",
            },
        },
        "required": ["domain"],
    },
  • Dispatch logic in the main call_tool handler that routes 'defaults-read' calls to the defaults_read function.
    elif name == "defaults-read":
        return defaults_read(arguments)

Tool Definition Quality

Score is being calculated. Check back soon.

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/g0t4/mcp-server-macos-defaults'

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