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'
    ];
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions that clearing occurs 'without generating a test', which adds some context, but it fails to describe what 'clear' entails (e.g., does it delete data, reset state, require permissions, or have side effects?). This leaves significant gaps for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose. It is front-loaded with no unnecessary words, making it easy to parse quickly without any wasted space.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool that performs a mutation (clearing a session) with no annotations and no output schema, the description is insufficient. It lacks details on what 'clear' means operationally, potential impacts, error conditions, or return values, leaving the agent with incomplete information to use the tool effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the 'sessionId' parameter well-documented. The description doesn't add any additional meaning beyond the schema, such as format examples or constraints. Given the high schema coverage, a baseline score of 3 is appropriate as the schema handles the parameter documentation adequately.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Clear') and resource ('a code generation session'), making the purpose understandable. However, it doesn't differentiate from the sibling tool 'end_codegen_session', which might have similar functionality, leaving some ambiguity about when to choose one over the other.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides minimal guidance by specifying 'without generating a test', but it doesn't explain when to use this tool versus alternatives like 'end_codegen_session' or other session management tools. No context on prerequisites or exclusions is given, limiting its helpfulness.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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