clear_snapshot
Clear the browser's snapshot and UID cache to resolve stale element references during automated testing and browser automation tasks.
Instructions
Clear the snapshot/UID cache. Usually not needed, as navigation invalidates snapshots automatically.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/snapshot.ts:164-175 (handler)The main handler function for the 'clear_snapshot' tool. It asynchronously retrieves the FirefoxDevTools instance and calls its clearSnapshot() method, returning a success response or error.export async function handleClearSnapshot(_args: unknown): Promise<McpToolResponse> { try { const { getFirefox } = await import('../index.js'); const firefox = await getFirefox(); firefox.clearSnapshot(); return successResponse('🧹 Snapshot cleared'); } catch (error) { return errorResponse(error as Error); } }
- src/tools/snapshot.ts:52-59 (schema)The schema definition for the 'clear_snapshot' tool, including name, description, and empty input schema (no parameters required).export const clearSnapshotTool = { name: 'clear_snapshot', description: 'Clear snapshot cache. Usually not needed.', inputSchema: { type: 'object', properties: {}, }, };
- src/index.ts:128-128 (registration)Registration of the 'clear_snapshot' tool handler in the MCP server's toolHandlers Map, mapping the tool name to its handler function.['clear_snapshot', tools.handleClearSnapshot],
- src/index.ts:172-172 (registration)Registration of the 'clear_snapshot' tool schema in the allTools array used for listing available tools in the MCP server.tools.clearSnapshotTool,
- src/firefox/index.ts:339-344 (helper)The clearSnapshot() method in FirefoxDevTools (FirefoxClient) class, which invokes the SnapshotManager.clear() to perform the actual snapshot clearing.clearSnapshot(): void { if (!this.snapshot) { throw new Error('Not connected'); } this.snapshot.clear(); }