get_app_state
Retrieve current application state including running status, session information, and page details for Tauri desktop application testing and automation workflows.
Instructions
Get the current state of the application, including whether it's running, session info, and page details
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"type": "object"
}
Implementation Reference
- src/tools/launch.ts:60-99 (handler)Main tool handler: exports async getAppState which fetches app state from driver, adds page title/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:322-332 (registration)Registration in CallToolRequestSchema handler: switch case that calls the getAppState tool handler.case 'get_app_state': { const result = await getAppState(driver); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
- src/index.ts:191-198 (schema)Tool schema: definition in ListToolsRequestSchema response, no input params required.{ 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/tauri-driver.ts:204-212 (helper)Helper method on TauriDriver: returns the internal app state object.getAppState(): Readonly<AppState> { return { isRunning: this.appState.isRunning, browser: this.appState.browser, processId: this.appState.processId, appPath: this.appState.appPath, sessionId: this.appState.sessionId, }; }
- src/index.ts:17-17 (registration)Import of the getAppState tool handler.import { launchApp, closeApp, getAppState } from './tools/launch.js';