Skip to main content
Glama

list_windows

Read-only

Lists visible macOS windows with app details, titles, IDs, positions, sizes, and states. Filter windows by application name using fuzzy matching.

Instructions

List visible windows with their app name, title, ID, position, size, and minimized state. Optionally filter by application name. App name supports fuzzy matching (case-insensitive, partial names like 'chrome' for 'Google Chrome').

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
appNoApplication name to filter by. If omitted, list windows from all applications.

Implementation Reference

  • The handler function responsible for processing the 'list_windows' tool request, which uses `runInputHelper` to communicate with the system.
    /** Handle list_windows tool call. */
    async function handleListWindows(
      args: Record<string, unknown>,
    ): Promise<CallToolResult> {
      const parsed = ListWindowsInputSchema.parse(args);
      const app = parsed.app ? await resolveAppName(parsed.app) : undefined;
      const response = await runInputHelper("list_windows", app ? { app } : {});
      const result = ListWindowsResponseSchema.parse(response);
    
      const windows: WindowInfo[] = result.windows.map((w) => ({
        app: w.app,
        title: w.title,
        id: w.id,
        position: { x: w.x, y: w.y },
        size: { w: w.width, h: w.height },
        minimized: w.minimized,
      }));
    
      return {
        content: [
          {
            type: "text" as const,
            text: JSON.stringify({ windows }, null, 2),
          },
        ],
      };
    }
  • Zod schema for validating the response returned by the 'list_windows' helper.
    /** Schema for validating the Swift helper list_windows response. */
    export const ListWindowsResponseSchema = z.object({
      success: z.boolean(),
      windows: z.array(
        z.object({
          app: z.string(),
          title: z.string(),
          id: z.number(),
          x: z.number(),
          y: z.number(),
          width: z.number(),
          height: z.number(),
          minimized: z.boolean(),
        }),
      ),
    });
  • Registration of the 'list_windows' tool definition in `windowToolDefinitions`.
    {
      name: "list_windows",
      description:
        "List visible windows with their app name, title, ID, position, size, and minimized state. Optionally filter by application name. App name supports fuzzy matching (case-insensitive, partial names like 'chrome' for 'Google Chrome').",
      inputSchema: zodToToolInputSchema(ListWindowsInputSchema),
      annotations: {
        readOnlyHint: true,
        destructiveHint: false,
      },
    },
Behavior4/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, covering safety. The description adds valuable behavioral context beyond annotations: it specifies what data is returned (app name, title, ID, position, size, minimized state), explains the optional filtering capability, and details the fuzzy matching behavior (case-insensitive, partial name matching).

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?

Two sentences with zero waste. The first sentence front-loads the core purpose and data returned. The second sentence efficiently explains the optional filtering and fuzzy matching behavior. Every word earns its place.

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

Completeness4/5

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

For a read-only list tool with good annotations and full schema coverage, the description is nearly complete. It explains what data is returned and filtering behavior. The main gap is lack of output schema, so the description doesn't specify return format structure, but this is reasonable given the tool's simplicity.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already fully documents the single parameter 'app'. The description adds marginal value by mentioning 'Optionally filter by application name' and explaining fuzzy matching, but doesn't provide additional semantic context beyond what's in the schema description field.

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 verb ('List') and resource ('visible windows') with specific attributes returned (app name, title, ID, position, size, minimized state). It distinguishes from siblings like 'focus_window' or 'get_ui_elements' by focusing on window enumeration rather than interaction or element retrieval.

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 provides clear context for when to use the optional filter ('Optionally filter by application name') and explains fuzzy matching behavior. However, it doesn't explicitly state when NOT to use this tool versus alternatives like 'get_ui_elements' or 'focus_window' for different window-related tasks.

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/antbotlab/mac-use-mcp'

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