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

Function formatSparseSnapshotHint

src/utils/output.ts:656–663  ·  view source on GitHub ↗
(
  nodes: SnapshotNode[],
  options: Pick<SnapshotTextOptions, 'scoped' | 'depthLimited'>,
)

Source from the content-addressed store, hash-verified

654}
655
656function formatSparseSnapshotHint(
657 nodes: SnapshotNode[],
658 options: Pick<SnapshotTextOptions, 'scoped' | 'depthLimited'>,
659): string | null {
660 if (options.scoped === true || options.depthLimited === true || nodes.length > 3) return null;
661 const noun = nodes.length === 1 ? 'node' : 'nodes';
662 return `Hint: sparse accessibility snapshot returned ${nodes.length} ${noun}; snapshot state is invalid or unavailable for this screen. Use plain screenshot, not screenshot --overlay-refs, as visual truth. If screenshot shows the Home Screen or another app, run open for this app again first. Then navigate away with coordinates if needed and retry snapshot -i on the next screen.`;
663}
664
665function readSnapshotWarnings(data: Record<string, unknown>): string[] {
666 const rawWarnings = data.warnings;

Callers 1

buildSnapshotNoticesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…