get_active_window
Retrieve details about the currently focused window in Hyprland desktop environments to enable automated window management and interaction.
Instructions
Get details about the currently focused window.
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": "get_active_window"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- hyprland_mcp/server.py:97-108 (handler)The handler for 'get_active_window' queries the Hyprland active window status via hyprctl and returns a formatted string with window details.
@mcp.tool() async def get_active_window() -> str: """Get details about the currently focused window.""" w = await hyprctl.query("activewindow") if not w or not w.get("class"): return "No window is currently focused." return ( f"Active window: [{w['class']}] \"{w['title']}\"\n" f"Size: {w['size'][0]}x{w['size'][1]}, Position: ({w['at'][0]},{w['at'][1]})\n" f"Workspace: {w['workspace']['name']}, Monitor: {w['monitor']}\n" f"Floating: {w['floating']}, Fullscreen: {w['fullscreen']}" )