Skip to main content
Glama

da_window_focus

Focus a target OS window by handle or title substring, optionally narrowed by PID, so subsequent mouse and keyboard actions land on it.

Instructions

Bring a top-level OS window to the foreground so subsequent da_click / da_type / da_key land on it. Resolves the window either by hwnd (exact match) or by a case-insensitive substring of its title (optionally narrowed by pid). bringToTop: true (default) also calls SetWindowPos(HWND_TOP) on Windows so the window is at the top of the Z-order. Returns { hwnd, pid, title, foreground } where foreground: false indicates the OS refused the foreground change (e.g. another process holds the foreground lock on Windows). Throws NOT_FOUND when no visible window matches. Linux requires wmctrl on PATH; macOS uses osascript; Windows uses PowerShell + Win32 SetForegroundWindow.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pidNo
hwndNo
titleNo
bringToTopNo
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description fully discloses behavioral traits: use of SetWindowPos, foreground failure indication via the `foreground` flag, NOT_FOUND error, and OS-specific dependencies (wmctrl, osascript, PowerShell). This exceeds the minimum needed for safe usage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is dense but every sentence earns its place: purpose, resolution, default, return value, error, and OS notes. It is well-structured and appropriately sized for the tool's complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has no output schema, but the description explicitly includes the return object shape and key semantics. Combined with error and environment details, the agent has everything needed to invoke and interpret the result.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, but the description compensates fully by explaining how each parameter is used: hwnd exact match, title case-insensitive substring, pid as optional narrowing, and bringToTop default behavior. This gives agents critical semantic understanding beyond raw types.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's verb and resource: 'Bring a top-level OS window to the foreground' with an explicit purpose of directing subsequent da_click/da_type/da_key. It also distinguishes itself from sibling tools like da_window_list by focusing on bringing to foreground rather than enumerating windows.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives clear context for when to use this tool (before input actions) and explains resolution by hwnd/title/pid. It does not explicitly mention alternatives or when not to use, but the usage scenario is strongly implied, qualifying as 'clear context, no exclusions'.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/cioinside/da-mcp'

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