Skip to main content
Glama

tauri_ipc_execute_command

Execute Tauri IPC commands to invoke Rust backend functions from Tauri applications, enabling communication between frontend and backend components.

Instructions

[Tauri Apps Only] Execute Tauri IPC commands (invoke Rust backend functions). Requires active tauri_driver_session. This is Tauri-specific IPC, not browser APIs. For Electron IPC or browser APIs, use appropriate tools for those frameworks.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYes
argsNo
appIdentifierNoApp port or bundle ID to target. Defaults to the only connected app or the default app if multiple are connected.

Implementation Reference

  • Core handler function that executes Tauri IPC commands by connecting to the plugin client via WebSocket and invoking the specified command with arguments.
    export async function executeIPCCommand(options: { command: string; args?: unknown; appIdentifier?: string | number; }): Promise<string> { try { const { command, args = {}, appIdentifier } = options; // Ensure we have an active session and are connected const client = await ensureSessionAndConnect(appIdentifier); // Send IPC command via WebSocket to the mcp-bridge plugin const response = await client.sendCommand({ command: 'invoke_tauri', args: { command, args }, }); if (!response.success) { return JSON.stringify({ success: false, error: response.error || 'Unknown error' }); } return JSON.stringify({ success: true, result: response.data }); } catch(error: unknown) { const message = error instanceof Error ? error.message : String(error); return JSON.stringify({ success: false, error: message }); } }
  • Zod schema defining the input parameters for the tool: command (string), optional args (unknown), and optional appIdentifier (string or number).
    export const ExecuteIPCCommandSchema = z.object({ command: z.string(), args: z.unknown().optional(), 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 definition and registration in the central TOOLS registry array, with inline handler that validates inputs and delegates to executeIPCCommand.
    { name: 'tauri_ipc_execute_command', description: '[Tauri Apps Only] Execute Tauri IPC commands (invoke Rust backend functions). ' + 'Requires active tauri_driver_session. This is Tauri-specific IPC, not browser APIs. ' + 'For Electron IPC or browser APIs, use appropriate tools for those frameworks.', category: TOOL_CATEGORIES.IPC_PLUGIN, schema: ExecuteIPCCommandSchema, annotations: { title: 'Execute Tauri IPC Command', readOnlyHint: false, destructiveHint: false, openWorldHint: false, }, handler: async (args) => { const parsed = ExecuteIPCCommandSchema.parse(args); return await executeIPCCommand({ command: parsed.command, args: parsed.args, appIdentifier: parsed.appIdentifier, }); }, },

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