tauri_ipc_emit_event
Emit Tauri events to test event handlers in Tauri v2 applications. Use this tool to verify IPC communication and event-driven functionality during development and debugging.
Instructions
[Tauri Apps Only] Emit a Tauri event to test event handlers. Requires active tauri_driver_session. Events are Tauri-specific (not DOM events). For browser DOM events, use Chrome DevTools MCP instead.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| eventName | Yes | ||
| payload | No | ||
| appIdentifier | No | App port or bundle ID to target. Defaults to the only connected app or the default app if multiple are connected. |
Implementation Reference
- packages/mcp-server/src/tools-registry.ts:546-565 (registration)Registration of the 'tauri_ipc_emit_event' tool, linking schema and handler function{ name: 'tauri_ipc_emit_event', description: '[Tauri Apps Only] Emit a Tauri event to test event handlers. ' + 'Requires active tauri_driver_session. Events are Tauri-specific (not DOM events). ' + 'For browser DOM events, use Chrome DevTools MCP instead.', category: TOOL_CATEGORIES.IPC_PLUGIN, schema: EmitTestEventSchema, annotations: { title: 'Emit Tauri Event', readOnlyHint: false, destructiveHint: false, openWorldHint: false, }, handler: async (args) => { const parsed = EmitTestEventSchema.parse(args); return await emitTestEvent(parsed.eventName, parsed.payload, parsed.appIdentifier); }, },
- Zod schema for input validation of the tauri_ipc_emit_event toolexport const EmitTestEventSchema = z.object({ eventName: z.string(), payload: z.unknown(), 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.' ), });
- Handler function that executes the tool: emits the event via IPC to the Tauri MCP bridge pluginexport async function emitTestEvent(eventName: string, payload: unknown, appIdentifier?: string | number): Promise<string> { try { const result = await executeIPCCommand({ command: 'plugin:mcp-bridge|emit_event', args: { eventName, payload, }, appIdentifier, }); const parsed = JSON.parse(result); if (!parsed.success) { throw new Error(parsed.error || 'Unknown error'); } return JSON.stringify(parsed.result); } catch(error: unknown) { const message = error instanceof Error ? error.message : String(error); throw new Error(`Failed to emit event: ${message}`); } }