network_service_details
Retrieve IP address, subnet mask, and router information for specific macOS network services to diagnose connectivity issues and verify network 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:47-59 (handler)The FastMCP tool handler for network_service_details, which validates the input service name against available network services and delegates to the tools module implementation.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 (helper)Core helper function that executes the 'networksetup -getinfo' command to retrieve the network service details.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/server.py:43-46 (registration)Registration of 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/tools.py:110-120 (helper)Helper function that parses output from network_services() to yield clean list of available network service names, used for validation in the tool handler.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