list_monitors
Retrieve connected monitor details including resolution, position, and active workspace for managing multi-display setups in Hyprland desktop environments.
Instructions
List all connected monitors with resolution, position, and active workspace.
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": "list_monitors"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- hyprland_mcp/server.py:22-33 (handler)Implementation of the list_monitors tool. It uses hyprctl.query("monitors") to fetch monitor data and formats it into a human-readable string.
@mcp.tool() async def list_monitors() -> str: """List all connected monitors with resolution, position, and active workspace.""" monitors = await hyprctl.query("monitors") lines = [] for m in monitors: lines.append( f"- {m['name']}: {m['width']}x{m['height']}@{m['refreshRate']:.0f}Hz " f"at ({m['x']},{m['y']}), workspace {m['activeWorkspace']['name']}" f"{' [focused]' if m.get('focused') else ''}" ) return "\n".join(lines)