Skip to main content
Glama

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
NameRequiredDescriptionDefault
sessionIdYesID of the session to clear

Implementation Reference

  • 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 };
      },
    };
  • 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 }));
  • 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",
  • Imports the clearCodegenSession Tool object for use in tool handling.
    clearCodegenSession,
    endCodegenSession,
    getCodegenSession,
    startCodegenSession,
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 states the action ('Clear') but doesn't explain what 'clear' entailsโ€”e.g., whether it deletes data, resets state, requires specific permissions, or has side effects. This leaves significant gaps in understanding the tool's behavior.

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 without unnecessary words. It's appropriately sized and front-loaded, with every part contributing to understanding.

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?

Given the tool's potential complexity (clearing a session could involve data deletion or state changes), no annotations, and no output schema, the description is inadequate. It lacks details on behavior, outcomes, or error conditions, making it incomplete for safe and effective use.

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?

Schema description coverage is 100%, with the parameter 'sessionId' fully documented in the schema. The description adds no additional meaning or context about the parameter beyond what the schema provides, so it meets the baseline for high coverage without compensating value.

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'), and distinguishes it from generating a test. However, it doesn't explicitly differentiate from the sibling tool 'end_codegen_session', which might have similar functionality, leaving some ambiguity about when to use 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 mentions 'without generating a test', which implies an alternative action but doesn't specify when to use this tool versus other options like 'end_codegen_session' or 'get_codegen_session'. No explicit guidance on context, prerequisites, or exclusions is provided.

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

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/aakashH242/mcp-playwright'

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