Skip to main content
Glama
pvinis
by pvinis

clear_codegen_session

Clears a code generation session in the Playwright MCP Server by removing the session data, ensuring a fresh start without generating test output.

Instructions

Clear a code generation session without generating a test

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesID of the session to clear

Implementation Reference

  • The clearCodegenSession tool object defining the handler function that executes the tool logic by clearing the specified codegen session using ActionRecorder.clearSession().
    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 };
      },
    };
  • MCP input schema definition for the clear_codegen_session tool, used for tool discovery and 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"]
      }
    },
  • Registration and dispatch of the clear_codegen_session tool in the main handleToolCall switch statement, routing to the specific handler.
    case "clear_codegen_session":
      return await handleCodegenResult(clearCodegenSession.handler(args));
  • Inclusion of clearCodegenSession in the codegenTools export array for grouping codegen-related tools.
    clearCodegenSession,
  • src/tools.ts:441-441 (registration)
    Listing of clear_codegen_session in the CODEGEN_TOOLS constant array.
    'clear_codegen_session'
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states the tool clears a session, implying a destructive/mutation operation, but doesn't disclose behavioral traits such as whether this is reversible, what 'clear' entails (e.g., deleting data, resetting state), permissions required, error handling, or side effects. For a mutation tool with zero annotation coverage, this is inadequate.

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 is front-loaded with the core action ('Clear a code generation session') and adds a clarifying detail ('without generating a test'). There is no wasted text, and it's appropriately sized for the tool's complexity.

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 is a mutation operation (clearing a session) with no annotations and no output schema, the description is incomplete. It doesn't explain what 'clear' means behaviorally, what happens after clearing, potential errors, or return values. For a destructive tool, more context is needed to be fully helpful.

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 'sessionId' documented as 'ID of the session to clear'. The description doesn't add any parameter semantics beyond this, such as format examples or constraints. With high schema coverage, the baseline is 3, as the schema does the heavy lifting and no extra value is added.

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'), specifying what the tool does. It distinguishes from potential sibling 'end_codegen_session' by noting it clears 'without generating a test', though it doesn't explicitly name alternatives. This provides good clarity but lacks explicit sibling differentiation for a full 5.

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 implies usage by stating 'without generating a test', which hints at when not to use it (i.e., if you want a test, use something else). However, it doesn't provide explicit guidance on when to use this tool versus alternatives like 'end_codegen_session' or other session management tools, nor does it mention prerequisites or context. This is minimal guidance.

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

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