@@ -8,6 +8,7 @@ import { registerSession, closeSession } from '../session/lifecycle';
88import { localBrowserProvider } from '../providers/local-browser.provider' ;
99import { localAppiumProvider } from '../providers/local-appium.provider' ;
1010import type { SessionMetadata } from '../session/state' ;
11+ import { coerceBoolean } from '../utils/zod-helpers' ;
1112
1213const platformEnum = z . enum ( [ 'browser' , 'ios' , 'android' ] ) ;
1314const browserEnum = z . enum ( [ 'chrome' , 'firefox' , 'edge' , 'safari' ] ) ;
@@ -19,22 +20,22 @@ export const startSessionToolDefinition: ToolDefinition = {
1920 inputSchema : {
2021 platform : platformEnum . describe ( 'Session platform type' ) ,
2122 browser : browserEnum . optional ( ) . describe ( 'Browser to launch (required for browser platform)' ) ,
22- headless : z . boolean ( ) . optional ( ) . default ( true ) . describe ( 'Run browser in headless mode (default: true)' ) ,
23+ headless : coerceBoolean . optional ( ) . default ( true ) . describe ( 'Run browser in headless mode (default: true)' ) ,
2324 windowWidth : z . number ( ) . min ( 400 ) . max ( 3840 ) . optional ( ) . default ( 1920 ) . describe ( 'Browser window width' ) ,
2425 windowHeight : z . number ( ) . min ( 400 ) . max ( 2160 ) . optional ( ) . default ( 1080 ) . describe ( 'Browser window height' ) ,
2526 deviceName : z . string ( ) . optional ( ) . describe ( 'Mobile device/emulator/simulator name (required for ios/android)' ) ,
2627 platformVersion : z . string ( ) . optional ( ) . describe ( 'OS version (e.g., "17.0", "14")' ) ,
2728 appPath : z . string ( ) . optional ( ) . describe ( 'Path to app file (.app/.apk/.ipa)' ) ,
2829 automationName : automationEnum . optional ( ) . describe ( 'Automation driver' ) ,
29- autoGrantPermissions : z . boolean ( ) . optional ( ) . describe ( 'Auto-grant app permissions (default: true)' ) ,
30- autoAcceptAlerts : z . boolean ( ) . optional ( ) . describe ( 'Auto-accept alerts (default: true)' ) ,
31- autoDismissAlerts : z . boolean ( ) . optional ( ) . describe ( 'Auto-dismiss alerts (default: false)' ) ,
30+ autoGrantPermissions : coerceBoolean . optional ( ) . describe ( 'Auto-grant app permissions (default: true)' ) ,
31+ autoAcceptAlerts : coerceBoolean . optional ( ) . describe ( 'Auto-accept alerts (default: true)' ) ,
32+ autoDismissAlerts : coerceBoolean . optional ( ) . describe ( 'Auto-dismiss alerts (default: false)' ) ,
3233 appWaitActivity : z . string ( ) . optional ( ) . describe ( 'Activity to wait for on Android launch' ) ,
3334 udid : z . string ( ) . optional ( ) . describe ( 'Unique Device Identifier for iOS real device' ) ,
34- noReset : z . boolean ( ) . optional ( ) . describe ( 'Preserve app data between sessions' ) ,
35- fullReset : z . boolean ( ) . optional ( ) . describe ( 'Uninstall app before/after session' ) ,
35+ noReset : coerceBoolean . optional ( ) . describe ( 'Preserve app data between sessions' ) ,
36+ fullReset : coerceBoolean . optional ( ) . describe ( 'Uninstall app before/after session' ) ,
3637 newCommandTimeout : z . number ( ) . min ( 0 ) . optional ( ) . default ( 300 ) . describe ( 'Appium command timeout in seconds' ) ,
37- attach : z . boolean ( ) . optional ( ) . default ( false ) . describe ( 'Attach to existing Chrome instead of launching' ) ,
38+ attach : coerceBoolean . optional ( ) . default ( false ) . describe ( 'Attach to existing Chrome instead of launching' ) ,
3839 port : z . number ( ) . optional ( ) . default ( 9222 ) . describe ( 'Chrome remote debugging port (for attach mode)' ) ,
3940 host : z . string ( ) . optional ( ) . default ( 'localhost' ) . describe ( 'Chrome host (for attach mode)' ) ,
4041 appiumHost : z . string ( ) . optional ( ) . describe ( 'Appium server hostname' ) ,
@@ -77,7 +78,7 @@ export const closeSessionToolDefinition: ToolDefinition = {
7778 name : 'close_session' ,
7879 description : 'Closes or detaches from the current browser or app session' ,
7980 inputSchema : {
80- detach : z . boolean ( ) . optional ( ) . describe ( 'If true, disconnect without terminating (preserves app state). Default: false' ) ,
81+ detach : coerceBoolean . optional ( ) . describe ( 'If true, disconnect without terminating (preserves app state). Default: false' ) ,
8182 } ,
8283} ;
8384
0 commit comments