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

Function handleScreenshotCommand

src/core/dispatch.ts:329–348  ·  view source on GitHub ↗
(
  interactor: Interactor,
  positionals: string[],
  outPath: string | undefined,
  context: DispatchContext | undefined,
)

Source from the content-addressed store, hash-verified

327}
328
329async function handleScreenshotCommand(
330 interactor: Interactor,
331 positionals: string[],
332 outPath: string | undefined,
333 context: DispatchContext | undefined,
334): Promise<Record<string, unknown>> {
335 const positionalPath = positionals[0];
336 const screenshotPath = positionalPath ?? outPath ?? `./screenshot-${Date.now()}.png`;
337 await fs.mkdir(pathModule.dirname(screenshotPath), { recursive: true });
338 const screenshotOptions = screenshotOptionsFromFlags(context);
339 await interactor.screenshot(screenshotPath, {
340 appBundleId: context?.appBundleId,
341 fullscreen: screenshotOptions.fullscreen,
342 normalizeStatusBar: screenshotOptions.normalizeStatusBar,
343 stabilize: screenshotOptions.stabilize,
344 surface: context?.surface,
345 skipIosSimulatorBootCheck: context?.skipIosSimulatorBootCheck,
346 });
347 return { path: screenshotPath, ...successText(`Saved screenshot: ${screenshotPath}`) };
348}
349
350async function handleViewportCommand(
351 interactor: Interactor,

Callers 1

dispatch.tsFile · 0.85

Calls 3

successTextFunction · 0.90
screenshotMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…