MCPcopy Create free account
hub / github.com/callstack/agent-device / ensureInputTool

Function ensureInputTool

src/platforms/linux/linux-env.ts:28–56  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26} | null = null;
27
28export async function ensureInputTool(): Promise<{
29 tool: InputTool;
30 display: DisplayServer;
31}> {
32 const provider = resolveLinuxToolProvider();
33 if (cachedInputTool?.provider === provider) return cachedInputTool;
34
35 const display = detectDisplayServer();
36
37 if (display === 'wayland') {
38 if (await provider.whichCommand('ydotool')) {
39 cachedInputTool = { tool: 'ydotool', display, provider };
40 return cachedInputTool;
41 }
42 throw new AppError(
43 'TOOL_MISSING',
44 'ydotool is required for input synthesis on Wayland (xdotool does not work on Wayland). Install it via your package manager.',
45 );
46 }
47
48 if (await provider.whichCommand('xdotool')) {
49 cachedInputTool = { tool: 'xdotool', display, provider };
50 return cachedInputTool;
51 }
52 throw new AppError(
53 'TOOL_MISSING',
54 'xdotool is required for input synthesis on X11. Install it via your package manager.',
55 );
56}
57
58/** Reset cached tool (for testing). */
59export function resetInputToolCache(): void {

Callers 8

moveToFunction · 0.90
sendKeyFunction · 0.90
clickButtonFunction · 0.90
doubleClickLinuxFunction · 0.90
longPressLinuxFunction · 0.90
swipeLinuxFunction · 0.90
scrollLinuxFunction · 0.90
typeLinuxFunction · 0.90

Calls 2

resolveLinuxToolProviderFunction · 0.90
detectDisplayServerFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…