get_app_state
Retrieve the current application state, including running status, session information, and page details for Tauri desktop application automation and testing.
Instructions
Get the current state of the application, including whether it's running, session info, and page details
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/launch.ts:60-99 (handler)Main tool handler: Fetches app state from driver, adds page title and URL if running, returns ToolResponse.export async function getAppState( driver: TauriDriver ): Promise<ToolResponse<{ isRunning: boolean; appPath?: string; sessionId?: string; pageTitle?: string; pageUrl?: string; }>> { try { const state = driver.getAppState(); let pageTitle: string | undefined; let pageUrl: string | undefined; if (state.isRunning) { try { pageTitle = await driver.getPageTitle(); pageUrl = await driver.getPageUrl(); } catch (error) { // Ignore errors getting page info } } return { success: true, data: { isRunning: state.isRunning, appPath: state.appPath, sessionId: state.sessionId, pageTitle, pageUrl, }, }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : String(error), }; } }
- src/index.ts:191-198 (schema)Tool schema registration: Defines name, description, and empty input schema in ListTools response.{ name: 'get_app_state', description: 'Get the current state of the application, including whether it\'s running, session info, and page details', inputSchema: { type: 'object', properties: {}, }, },
- src/index.ts:322-332 (registration)Tool dispatch registration: Switch case in CallToolRequestHandler that invokes the getAppState handler.case 'get_app_state': { const result = await getAppState(driver); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
- src/tauri-driver.ts:204-212 (helper)Core helper: TauriDriver.getAppState() returns the internal app state.getAppState(): Readonly<AppState> { return { isRunning: this.appState.isRunning, browser: this.appState.browser, processId: this.appState.processId, appPath: this.appState.appPath, sessionId: this.appState.sessionId, }; }