tauri_ipc_monitor
Monitor IPC calls between frontend and Rust backend in Tauri applications to capture invoke() calls and responses for debugging purposes.
Instructions
[Tauri Apps Only] Monitor Tauri IPC calls between frontend and Rust backend. Requires active tauri_driver_session. Captures invoke() calls and responses. This is Tauri-specific; for browser network monitoring, use Chrome DevTools MCP.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | Action to perform: start or stop IPC monitoring | |
| 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
- Core handler functions for 'tauri_ipc_monitor': manageIPCMonitoring dispatches start/stop actions, which send specific commands to the Tauri MCP Bridge plugin via executeIPCCommand to enable/disable IPC traffic monitoring.export const ManageIPCMonitoringSchema = z.object({ action: z.enum([ 'start', 'stop' ]).describe('Action to perform: start or stop IPC monitoring'), 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.' ), }); // Keep individual schemas for backward compatibility if needed export const StartIPCMonitoringSchema = z.object({}); export const StopIPCMonitoringSchema = z.object({}); export async function manageIPCMonitoring(action: 'start' | 'stop', appIdentifier?: string | number): Promise<string> { if (action === 'start') { return startIPCMonitoring(appIdentifier); } return stopIPCMonitoring(appIdentifier); } export async function startIPCMonitoring(appIdentifier?: string | number): Promise<string> { try { const result = await executeIPCCommand({ command: 'plugin:mcp-bridge|start_ipc_monitor', 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 start IPC monitoring: ${message}`); } } export async function stopIPCMonitoring(appIdentifier?: string | number): Promise<string> { try { const result = await executeIPCCommand({ command: 'plugin:mcp-bridge|stop_ipc_monitor', 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 stop IPC monitoring: ${message}`); } }
- Input validation schema for the 'tauri_ipc_monitor' tool, specifying 'action' ('start' or 'stop') and optional target app.export const ManageIPCMonitoringSchema = z.object({ action: z.enum([ 'start', 'stop' ]).describe('Action to perform: start or stop IPC monitoring'), 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.' ), });
- packages/mcp-server/src/tools-registry.ts:504-524 (registration)Tool registration entry for 'tauri_ipc_monitor' in the central tools registry, linking schema, handler, description, and annotations.{ name: 'tauri_ipc_monitor', description: '[Tauri Apps Only] Monitor Tauri IPC calls between frontend and Rust backend. ' + 'Requires active tauri_driver_session. Captures invoke() calls and responses. ' + 'This is Tauri-specific; for browser network monitoring, use Chrome DevTools MCP.', category: TOOL_CATEGORIES.IPC_PLUGIN, schema: ManageIPCMonitoringSchema, annotations: { title: 'Monitor Tauri IPC', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false, }, handler: async (args) => { const parsed = ManageIPCMonitoringSchema.parse(args); return await manageIPCMonitoring(parsed.action, parsed.appIdentifier); }, },
- Shared helper function used by IPC monitoring handlers to execute arbitrary Tauri IPC commands via the WebSocket connection to the MCP Bridge plugin.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 }); } }