list-domains
Discover available macOS domains to view and modify system preferences and application settings using the defaults system.
Instructions
List all available macOS domains, same as defaults domains
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list-domains"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The `list_domains` function implements the core logic of the 'list-domains' tool. It executes the `defaults domains` subprocess command, parses the comma-separated output into a list of stripped domain names, and returns it formatted as TextContent.
def list_domains() -> list[types.TextContent]: # get array of domains: # run command `defaults domains` result = subprocess.run(["defaults", "domains"], capture_output=True) domains = result.stdout.decode("utf-8").split(",") domains = [domain.strip() for domain in domains] return [types.TextContent(type="text", text=f"Domains: {domains}")] - src/mcp_server_macos_defaults/server.py:104-111 (registration)The 'list-domains' tool is registered within the `handle_list_tools` function, specifying its name, description, and input schema.
types.Tool( name="list-domains", description="List all available macOS domains, same as `defaults domains`", inputSchema= { "type": "object", "properties": {}, }, # TODO filter domains? ), - Input schema for the 'list-domains' tool, defining an empty object with no properties since the tool requires no arguments.
inputSchema= { "type": "object", "properties": {}, }, # TODO filter domains? - Dispatch logic in the `handle_call_tool` function that routes calls to 'list-domains' to the `list_domains` implementation.
if name == "list-domains": return list_domains()