Skip to main content
Glama

tauri_manage_window

Idempotent

Manage Tauri application windows by listing available windows, retrieving detailed window information, or resizing windows to specific dimensions using logical or physical pixels.

Instructions

[Tauri Apps Only] Manage Tauri windows. Actions: "list" - List all windows with labels, titles, URLs, and state. "info" - Get detailed info for a window (size, position, title, focus, visibility). "resize" - Resize a window (requires width/height, uses logical pixels by default). Requires active tauri_driver_session. For browser windows, use Chrome DevTools MCP instead.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesAction: "list" all windows, get "info" for one window, or "resize" a window
windowIdNoWindow label to target (defaults to "main"). Required for "info", optional for "resize"
widthNoWidth in pixels (required for "resize" action)
heightNoHeight in pixels (required for "resize" action)
logicalNoUse logical pixels (true, default) or physical pixels (false). Only for "resize"
appIdentifierNoApp port or bundle ID to target. Defaults to the only connected app or the default app if multiple are connected.

Implementation Reference

  • Main handler function for the tauri_manage_window tool. Dispatches to list, info, or resize actions by sending WebSocket commands to the MCP Bridge plugin in the Tauri app.
    export async function manageWindow(options: {
       action: 'list' | 'info' | 'resize';
       windowId?: string;
       width?: number;
       height?: number;
       logical?: boolean;
       appIdentifier?: string | number;
    }): Promise<string> {
       const { action, windowId, width, height, logical, appIdentifier } = options;
    
       switch (action) {
          case 'list': {
             return listWindows(appIdentifier);
          }
    
          case 'info': {
             try {
                const client = await ensureSessionAndConnect(appIdentifier);
    
                const response = await client.sendCommand({
                   command: 'get_window_info',
                   args: { windowId },
                });
    
                if (!response.success) {
                   throw new Error(response.error || 'Unknown error');
                }
    
                return JSON.stringify(response.data);
             } catch(error: unknown) {
                const message = error instanceof Error ? error.message : String(error);
    
                throw new Error(`Failed to get window info: ${message}`);
             }
          }
    
          case 'resize': {
             if (width === undefined || height === undefined) {
                throw new Error('width and height are required for resize action');
             }
    
             return resizeWindow({ width, height, windowId, logical, appIdentifier });
          }
    
          default: {
             throw new Error(`Unknown action: ${action}`);
          }
       }
    }
  • Zod schema for validating inputs to the tauri_manage_window tool, defining actions list/info/resize and parameters.
    export const ManageWindowSchema = z.object({
       action: z.enum([ 'list', 'info', 'resize' ])
          .describe('Action: "list" all windows, get "info" for one window, or "resize" a window'),
       windowId: z.string().optional()
          .describe('Window label to target (defaults to "main"). Required for "info", optional for "resize"'),
       width: z.number().int().positive().optional()
          .describe('Width in pixels (required for "resize" action)'),
       height: z.number().int().positive().optional()
          .describe('Height in pixels (required for "resize" action)'),
       logical: z.boolean().optional().default(true)
          .describe('Use logical pixels (true, default) or physical pixels (false). Only for "resize"'),
       appIdentifier: z.union([ z.string(), z.number() ]).optional().describe(
          'App port or bundle ID to target. Defaults to the only connected app or the default app if multiple are connected.'
       ),
    });
  • Tool registration in the central TOOLS array, defining metadata, schema, annotations, and handler that parses args and calls manageWindow.
    {
       name: 'tauri_manage_window',
       description:
          '[Tauri Apps Only] Manage Tauri windows. Actions: ' +
          '"list" - List all windows with labels, titles, URLs, and state. ' +
          '"info" - Get detailed info for a window (size, position, title, focus, visibility). ' +
          '"resize" - Resize a window (requires width/height, uses logical pixels by default). ' +
          'Requires active tauri_driver_session. ' +
          'For browser windows, use Chrome DevTools MCP instead.',
       category: TOOL_CATEGORIES.UI_AUTOMATION,
       schema: ManageWindowSchema,
       annotations: {
          title: 'Manage Tauri Window',
          readOnlyHint: false,
          destructiveHint: false,
          idempotentHint: true,
          openWorldHint: false,
       },
       handler: async (args) => {
          const parsed = ManageWindowSchema.parse(args);
    
          return await manageWindow(parsed);
       },
    },
  • Helper function called by manageWindow for 'list' action, sends 'list_windows' command to plugin.
    export async function listWindows(appIdentifier?: string | number): Promise<string> {
       try {
          const client = await ensureSessionAndConnect(appIdentifier);
    
          const response = await client.sendCommand({
             command: 'list_windows',
          });
    
          if (!response.success) {
             throw new Error(response.error || 'Unknown error');
          }
    
          const windows = response.data as unknown[];
    
          return JSON.stringify({
             windows,
             defaultWindow: 'main',
             totalCount: windows.length,
          });
       } catch(error: unknown) {
          const message = error instanceof Error ? error.message : String(error);
    
          throw new Error(`Failed to list windows: ${message}`);
       }
    }
  • Helper function called by manageWindow for 'resize' action, sends 'resize_window' command to plugin.
    export async function resizeWindow(options: {
       width: number;
       height: number;
       windowId?: string;
       logical?: boolean;
       appIdentifier?: string | number;
    }): Promise<string> {
       try {
          const client = await ensureSessionAndConnect(options.appIdentifier);
    
          const response = await client.sendCommand({
             command: 'resize_window',
             args: {
                width: options.width,
                height: options.height,
                windowId: options.windowId,
                logical: options.logical ?? true,
             },
          });
    
          if (!response.success) {
             throw new Error(response.error || 'Unknown error');
          }
    
          return JSON.stringify(response.data);
       } catch(error: unknown) {
          const message = error instanceof Error ? error.message : String(error);
    
          throw new Error(`Failed to resize window: ${message}`);
       }
    }
