appium-mcp 1.52.0 → 1.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +2 -3
- package/dist/tools/context/context.d.ts +3 -0
- package/dist/tools/context/context.d.ts.map +1 -0
- package/dist/tools/context/context.js +127 -0
- package/dist/tools/context/context.js.map +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +2 -4
- package/dist/tools/index.js.map +1 -1
- package/dist/ui/mcp-ui-utils.d.ts.map +1 -1
- package/dist/ui/mcp-ui-utils.js +4 -3
- package/dist/ui/mcp-ui-utils.js.map +1 -1
- package/package.json +1 -1
- package/server.json +2 -2
- package/src/resources/submodules.zip +0 -0
- package/src/tools/README.md +4 -0
- package/src/tools/context/context.ts +160 -0
- package/src/tools/index.ts +2 -4
- package/src/ui/mcp-ui-utils.ts +4 -3
- package/dist/tools/context/get-contexts.d.ts +0 -3
- package/dist/tools/context/get-contexts.d.ts.map +0 -1
- package/dist/tools/context/get-contexts.js +0 -71
- package/dist/tools/context/get-contexts.js.map +0 -1
- package/dist/tools/context/switch-context.d.ts +0 -3
- package/dist/tools/context/switch-context.d.ts.map +0 -1
- package/dist/tools/context/switch-context.js +0 -94
- package/dist/tools/context/switch-context.js.map +0 -1
- package/src/tools/context/get-contexts.ts +0 -98
- package/src/tools/context/switch-context.ts +0 -110
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [1.53.0](https://github.com/appium/appium-mcp/compare/v1.52.0...v1.53.0) (2026-04-10)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* **context:** consolidate context operations into appium_context ([#258](https://github.com/appium/appium-mcp/issues/258)) ([4beb583](https://github.com/appium/appium-mcp/commit/4beb583b69f05030993902c867047c0f47a80837))
|
|
6
|
+
|
|
1
7
|
## [1.52.0](https://github.com/appium/appium-mcp/compare/v1.51.0...v1.52.0) (2026-04-10)
|
|
2
8
|
|
|
3
9
|
### Features
|
package/README.md
CHANGED
|
@@ -273,7 +273,7 @@ The following tools return lightweight text-only responses when NO_UI is enabled
|
|
|
273
273
|
- `generate_locators` - Returns locator data as JSON without interactive UI
|
|
274
274
|
- `select_device` - Returns device list as text without picker UI
|
|
275
275
|
- `create_session` - Returns session info as text without dashboard UI
|
|
276
|
-
- `
|
|
276
|
+
- `appium_context` - Returns context list as text with `action=list` without switcher UI
|
|
277
277
|
- `appium_list_apps` - Returns app list as JSON without interactive UI
|
|
278
278
|
|
|
279
279
|
**When to Enable NO_UI:**
|
|
@@ -315,8 +315,7 @@ The default regex pattern allows any URL that starts with `http://` or `https://
|
|
|
315
315
|
|
|
316
316
|
| Tool | Description |
|
|
317
317
|
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
318
|
-
| `
|
|
319
|
-
| `appium_switch_context` | Switch to a specific context in the Appium session. Use this to switch between native app context (NATIVE_APP) and webview contexts (WEBVIEW_<id> or WEBVIEW_<package>). Use appium_get_contexts to see available contexts first. |
|
|
318
|
+
| `appium_context` | Manage contexts in one tool. `action=list` gets all available contexts including NATIVE_APP and WEBVIEW_* entries. `action=switch` switches to a target context (`context` required). |
|
|
320
319
|
|
|
321
320
|
### Element Discovery & Interaction
|
|
322
321
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/tools/context/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,OAAO,EAAE,MAAM,SAAS,CAAC;AA8BtD,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAiIrD"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { getDriver, isRemoteDriverSession, setCurrentContext, } from '../../session-store.js';
|
|
3
|
+
import { getContexts, getCurrentContext, setContext } from '../../command.js';
|
|
4
|
+
import { createUIResource, createContextSwitcherUI, addUIResourceToResponse, } from '../../ui/mcp-ui-utils.js';
|
|
5
|
+
const contextSchema = z.object({
|
|
6
|
+
action: z
|
|
7
|
+
.enum(['list', 'switch'])
|
|
8
|
+
.describe('Use list to fetch contexts or switch to change context.'),
|
|
9
|
+
context: z
|
|
10
|
+
.string()
|
|
11
|
+
.optional()
|
|
12
|
+
.describe('Required when action is switch. Common values: NATIVE_APP or WEBVIEW_<id>/WEBVIEW_<package>.'),
|
|
13
|
+
sessionId: z
|
|
14
|
+
.string()
|
|
15
|
+
.optional()
|
|
16
|
+
.describe('Session ID to target. If omitted, uses the active session.'),
|
|
17
|
+
});
|
|
18
|
+
export default function context(server) {
|
|
19
|
+
server.addTool({
|
|
20
|
+
name: 'appium_context',
|
|
21
|
+
description: 'Manage Appium contexts with one tool. action=list returns all contexts and current context. action=switch changes to a target context.',
|
|
22
|
+
parameters: contextSchema,
|
|
23
|
+
annotations: {
|
|
24
|
+
readOnlyHint: false,
|
|
25
|
+
openWorldHint: false,
|
|
26
|
+
},
|
|
27
|
+
execute: async (args, _context) => {
|
|
28
|
+
try {
|
|
29
|
+
const driver = getDriver(args.sessionId);
|
|
30
|
+
if (!driver) {
|
|
31
|
+
throw new Error('No driver found. Please create a session first.');
|
|
32
|
+
}
|
|
33
|
+
if (isRemoteDriverSession(driver)) {
|
|
34
|
+
throw new Error('Context management is not yet implemented for the remote driver');
|
|
35
|
+
}
|
|
36
|
+
const [currentContext, availableContexts] = await Promise.all([
|
|
37
|
+
getCurrentContext(driver).catch(() => null),
|
|
38
|
+
getContexts(driver).catch(() => []),
|
|
39
|
+
]);
|
|
40
|
+
if (currentContext) {
|
|
41
|
+
setCurrentContext(currentContext);
|
|
42
|
+
}
|
|
43
|
+
if (args.action === 'list') {
|
|
44
|
+
if (!availableContexts || availableContexts.length === 0) {
|
|
45
|
+
return {
|
|
46
|
+
content: [
|
|
47
|
+
{
|
|
48
|
+
type: 'text',
|
|
49
|
+
text: 'No contexts available.',
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
const textResponse = {
|
|
55
|
+
content: [
|
|
56
|
+
{
|
|
57
|
+
type: 'text',
|
|
58
|
+
text: `Available contexts: ${JSON.stringify(availableContexts, null, 2)}\nCurrent context: ${currentContext}`,
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
};
|
|
62
|
+
const uiResource = createUIResource(`ui://appium-mcp/context-switcher/${Date.now()}`, createContextSwitcherUI(availableContexts, currentContext));
|
|
63
|
+
return addUIResourceToResponse(textResponse, uiResource);
|
|
64
|
+
}
|
|
65
|
+
if (!args.context) {
|
|
66
|
+
throw new Error('context is required when action is switch');
|
|
67
|
+
}
|
|
68
|
+
if (currentContext === args.context) {
|
|
69
|
+
return {
|
|
70
|
+
content: [
|
|
71
|
+
{
|
|
72
|
+
type: 'text',
|
|
73
|
+
text: `Already on context "${args.context}".`,
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
if (!availableContexts || availableContexts.length === 0) {
|
|
79
|
+
return {
|
|
80
|
+
content: [
|
|
81
|
+
{
|
|
82
|
+
type: 'text',
|
|
83
|
+
text: 'No contexts available. Cannot switch context.',
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
isError: true,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
if (!availableContexts.includes(args.context)) {
|
|
90
|
+
return {
|
|
91
|
+
content: [
|
|
92
|
+
{
|
|
93
|
+
type: 'text',
|
|
94
|
+
text: `Context "${args.context}" not found. Available contexts: ${JSON.stringify(availableContexts, null, 2)}`,
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
isError: true,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
await setContext(driver, args.context);
|
|
101
|
+
const newContext = await getCurrentContext(driver);
|
|
102
|
+
setCurrentContext(newContext);
|
|
103
|
+
return {
|
|
104
|
+
content: [
|
|
105
|
+
{
|
|
106
|
+
type: 'text',
|
|
107
|
+
text: `Successfully switched context from "${currentContext}" to "${newContext}".`,
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
catch (err) {
|
|
113
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
114
|
+
return {
|
|
115
|
+
content: [
|
|
116
|
+
{
|
|
117
|
+
type: 'text',
|
|
118
|
+
text: `Failed context action ${args.action}. err: ${message}`,
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
isError: true,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/tools/context/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,SAAS,EACT,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAElC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7B,MAAM,EAAE,CAAC;SACN,IAAI,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;SACxB,QAAQ,CAAC,yDAAyD,CAAC;IACtE,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,8FAA8F,CAC/F;IACH,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,4DAA4D,CAAC;CAC1E,CAAC,CAAC;AAEH,MAAM,CAAC,OAA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gBACJ,CAAC;gBAED,MAAM,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;gBACvC,MAAM,UAAU,GAAG,MAAM,iBAAiB,CAAC,MAAM,CAAC,CAAC;gBACnD,iBAAiB,CAAC,UAAU,CAAC,CAAC;gBAE9B,OAAO;oBACL,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,MAAM;4BACZ,IAAI,EAAE,uCAAuC,cAAc,SAAS,UAAU,IAAI;yBACnF;qBACF;iBACF,CAAC;YACJ,CAAC;YAAC,OAAO,GAAY,EAAE,CAAC;gBACtB,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBACjE,OAAO;oBACL,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,MAAM;4BACZ,IAAI,EAAE,yBAAyB,IAAI,CAAC,MAAM,UAAU,OAAO,EAAE;yBAC9D;qBACF;oBACD,OAAO,EAAE,IAAI;iBACd,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AA6DlC,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAgJ3D"}
|
package/dist/tools/index.js
CHANGED
|
@@ -52,8 +52,7 @@ import queryAppState from './app-management/query-app-state.js';
|
|
|
52
52
|
import clearApp from './app-management/clear-app.js';
|
|
53
53
|
import mobilePermissions from './app-management/permissions.js';
|
|
54
54
|
import deepLink from './app-management/deep-link.js';
|
|
55
|
-
import
|
|
56
|
-
import switchContext from './context/switch-context.js';
|
|
55
|
+
import context from './context/context.js';
|
|
57
56
|
export default function registerTools(server) {
|
|
58
57
|
// Wrap addTool to inject logging around tool execution
|
|
59
58
|
const originalAddTool = server.addTool.bind(server);
|
|
@@ -178,8 +177,7 @@ export default function registerTools(server) {
|
|
|
178
177
|
mobilePermissions(server);
|
|
179
178
|
deepLink(server);
|
|
180
179
|
// Context Management
|
|
181
|
-
|
|
182
|
-
switchContext(server);
|
|
180
|
+
context(server);
|
|
183
181
|
// Test Generation
|
|
184
182
|
generateLocators(server);
|
|
185
183
|
generateTest(server);
|
package/dist/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAeA,OAAO,GAAG,MAAM,cAAc,CAAC;AAC/B,OAAO,YAAY,MAAM,kCAAkC,CAAC;AAC5D,OAAO,YAAY,MAAM,kCAAkC,CAAC;AAC5D,OAAO,aAAa,MAAM,6BAA6B,CAAC;AACxD,OAAO,aAAa,MAAM,6BAA6B,CAAC;AACxD,OAAO,YAAY,MAAM,4BAA4B,CAAC;AACtD,OAAO,aAAa,MAAM,6BAA6B,CAAC;AACxD,OAAO,gBAAgB,MAAM,+BAA+B,CAAC;AAC7D,OAAO,YAAY,MAAM,4BAA4B,CAAC;AACtD,OAAO,iBAAiB,MAAM,iCAAiC,CAAC;AAChE,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EACL,cAAc,EACd,cAAc,EACd,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAClD,OAAO,WAAW,MAAM,2BAA2B,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AQzB"}
|
package/dist/ui/mcp-ui-utils.js
CHANGED
|
@@ -627,8 +627,8 @@ export function createSessionDashboardUI(sessionInfo) {
|
|
|
627
627
|
window.parent.postMessage({
|
|
628
628
|
type: 'tool',
|
|
629
629
|
payload: {
|
|
630
|
-
toolName: '
|
|
631
|
-
params: {}
|
|
630
|
+
toolName: 'appium_context',
|
|
631
|
+
params: { action: 'list' }
|
|
632
632
|
}
|
|
633
633
|
}, '*');
|
|
634
634
|
}
|
|
@@ -1151,8 +1151,9 @@ export function createContextSwitcherUI(contexts, currentContext) {
|
|
|
1151
1151
|
window.parent.postMessage({
|
|
1152
1152
|
type: 'tool',
|
|
1153
1153
|
payload: {
|
|
1154
|
-
toolName: '
|
|
1154
|
+
toolName: 'appium_context',
|
|
1155
1155
|
params: {
|
|
1156
|
+
action: 'switch',
|
|
1156
1157
|
context: contextName
|
|
1157
1158
|
}
|
|
1158
1159
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-ui-utils.js","sourceRoot":"","sources":["../../src/ui/mcp-ui-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAC9B,GAAW,EACX,WAAmB;IASnB,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE;YACR,GAAG;YACH,QAAQ,EAAE,WAAW;YACrB,IAAI,EAAE,WAAW;SAClB;KACF,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAKE,EACF,QAA2B,EAC3B,UAAiC;IAEjC,MAAM,eAAe,GACnB,QAAQ,KAAK,KAAK,IAAI,UAAU;QAC9B,CAAC,CAAC,UAAU,KAAK,WAAW;YAC1B,CAAC,CAAC,gBAAgB;YAClB,CAAC,CAAC,aAAa;QACjB,CAAC,CAAC,iBAAiB,CAAC;IAExB,MAAM,WAAW,GAAG,OAAO;SACxB,GAAG,CACF,CAAC,MAAM,E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|
4
4
|
"title": "MCP Appium - Mobile Development and Automation Server",
|
|
5
5
|
"description": "MCP server for Appium mobile automation on iOS and Android devices with test creation tools.",
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.53.0",
|
|
7
7
|
"packages": [
|
|
8
8
|
{
|
|
9
9
|
"registryType": "npm",
|
|
10
10
|
"identifier": "appium-mcp",
|
|
11
|
-
"version": "1.
|
|
11
|
+
"version": "1.53.0",
|
|
12
12
|
"transport": {
|
|
13
13
|
"type": "stdio"
|
|
14
14
|
}
|
|
Binary file
|
package/src/tools/README.md
CHANGED
|
@@ -71,6 +71,10 @@ When searching for elements, follow this priority order for efficiency:
|
|
|
71
71
|
- `permissions.ts` - Unified mobile permissions (`appium_mobile_permissions`; action get / update / reset, platform-specific fields)
|
|
72
72
|
- `list-apps.ts` - List installed apps
|
|
73
73
|
|
|
74
|
+
### Context Management (`context/`)
|
|
75
|
+
|
|
76
|
+
- `context.ts` - Unified context operations (`appium_context`; `action=list|switch`)
|
|
77
|
+
|
|
74
78
|
### Test Generation (`test-generation/`)
|
|
75
79
|
|
|
76
80
|
- `locators.ts` - Generate page locators
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import type { ContentResult, FastMCP } from 'fastmcp';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import {
|
|
4
|
+
getDriver,
|
|
5
|
+
isRemoteDriverSession,
|
|
6
|
+
setCurrentContext,
|
|
7
|
+
} from '../../session-store.js';
|
|
8
|
+
import { getContexts, getCurrentContext, setContext } from '../../command.js';
|
|
9
|
+
import {
|
|
10
|
+
createUIResource,
|
|
11
|
+
createContextSwitcherUI,
|
|
12
|
+
addUIResourceToResponse,
|
|
13
|
+
} from '../../ui/mcp-ui-utils.js';
|
|
14
|
+
|
|
15
|
+
const contextSchema = z.object({
|
|
16
|
+
action: z
|
|
17
|
+
.enum(['list', 'switch'])
|
|
18
|
+
.describe('Use list to fetch contexts or switch to change context.'),
|
|
19
|
+
context: z
|
|
20
|
+
.string()
|
|
21
|
+
.optional()
|
|
22
|
+
.describe(
|
|
23
|
+
'Required when action is switch. Common values: NATIVE_APP or WEBVIEW_<id>/WEBVIEW_<package>.'
|
|
24
|
+
),
|
|
25
|
+
sessionId: z
|
|
26
|
+
.string()
|
|
27
|
+
.optional()
|
|
28
|
+
.describe('Session ID to target. If omitted, uses the active session.'),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export default function context(server: FastMCP): void {
|
|
32
|
+
server.addTool({
|
|
33
|
+
name: 'appium_context',
|
|
34
|
+
description:
|
|
35
|
+
'Manage Appium contexts with one tool. action=list returns all contexts and current context. action=switch changes to a target context.',
|
|
36
|
+
parameters: contextSchema,
|
|
37
|
+
annotations: {
|
|
38
|
+
readOnlyHint: false,
|
|
39
|
+
openWorldHint: false,
|
|
40
|
+
},
|
|
41
|
+
execute: async (
|
|
42
|
+
args: z.infer<typeof contextSchema>,
|
|
43
|
+
_context: Record<string, unknown> | undefined
|
|
44
|
+
): Promise<ContentResult> => {
|
|
45
|
+
try {
|
|
46
|
+
const driver = getDriver(args.sessionId);
|
|
47
|
+
if (!driver) {
|
|
48
|
+
throw new Error('No driver found. Please create a session first.');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (isRemoteDriverSession(driver)) {
|
|
52
|
+
throw new Error(
|
|
53
|
+
'Context management is not yet implemented for the remote driver'
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const [currentContext, availableContexts] = await Promise.all([
|
|
58
|
+
getCurrentContext(driver).catch(() => null),
|
|
59
|
+
getContexts(driver).catch(() => [] as string[]),
|
|
60
|
+
]);
|
|
61
|
+
|
|
62
|
+
if (currentContext) {
|
|
63
|
+
setCurrentContext(currentContext);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (args.action === 'list') {
|
|
67
|
+
if (!availableContexts || availableContexts.length === 0) {
|
|
68
|
+
return {
|
|
69
|
+
content: [
|
|
70
|
+
{
|
|
71
|
+
type: 'text',
|
|
72
|
+
text: 'No contexts available.',
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const textResponse = {
|
|
79
|
+
content: [
|
|
80
|
+
{
|
|
81
|
+
type: 'text',
|
|
82
|
+
text: `Available contexts: ${JSON.stringify(availableContexts, null, 2)}\nCurrent context: ${currentContext}`,
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const uiResource = createUIResource(
|
|
88
|
+
`ui://appium-mcp/context-switcher/${Date.now()}`,
|
|
89
|
+
createContextSwitcherUI(availableContexts, currentContext)
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
return addUIResourceToResponse(textResponse, uiResource);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (!args.context) {
|
|
96
|
+
throw new Error('context is required when action is switch');
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (currentContext === args.context) {
|
|
100
|
+
return {
|
|
101
|
+
content: [
|
|
102
|
+
{
|
|
103
|
+
type: 'text',
|
|
104
|
+
text: `Already on context "${args.context}".`,
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (!availableContexts || availableContexts.length === 0) {
|
|
111
|
+
return {
|
|
112
|
+
content: [
|
|
113
|
+
{
|
|
114
|
+
type: 'text',
|
|
115
|
+
text: 'No contexts available. Cannot switch context.',
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
isError: true,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (!availableContexts.includes(args.context)) {
|
|
123
|
+
return {
|
|
124
|
+
content: [
|
|
125
|
+
{
|
|
126
|
+
type: 'text',
|
|
127
|
+
text: `Context "${args.context}" not found. Available contexts: ${JSON.stringify(availableContexts, null, 2)}`,
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
isError: true,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
await setContext(driver, args.context);
|
|
135
|
+
const newContext = await getCurrentContext(driver);
|
|
136
|
+
setCurrentContext(newContext);
|
|
137
|
+
|
|
138
|
+
return {
|
|
139
|
+
content: [
|
|
140
|
+
{
|
|
141
|
+
type: 'text',
|
|
142
|
+
text: `Successfully switched context from "${currentContext}" to "${newContext}".`,
|
|
143
|
+
},
|
|
144
|
+
],
|
|
145
|
+
};
|
|
146
|
+
} catch (err: unknown) {
|
|
147
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
148
|
+
return {
|
|
149
|
+
content: [
|
|
150
|
+
{
|
|
151
|
+
type: 'text',
|
|
152
|
+
text: `Failed context action ${args.action}. err: ${message}`,
|
|
153
|
+
},
|
|
154
|
+
],
|
|
155
|
+
isError: true,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
}
|
package/src/tools/index.ts
CHANGED
|
@@ -71,8 +71,7 @@ import queryAppState from './app-management/query-app-state.js';
|
|
|
71
71
|
import clearApp from './app-management/clear-app.js';
|
|
72
72
|
import mobilePermissions from './app-management/permissions.js';
|
|
73
73
|
import deepLink from './app-management/deep-link.js';
|
|
74
|
-
import
|
|
75
|
-
import switchContext from './context/switch-context.js';
|
|
74
|
+
import context from './context/context.js';
|
|
76
75
|
|
|
77
76
|
export default function registerTools(server: FastMCP): void {
|
|
78
77
|
// Wrap addTool to inject logging around tool execution
|
|
@@ -208,8 +207,7 @@ export default function registerTools(server: FastMCP): void {
|
|
|
208
207
|
deepLink(server);
|
|
209
208
|
|
|
210
209
|
// Context Management
|
|
211
|
-
|
|
212
|
-
switchContext(server);
|
|
210
|
+
context(server);
|
|
213
211
|
|
|
214
212
|
// Test Generation
|
|
215
213
|
generateLocators(server);
|
package/src/ui/mcp-ui-utils.ts
CHANGED
|
@@ -675,8 +675,8 @@ export function createSessionDashboardUI(sessionInfo: {
|
|
|
675
675
|
window.parent.postMessage({
|
|
676
676
|
type: 'tool',
|
|
677
677
|
payload: {
|
|
678
|
-
toolName: '
|
|
679
|
-
params: {}
|
|
678
|
+
toolName: 'appium_context',
|
|
679
|
+
params: { action: 'list' }
|
|
680
680
|
}
|
|
681
681
|
}, '*');
|
|
682
682
|
}
|
|
@@ -1225,8 +1225,9 @@ export function createContextSwitcherUI(
|
|
|
1225
1225
|
window.parent.postMessage({
|
|
1226
1226
|
type: 'tool',
|
|
1227
1227
|
payload: {
|
|
1228
|
-
toolName: '
|
|
1228
|
+
toolName: 'appium_context',
|
|
1229
1229
|
params: {
|
|
1230
|
+
action: 'switch',
|
|
1230
1231
|
context: contextName
|
|
1231
1232
|
}
|
|
1232
1233
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-contexts.d.ts","sourceRoot":"","sources":["../../../src/tools/context/get-contexts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAiBlC,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAgFzD"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { getDriver, isRemoteDriverSession, setCurrentContext, } from '../../session-store.js';
|
|
3
|
-
import { createUIResource, createContextSwitcherUI, addUIResourceToResponse, } from '../../ui/mcp-ui-utils.js';
|
|
4
|
-
import { getCurrentContext, getContexts as _getContexts, } from '../../command.js';
|
|
5
|
-
export default function getContexts(server) {
|
|
6
|
-
server.addTool({
|
|
7
|
-
name: 'appium_get_contexts',
|
|
8
|
-
description: 'Get all available contexts in the current Appium session. Returns a list of context names including NATIVE_APP and any webview contexts (e.g., WEBVIEW_<id> or WEBVIEW_<package>).',
|
|
9
|
-
parameters: z.object({
|
|
10
|
-
sessionId: z
|
|
11
|
-
.string()
|
|
12
|
-
.optional()
|
|
13
|
-
.describe('Session ID to target. If omitted, uses the active session.'),
|
|
14
|
-
}),
|
|
15
|
-
annotations: {
|
|
16
|
-
readOnlyHint: true,
|
|
17
|
-
openWorldHint: false,
|
|
18
|
-
},
|
|
19
|
-
execute: async (args, _context) => {
|
|
20
|
-
const driver = getDriver(args.sessionId);
|
|
21
|
-
if (!driver) {
|
|
22
|
-
throw new Error('No driver found. Please create a session first.');
|
|
23
|
-
}
|
|
24
|
-
if (isRemoteDriverSession(driver)) {
|
|
25
|
-
throw new Error('Get context is not yet implemented for the remote driver');
|
|
26
|
-
}
|
|
27
|
-
try {
|
|
28
|
-
const [currentContext, contexts] = await Promise.all([
|
|
29
|
-
getCurrentContext(driver).catch(() => null),
|
|
30
|
-
_getContexts(driver).catch(() => []),
|
|
31
|
-
]);
|
|
32
|
-
if (currentContext) {
|
|
33
|
-
setCurrentContext(currentContext);
|
|
34
|
-
}
|
|
35
|
-
if (!contexts || contexts.length === 0) {
|
|
36
|
-
return {
|
|
37
|
-
content: [
|
|
38
|
-
{
|
|
39
|
-
type: 'text',
|
|
40
|
-
text: 'No contexts available.',
|
|
41
|
-
},
|
|
42
|
-
],
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
const textResponse = {
|
|
46
|
-
content: [
|
|
47
|
-
{
|
|
48
|
-
type: 'text',
|
|
49
|
-
text: `Available contexts: ${JSON.stringify(contexts, null, 2)}\nCurrent context: ${currentContext}`,
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
};
|
|
53
|
-
// Add interactive context switcher UI
|
|
54
|
-
const uiResource = createUIResource(`ui://appium-mcp/context-switcher/${Date.now()}`, createContextSwitcherUI(contexts, currentContext));
|
|
55
|
-
return addUIResourceToResponse(textResponse, uiResource);
|
|
56
|
-
}
|
|
57
|
-
catch (err) {
|
|
58
|
-
return {
|
|
59
|
-
content: [
|
|
60
|
-
{
|
|
61
|
-
type: 'text',
|
|
62
|
-
text: `Failed to get contexts. Error: ${err.toString()}`,
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
|
-
isError: true,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
//# sourceMappingURL=get-contexts.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-contexts.js","sourceRoot":"","sources":["../../../src/tools/context/get-contexts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,SAAS,EACT,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,iBAAiB,EACjB,WAAW,IAAI,YAAY,GAC5B,MAAM,kBAAkB,CAAC;AAE1B,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,MAAe;IACjD,MAAM,CAAC,OAAO,CAAC;QACb,IAAI,EAAE,qBAAqB;QAC3B,WAAW,EACT,oLAAoL;QACtL,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC;YACnB,SAAS,EAAE,CAAC;iBACT,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CAAC,4DAA4D,CAAC;SAC1E,CAAC;QACF,WAAW,EAAE;YACX,YAAY,EAAE,IAAI;YAClB,aAAa,EAAE,KAAK;SACrB;QACD,OAAO,EAAE,KAAK,EACZ,IAA4B,EAC5B,QAAa,EACC,EAAE;YAChB,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACzC,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;YACrE,CAAC;YAED,IAAI,qBAAqB,CAAC,MAAM,CAAC,EAAE,CAAC;gBAClC,MAAM,IAAI,KAAK,CACb,0DAA0D,CAC3D,CAAC;YACJ,CAAC;YAED,IAAI,CAAC;gBACH,MAAM,CAAC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,0 @@
|
|
|
1
|
-
{"version":3,"file":"switch-context.d.ts","sourceRoot":"","sources":["../../../src/tools/context/switch-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AASlC,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAoG3D"}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { getDriver, isRemoteDriverSession, setCurrentContext, } from '../../session-store.js';
|
|
3
|
-
import { getContexts, getCurrentContext, setContext } from '../../command.js';
|
|
4
|
-
export default function switchContext(server) {
|
|
5
|
-
const schema = z.object({
|
|
6
|
-
context: z
|
|
7
|
-
.string()
|
|
8
|
-
.describe('The name of the context to switch to. Common values: "NATIVE_APP" for native context, or "WEBVIEW_<id>" / "WEBVIEW_<package>" for webview contexts.'),
|
|
9
|
-
sessionId: z
|
|
10
|
-
.string()
|
|
11
|
-
.optional()
|
|
12
|
-
.describe('Session ID to target. If omitted, uses the active session.'),
|
|
13
|
-
});
|
|
14
|
-
server.addTool({
|
|
15
|
-
name: 'appium_switch_context',
|
|
16
|
-
description: 'Switch to a specific context in the Appium session. Use this to switch between native app context (NATIVE_APP) and webview contexts (WEBVIEW_<id> or WEBVIEW_<package>). Use appium_get_contexts to see available contexts first.',
|
|
17
|
-
parameters: schema,
|
|
18
|
-
annotations: {
|
|
19
|
-
readOnlyHint: false,
|
|
20
|
-
openWorldHint: false,
|
|
21
|
-
},
|
|
22
|
-
execute: async (args, _context) => {
|
|
23
|
-
const driver = getDriver(args.sessionId);
|
|
24
|
-
if (!driver) {
|
|
25
|
-
throw new Error('No driver found. Please create a session first.');
|
|
26
|
-
}
|
|
27
|
-
if (isRemoteDriverSession(driver)) {
|
|
28
|
-
throw new Error('Get context is not yet implemented for the remote driver');
|
|
29
|
-
}
|
|
30
|
-
try {
|
|
31
|
-
const [currentContext, availableContexts] = await Promise.all([
|
|
32
|
-
getCurrentContext(driver).catch(() => null),
|
|
33
|
-
getContexts(driver).catch(() => []),
|
|
34
|
-
]);
|
|
35
|
-
if (currentContext === args.context) {
|
|
36
|
-
return {
|
|
37
|
-
content: [
|
|
38
|
-
{
|
|
39
|
-
type: 'text',
|
|
40
|
-
text: `Already on context "${args.context}".`,
|
|
41
|
-
},
|
|
42
|
-
],
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
if (!availableContexts || availableContexts.length === 0) {
|
|
46
|
-
return {
|
|
47
|
-
content: [
|
|
48
|
-
{
|
|
49
|
-
type: 'text',
|
|
50
|
-
text: 'No contexts available. Cannot switch context.',
|
|
51
|
-
},
|
|
52
|
-
],
|
|
53
|
-
isError: true,
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
if (!availableContexts.includes(args.context)) {
|
|
57
|
-
return {
|
|
58
|
-
content: [
|
|
59
|
-
{
|
|
60
|
-
type: 'text',
|
|
61
|
-
text: `Context "${args.context}" not found. Available contexts: ${JSON.stringify(availableContexts, null, 2)}`,
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
isError: true,
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
await setContext(driver, args.context);
|
|
68
|
-
// Verify the switch was successful
|
|
69
|
-
const newContext = await getCurrentContext(driver);
|
|
70
|
-
setCurrentContext(newContext);
|
|
71
|
-
return {
|
|
72
|
-
content: [
|
|
73
|
-
{
|
|
74
|
-
type: 'text',
|
|
75
|
-
text: `Successfully switched context from "${currentContext}" to "${newContext}".`,
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
catch (err) {
|
|
81
|
-
return {
|
|
82
|
-
content: [
|
|
83
|
-
{
|
|
84
|
-
type: 'text',
|
|
85
|
-
text: `Failed to switch context. Error: ${err.toString()}`,
|
|
86
|
-
},
|
|
87
|
-
],
|
|
88
|
-
isError: true,
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
//# sourceMappingURL=switch-context.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"switch-context.js","sourceRoot":"","sources":["../../../src/tools/context/switch-context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,SAAS,EACT,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9E,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,MAAe;IACnD,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;QACtB,OAAO,EAAE,CAAC;aACP,MAAM,EAAE;aACR,QAAQ,CACP,qJAAqJ,CACtJ;QACH,SAAS,EAAE,CAAC;aACT,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,4DAA4D,CAAC;KAC1E,CAAC,CAAC;IAEH,MAAM,CAAC,OAAO,CAAC;QACb,IAAI,EAAE,uBAAuB;QAC7B,WAAW,EACT,mOAAmO;QACrO,UAAU,EAAE,MAAM;QAClB,WAAW,EAAE;YACX,YAAY,EAAE,KAAK;YACnB,aAAa,EAAE,KAAK;SACrB;QACD,OAAO,EAAE,KAAK,EAAE,IAAS,EAAE,QAAa,EAAgB,EAAE;YACxD,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACzC,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;YACrE,CAAC;YAED,IAAI,qBAAqB,CAAC,MAAM,CAAC,EAAE,CAAC;gBAClC,MAAM,IAAI,KAAK,CACb,0DAA0D,CAC3D,CAAC;YACJ,CAAC;YAED,IAAI,CAAC;gBACH,MAAM,CAAC,cAAc,EAAE,iBAAiB,CA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AM;4BACZ,IAAI,EAAE,uCAAuC,cAAc,SAAS,UAAU,IAAI;yBACnF;qBACF;iBACF,CAAC;YACJ,CAAC;YAAC,OAAO,GAAQ,EAAE,CAAC;gBAClB,OAAO;oBACL,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,MAAM;4BACZ,IAAI,EAAE,oCAAoC,GAAG,CAAC,QAAQ,EAAE,EAAE;yBAC3D;qBACF;oBACD,OAAO,EAAE,IAAI;iBACd,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { FastMCP } from 'fastmcp';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import {
|
|
4
|
-
getDriver,
|
|
5
|
-
isRemoteDriverSession,
|
|
6
|
-
setCurrentContext,
|
|
7
|
-
} from '../../session-store.js';
|
|
8
|
-
import {
|
|
9
|
-
createUIResource,
|
|
10
|
-
createContextSwitcherUI,
|
|
11
|
-
addUIResourceToResponse,
|
|
12
|
-
} from '../../ui/mcp-ui-utils.js';
|
|
13
|
-
import {
|
|
14
|
-
getCurrentContext,
|
|
15
|
-
getContexts as _getContexts,
|
|
16
|
-
} from '../../command.js';
|
|
17
|
-
|
|
18
|
-
export default function getContexts(server: FastMCP): void {
|
|
19
|
-
server.addTool({
|
|
20
|
-
name: 'appium_get_contexts',
|
|
21
|
-
description:
|
|
22
|
-
'Get all available contexts in the current Appium session. Returns a list of context names including NATIVE_APP and any webview contexts (e.g., WEBVIEW_<id> or WEBVIEW_<package>).',
|
|
23
|
-
parameters: z.object({
|
|
24
|
-
sessionId: z
|
|
25
|
-
.string()
|
|
26
|
-
.optional()
|
|
27
|
-
.describe('Session ID to target. If omitted, uses the active session.'),
|
|
28
|
-
}),
|
|
29
|
-
annotations: {
|
|
30
|
-
readOnlyHint: true,
|
|
31
|
-
openWorldHint: false,
|
|
32
|
-
},
|
|
33
|
-
execute: async (
|
|
34
|
-
args: { sessionId?: string },
|
|
35
|
-
_context: any
|
|
36
|
-
): Promise<any> => {
|
|
37
|
-
const driver = getDriver(args.sessionId);
|
|
38
|
-
if (!driver) {
|
|
39
|
-
throw new Error('No driver found. Please create a session first.');
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (isRemoteDriverSession(driver)) {
|
|
43
|
-
throw new Error(
|
|
44
|
-
'Get context is not yet implemented for the remote driver'
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
try {
|
|
49
|
-
const [currentContext, contexts] = await Promise.all([
|
|
50
|
-
getCurrentContext(driver).catch(() => null),
|
|
51
|
-
_getContexts(driver).catch(() => []),
|
|
52
|
-
]);
|
|
53
|
-
|
|
54
|
-
if (currentContext) {
|
|
55
|
-
setCurrentContext(currentContext);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (!contexts || contexts.length === 0) {
|
|
59
|
-
return {
|
|
60
|
-
content: [
|
|
61
|
-
{
|
|
62
|
-
type: 'text',
|
|
63
|
-
text: 'No contexts available.',
|
|
64
|
-
},
|
|
65
|
-
],
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const textResponse = {
|
|
70
|
-
content: [
|
|
71
|
-
{
|
|
72
|
-
type: 'text',
|
|
73
|
-
text: `Available contexts: ${JSON.stringify(contexts, null, 2)}\nCurrent context: ${currentContext}`,
|
|
74
|
-
},
|
|
75
|
-
],
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
// Add interactive context switcher UI
|
|
79
|
-
const uiResource = createUIResource(
|
|
80
|
-
`ui://appium-mcp/context-switcher/${Date.now()}`,
|
|
81
|
-
createContextSwitcherUI(contexts as string[], currentContext)
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
return addUIResourceToResponse(textResponse, uiResource);
|
|
85
|
-
} catch (err: any) {
|
|
86
|
-
return {
|
|
87
|
-
content: [
|
|
88
|
-
{
|
|
89
|
-
type: 'text',
|
|
90
|
-
text: `Failed to get contexts. Error: ${err.toString()}`,
|
|
91
|
-
},
|
|
92
|
-
],
|
|
93
|
-
isError: true,
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
});
|
|
98
|
-
}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { FastMCP } from 'fastmcp';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import {
|
|
4
|
-
getDriver,
|
|
5
|
-
isRemoteDriverSession,
|
|
6
|
-
setCurrentContext,
|
|
7
|
-
} from '../../session-store.js';
|
|
8
|
-
import { getContexts, getCurrentContext, setContext } from '../../command.js';
|
|
9
|
-
|
|
10
|
-
export default function switchContext(server: FastMCP): void {
|
|
11
|
-
const schema = z.object({
|
|
12
|
-
context: z
|
|
13
|
-
.string()
|
|
14
|
-
.describe(
|
|
15
|
-
'The name of the context to switch to. Common values: "NATIVE_APP" for native context, or "WEBVIEW_<id>" / "WEBVIEW_<package>" for webview contexts.'
|
|
16
|
-
),
|
|
17
|
-
sessionId: z
|
|
18
|
-
.string()
|
|
19
|
-
.optional()
|
|
20
|
-
.describe('Session ID to target. If omitted, uses the active session.'),
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
server.addTool({
|
|
24
|
-
name: 'appium_switch_context',
|
|
25
|
-
description:
|
|
26
|
-
'Switch to a specific context in the Appium session. Use this to switch between native app context (NATIVE_APP) and webview contexts (WEBVIEW_<id> or WEBVIEW_<package>). Use appium_get_contexts to see available contexts first.',
|
|
27
|
-
parameters: schema,
|
|
28
|
-
annotations: {
|
|
29
|
-
readOnlyHint: false,
|
|
30
|
-
openWorldHint: false,
|
|
31
|
-
},
|
|
32
|
-
execute: async (args: any, _context: any): Promise<any> => {
|
|
33
|
-
const driver = getDriver(args.sessionId);
|
|
34
|
-
if (!driver) {
|
|
35
|
-
throw new Error('No driver found. Please create a session first.');
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (isRemoteDriverSession(driver)) {
|
|
39
|
-
throw new Error(
|
|
40
|
-
'Get context is not yet implemented for the remote driver'
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
try {
|
|
45
|
-
const [currentContext, availableContexts] = await Promise.all([
|
|
46
|
-
getCurrentContext(driver).catch(() => null),
|
|
47
|
-
getContexts(driver).catch(() => [] as string[]),
|
|
48
|
-
]);
|
|
49
|
-
|
|
50
|
-
if (currentContext === args.context) {
|
|
51
|
-
return {
|
|
52
|
-
content: [
|
|
53
|
-
{
|
|
54
|
-
type: 'text',
|
|
55
|
-
text: `Already on context "${args.context}".`,
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (!availableContexts || availableContexts.length === 0) {
|
|
62
|
-
return {
|
|
63
|
-
content: [
|
|
64
|
-
{
|
|
65
|
-
type: 'text',
|
|
66
|
-
text: 'No contexts available. Cannot switch context.',
|
|
67
|
-
},
|
|
68
|
-
],
|
|
69
|
-
isError: true,
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (!availableContexts.includes(args.context)) {
|
|
74
|
-
return {
|
|
75
|
-
content: [
|
|
76
|
-
{
|
|
77
|
-
type: 'text',
|
|
78
|
-
text: `Context "${args.context}" not found. Available contexts: ${JSON.stringify(availableContexts, null, 2)}`,
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
isError: true,
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
await setContext(driver, args.context);
|
|
85
|
-
// Verify the switch was successful
|
|
86
|
-
const newContext = await getCurrentContext(driver);
|
|
87
|
-
setCurrentContext(newContext);
|
|
88
|
-
|
|
89
|
-
return {
|
|
90
|
-
content: [
|
|
91
|
-
{
|
|
92
|
-
type: 'text',
|
|
93
|
-
text: `Successfully switched context from "${currentContext}" to "${newContext}".`,
|
|
94
|
-
},
|
|
95
|
-
],
|
|
96
|
-
};
|
|
97
|
-
} catch (err: any) {
|
|
98
|
-
return {
|
|
99
|
-
content: [
|
|
100
|
-
{
|
|
101
|
-
type: 'text',
|
|
102
|
-
text: `Failed to switch context. Error: ${err.toString()}`,
|
|
103
|
-
},
|
|
104
|
-
],
|
|
105
|
-
isError: true,
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
});
|
|
110
|
-
}
|