network_service_details
Retrieve IP address, subnet mask, and router details for a specified macOS network service to diagnose connectivity or verify configuration.
Instructions
Retrieve interface details (IP, subnet, router) for a network service.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| service_name | Yes |
Implementation Reference
- macos_tools_mcp/server.py:43-46 (registration)Registers the network_service_details tool with FastMCP @app.tool decorator, specifying name and description.@app.tool( name="network_service_details", description="Retrieve interface details (IP, subnet, router) for a network service.", )
- macos_tools_mcp/server.py:47-59 (handler)Primary handler function for the tool. Validates the service_name input, checks against available services, and delegates to the core implementation in tools.py.def network_service_details(service_name: str, _: Context | None = None) -> str: service = service_name.strip() if not service: raise ToolError("Provide the name of a network service to inspect") available = set(tools.available_network_services()) if available and service not in available: raise ToolError( "Unknown network service. Choose one of: " + ", ".join(sorted(available)) ) return tools.network_service_details(service)
- macos_tools_mcp/tools.py:81-86 (handler)Core implementation of network_service_details. Executes the `networksetup -getinfo {service_name}` command via _run_command utility.def network_service_details(service_name: str) -> str: """Return interface details for a given network service.""" if not service_name.strip(): raise ToolError("Network service name must not be empty") return _run_command(["networksetup", "-getinfo", service_name])
- macos_tools_mcp/tools.py:110-120 (helper)Helper function used by the handler to retrieve and parse available network services for validation.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