Skip to main content
Glama
g0t4

macOS Defaults MCP Server

by g0t4

defaults-write

Modify macOS system preferences and application settings by writing values to specific domains and keys using the defaults command.

Instructions

use the defaults write <domain> <key> <value> command

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYesDomain to write to
keyYesKey to write to
valueYesValue to write

Implementation Reference

  • The 'defaults_write' function implements the core logic of the 'defaults-write' tool by parsing arguments and executing subprocess.run(['defaults', 'write', domain, key, value]).
    def defaults_write(arguments: dict | None) -> list[types.TextContent]:
        if arguments is None:
            return []
        domain = arguments["domain"]
        key = arguments["key"]
        value = arguments["value"]
    
        # TODO do I need to notify client that resource changed? can't it just ask for it again?
        result = subprocess.run(["defaults", "write", domain, key, value], capture_output=True)
        return [types.TextContent(type="text", text=result.stdout.decode("utf-8"))]
  • Tool schema definition returned by list_tools(), specifying required string parameters: domain, key, value.
    types.Tool(
        name="defaults-write",
        description = "use the `defaults write <domain> <key> <value>` command",
        inputSchema = {
            "type": "object",
            "properties": {
                "domain": {
                    "type": "string",
                    "description": "Domain to write to",
                },
                "key": {
                    "type": "string",
                    "description": "Key to write to",
                },
                "value": {
                    "type": "string",
                    "description": "Value to write",
                },
            },
            "required": ["domain", "key", "value"],
        },
    ),
  • Registration of the tool handler within the @server.call_tool() dispatcher function.
    elif name == "defaults-write":
        return defaults_write(arguments)
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