Skip to main content
Glama

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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); } }
  • 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,
  • 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(); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/freema/firefox-devtools-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server