From cfd3660693e5f7d45ab737c7291345bff125829f Mon Sep 17 00:00:00 2001 From: pespinel Date: Thu, 17 Jul 2025 08:51:35 +0200 Subject: [PATCH 1/3] Add activate_app interaction --- src/tools/index.ts | 2 ++ src/tools/interactions/activateApp.ts | 46 +++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 src/tools/interactions/activateApp.ts diff --git a/src/tools/index.ts b/src/tools/index.ts index 0f96c78..c2cf31a 100644 --- a/src/tools/index.ts +++ b/src/tools/index.ts @@ -11,6 +11,7 @@ import setValue from './interactions/setValue.js'; import getText from './interactions/getText.js'; import screenshot from './interactions/screenshot.js'; import answerAppium from './answerAppium.js'; +import activateApp from './interactions/activateApp.js'; export default function registerTools(server: FastMCP): void { selectPlatform(server); @@ -25,6 +26,7 @@ export default function registerTools(server: FastMCP): void { setValue(server); getText(server); screenshot(server); + activateApp(server); generateTest(server); console.log('All tools registered'); diff --git a/src/tools/interactions/activateApp.ts b/src/tools/interactions/activateApp.ts new file mode 100644 index 0000000..0151396 --- /dev/null +++ b/src/tools/interactions/activateApp.ts @@ -0,0 +1,46 @@ +import { FastMCP } from 'fastmcp/dist/FastMCP.js'; +import { getDriver } from '../sessionStore.js'; +import { z } from 'zod'; + +export default function activateApp(server: FastMCP): void { + const activateAppSchema = z.object({ + id: z.string().describe('The app id'), + }); + + server.addTool({ + name: 'activate_app', + description: 'Activate app by id', + parameters: activateAppSchema, + annotations: { + readOnlyHint: false, + openWorldHint: false, + }, + execute: async (args: { id: string }, context: any): Promise => { + const driver = getDriver(); + if (!driver) { + throw new Error('No driver found'); + } + + try { + await driver.activateApp(args.id); + return { + content: [ + { + type: 'text', + text: `App ${args.id} activated correctly.`, + }, + ], + }; + } catch (err: any) { + return { + content: [ + { + type: 'text', + text: `Error activating the app ${args.id}: ${err.toString()}`, + }, + ], + }; + } + }, + }); +} From 01472fe0b1c30f3fc75fce2b00fed557f7eb40b5 Mon Sep 17 00:00:00 2001 From: pespinel Date: Thu, 17 Jul 2025 11:52:48 +0200 Subject: [PATCH 2/3] Update README --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index aafe78a..cd5b6b9 100644 --- a/README.md +++ b/README.md @@ -136,6 +136,13 @@ Upload a mobile app to LambdaTest cloud storage for testing. - `appPath`: Local path to the app file (APK/IPA) - `appName`: Optional custom name for the app +#### `activate_app` + +Activate the app passed as input + +- **Parameters**: + - `id`: Bundle ID or app-packge + ### Element Interaction #### `generate_locators` From 0fdcd4f71cced8c9a1d186574b2be4a55282efdd Mon Sep 17 00:00:00 2001 From: pespinel Date: Tue, 29 Jul 2025 08:53:14 +0200 Subject: [PATCH 3/3] Ignore Documents json in prettier tests --- .prettierignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.prettierignore b/.prettierignore index d3f3294..3a66a2a 100644 --- a/.prettierignore +++ b/.prettierignore @@ -24,3 +24,6 @@ Thumbs.db # Generated files *.d.ts + +# Documents +src/tools/documentation/uploads/documents.json