clear_codegen_session
Clear a code generation session in Playwright browser automation to reset state without creating new tests.
Instructions
Clear a code generation session without generating a test
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sessionId | Yes | ID of the session to clear |
Implementation Reference
- src/tools/codegen/index.ts:197-217 (handler)The core handler function for the clear_codegen_session tool. It calls ActionRecorder.clearSession(sessionId) to remove the session data and returns success status.export const clearCodegenSession: Tool = { name: "clear_codegen_session", description: "Clear a code generation session", parameters: { type: "object", properties: { sessionId: { type: "string", description: "ID of the session to clear", }, }, required: ["sessionId"], }, handler: async ({ sessionId }: { sessionId: string }, _context?: { server?: any }) => { const success = ActionRecorder.getInstance().clearSession(sessionId); if (!success) { throw new Error(`Session ${sessionId} not found`); } return { success }; }, };
- src/toolHandler.ts:438-439 (registration)Registers and dispatches the clear_codegen_session tool call to its handler function via the main tool switch statement.case "clear_codegen_session": return await handleCodegenResult(clearCodegenSession.handler(args, { server }));
- src/tools.ts:64-77 (schema)Defines the input schema for clear_codegen_session used in MCP tool definitions (createToolDefinitions).{ name: "clear_codegen_session", description: "Clear a code generation session without generating a test", inputSchema: { type: "object", properties: { sessionId: { type: "string", description: "ID of the session to clear", }, }, required: ["sessionId"], }, },
- src/tools.ts:532-532 (registration)Lists clear_codegen_session in the CODEGEN_TOOLS array for tool categorization."clear_codegen_session",
- src/toolHandler.ts:37-40 (registration)Imports the clearCodegenSession Tool object for use in tool handling.clearCodegenSession, endCodegenSession, getCodegenSession, startCodegenSession,