wake_on_lan
Wake a remote computer from sleep by sending a magic packet to its MAC address. Specify optional broadcast address for network delivery.
Instructions
Send a Wake-on-LAN magic packet to a MAC address.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mac | Yes | ||
| broadcast | No | 255.255.255.255 |
Implementation Reference
- src/mcp_nettools/server.py:110-117 (handler)The handler function for the wake_on_lan MCP tool. Accepts a MAC address and optional broadcast IP, delegates to the wakeonlan library's send_magic_packet, and returns a dict indicating success or error.
@mcp.tool() def wake_on_lan(mac: str, broadcast: str = "255.255.255.255") -> dict: """Send a Wake-on-LAN magic packet to a MAC address.""" try: send_magic_packet(mac, ip_address=broadcast) return {"mac": mac, "broadcast": broadcast, "sent": True} except Exception as e: return {"error": str(e), "tool": "wake_on_lan", "mac": mac} - src/mcp_nettools/server.py:110-110 (registration)Registration of the wake_on_lan function as an MCP tool via the @mcp.tool() decorator on the FastMCP instance. This is the registration point.
@mcp.tool() - src/mcp_nettools/server.py:111-111 (schema)The function signature defines the input schema: mac (str, required) and broadcast (str, optional with default '255.255.255.255'). The return type is dict.
def wake_on_lan(mac: str, broadcast: str = "255.255.255.255") -> dict: - src/mcp_nettools/server.py:14-14 (helper)Import of the external wakeonlan library's send_magic_packet function, which is the underlying helper that actually sends the magic packet over the network.
from wakeonlan import send_magic_packet