Skip to main content
Glama

clear_codegen_session

Remove a code generation session by its ID to clean up resources without producing test scripts, optimizing browser automation workflows in Playwright MCP Server.

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 handler implementation. Defines the Tool object including schema, description, and the async handler function that invokes ActionRecorder.clearSession(sessionId) 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 }) => { const success = ActionRecorder.getInstance().clearSession(sessionId); if (!success) { throw new Error(`Session ${sessionId} not found`); } return { success }; } };
  • Core clearing logic in ActionRecorder singleton. Removes the session from the internal Map and clears active session reference if matching.
    clearSession(sessionId: string): boolean { if (this.activeSession === sessionId) { this.activeSession = null; } return this.sessions.delete(sessionId); }
  • Tool registration in main tool handler switch statement. Routes calls to the clearCodegenSession.handler via handleCodegenResult wrapper.
    case 'clear_codegen_session': return await handleCodegenResult(clearCodegenSession.handler(args));
  • Input schema definition for MCP tool registration in createToolDefinitions() function.
    { 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:463-468 (registration)
    Lists 'clear_codegen_session' among codegen tools for conditional handling.
    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/BhanuTJ93/MCP'

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