Skip to main content
Glama
devskido

Playwright MCP Server

by devskido

clear_codegen_session

Remove a code generation session by specifying its session ID in the Playwright MCP Server, ensuring no test is generated in the process.

Instructions

Clear a code generation session without generating a test

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesID of the session to clear

Implementation Reference

  • Primary tool definition including the handler function that executes the core logic by calling ActionRecorder.clearSession(sessionId) and schema definition.
    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 }) => { const success = ActionRecorder.getInstance().clearSession(sessionId); if (!success) { throw new Error(`Session ${sessionId} not found`); } return { success }; } };
  • The ActionRecorder.clearSession method that deletes the session from the internal sessions Map, implementing the core clearing logic.
    clearSession(sessionId: string): boolean { if (this.activeSession === sessionId) { this.activeSession = null; } return this.sessions.delete(sessionId); }
  • MCP tool schema registration in createToolDefinitions() for input validation.
    { 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"] } },
  • Tool execution registration in the main handleToolCall switch statement, importing and calling the handler.
    case 'clear_codegen_session': return await handleCodegenResult(clearCodegenSession.handler(args));
  • src/tools.ts:485-490 (registration)
    Tool name included in CODEGEN_TOOLS array for categorization.
    export const CODEGEN_TOOLS = [ 'start_codegen_session', 'end_codegen_session', 'get_codegen_session', 'clear_codegen_session' ];

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/devskido/customed-playwright'

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