Behavior4/5

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

The description adds valuable behavioral context beyond what annotations provide. While annotations indicate non-read-only, non-destructive, and idempotent operations, the description adds specific constraints: the tool only works for Tauri apps (not browser windows), requires an active driver session, and specifies default behavior for 'logical' pixels in resize operations. This provides practical implementation guidance that annotations don't cover.

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 efficiently structured and front-loaded with the core purpose. Each sentence serves a clear purpose: establishing scope, listing actions, specifying requirements, and providing alternatives. There's no wasted text, and the information is presented in a logical flow from general to specific.

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 tool with 6 parameters, no output schema, and comprehensive annotations, the description provides good contextual completeness. It covers scope limitations, prerequisites, action specifics, and alternatives. The main gap is the lack of information about return values or output format, which would be helpful given no output schema exists. However, the description does well given the tool's complexity and annotation coverage.

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?

With 100% schema description coverage, the schema already documents all parameters thoroughly. The description mentions that resize 'requires width/height, uses logical pixels by default' which aligns with but doesn't significantly expand upon schema information. It also mentions the 'appIdentifier' default behavior, but this is already covered in the schema. The description adds minimal value beyond the comprehensive schema.

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 purpose: 'Manage Tauri windows' with specific actions (list, info, resize) and distinguishes it from sibling tools by explicitly stating '[Tauri Apps Only]' and directing users to 'use Chrome DevTools MCP instead' for browser windows. It provides a verb+resource+scope combination that is specific and differentiated.

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

Usage Guidelines5/5

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

The description provides explicit usage guidance: it specifies when to use this tool ('[Tauri Apps Only]', 'Requires active tauri_driver_session') and when not to use it ('For browser windows, use Chrome DevTools MCP instead'). It also distinguishes from sibling tools by mentioning the prerequisite session tool and the alternative for browser contexts.

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/hypothesi/mcp-server-tauri'

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