network_services
List configured network services on macOS to view current network setup and diagnose connectivity issues.
Instructions
List configured network services as reported by networksetup.
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": "network_services"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- macos_tools_mcp/server.py:35-38 (registration)Registers the 'network_services' tool with FastMCP using @app.tool decorator.
@app.tool( name="network_services", description="List configured network services as reported by `networksetup`.", ) - macos_tools_mcp/server.py:39-40 (handler)Handler function for the network_services tool. Converts the iterable from tools.available_network_services() to a list.
def network_services(_: Context | None = None) -> list[str]: return list(tools.available_network_services()) - macos_tools_mcp/tools.py:76-78 (helper)Low-level helper that runs the `networksetup -listallnetworkservices` command and returns its stdout.
def network_services() -> str: """Return all configured network services via ``networksetup``.""" return _run_command(["networksetup", "-listallnetworkservices"]) - macos_tools_mcp/tools.py:110-119 (helper)Helper that parses the raw output from network_services(), filters and sanitizes lines to yield available network service names.
def available_network_services() -> Iterable[str]: """Helper that returns the list of network services, skipping blank lines.""" output = network_services() for line in output.splitlines(): line = line.strip() if not line or line.startswith("An asterisk"): continue sanitized = line.lstrip('* ').strip() if sanitized: yield sanitized