Skip to main content
Glama
Radek44
by Radek44

execute_tauri_command

Execute Tauri IPC commands to automate desktop application testing and interactions through natural language, enabling AI-driven control of app functions without manual scripting.

Instructions

Execute a Tauri IPC command. The command must be exposed in the Tauri app's src-tauri/src/main.rs file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYesName of the Tauri command to execute
argsNoArguments to pass to the command

Implementation Reference

  • The MCP tool handler function that receives parameters and delegates to the TauriDriver's executeTauriCommand method, returning a standardized ToolResponse.
    export async function executeTauriCommand( driver: TauriDriver, params: ExecuteTauriCommandParams ): Promise<ToolResponse<{ result: unknown }>> { try { const result = await driver.executeTauriCommand(params.command, params.args); return { success: true, data: { result, }, }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error), }; } }
  • Core implementation in TauriDriver class that executes the Tauri IPC command by injecting JavaScript to call window.__TAURI__.invoke.
    async executeTauriCommand(command: string, args: Record<string, unknown> = {}): Promise<unknown> { this.ensureAppRunning(); try { // Execute JavaScript in the Tauri window to call the command const result = await this.appState.browser!.execute( (cmd: string, cmdArgs: Record<string, unknown>) => { // @ts-ignore - Tauri's invoke function is injected globally return window.__TAURI__?.invoke(cmd, cmdArgs); }, command, args ); return result; } catch (error) { throw new Error(`Failed to execute Tauri command '${command}': ${error instanceof Error ? error.message : String(error)}`); } }
  • src/index.ts:310-320 (registration)
    Dispatch handler in the MCP CallToolRequestHandler that invokes the tool's handler function.
    case 'execute_tauri_command': { const result = await executeTauriCommand(driver, args as any); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
  • Tool metadata and input schema exposed in the MCP ListToolsRequestHandler response.
    { name: 'execute_tauri_command', description: 'Execute a Tauri IPC command. The command must be exposed in the Tauri app\'s src-tauri/src/main.rs file.', inputSchema: { type: 'object', properties: { command: { type: 'string', description: 'Name of the Tauri command to execute', }, args: { type: 'object', description: 'Arguments to pass to the command', additionalProperties: true, }, }, required: ['command'], }, },
  • TypeScript interface defining the parameters for the execute_tauri_command tool.
    export interface ExecuteTauriCommandParams { /** Command name to execute */ command: string; /** Arguments to pass to the command */ args?: Record<string, unknown>; }

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/Radek44/mcp-tauri-automation'

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