Skip to main content
Glama
Zhuoli

macOS Tools MCP Server

by Zhuoli

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
NameRequiredDescriptionDefault
service_nameYes

Implementation Reference

  • 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.",
    )
  • 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)
  • 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])
  • 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

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/Zhuoli/mcp101'

If you have feedback or need assistance with the MCP directory API, please join our Discord server