Skip to main content
Glama

clear_codegen_session

Terminate a code generation session by removing associated data without generating a test, ensuring efficient resource management in browser automation workflows.

Instructions

Clear a code generation session without generating a test

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesID of the session to clear

Implementation Reference

  • The primary handler function for the 'clear_codegen_session' tool. It calls ActionRecorder.getInstance().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 }) => {
        const success = ActionRecorder.getInstance().clearSession(sessionId);
        if (!success) {
          throw new Error(`Session ${sessionId} not found`);
        }
        return { success };
      }
    };
  • Input schema definition for the 'clear_codegen_session' tool, used in MCP tool registration via 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"]
      }
    },
  • Registration and routing logic in the main tool handler switch statement that directs calls to clearCodegenSession.handler
    switch (name) {
      case 'start_codegen_session':
        return await handleCodegenResult(startCodegenSession.handler(args));
      case 'end_codegen_session':
        return await handleCodegenResult(endCodegenSession.handler(args));
      case 'get_codegen_session':
        return await handleCodegenResult(getCodegenSession.handler(args));
      case 'clear_codegen_session':
        return await handleCodegenResult(clearCodegenSession.handler(args));
    }
  • src/tools.ts:485-489 (registration)
    The tool name is listed in the CODEGEN_TOOLS array for categorization and conditional handling.
    export const CODEGEN_TOOLS = [
      'start_codegen_session',
      'end_codegen_session',
      'get_codegen_session',
      'clear_codegen_session'
  • Import of the clearCodegenSession tool implementation into the main tool handler.
    startCodegenSession,
    endCodegenSession,
    getCodegenSession,
    clearCodegenSession
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 mentions that clearing occurs 'without generating a test', which adds some behavioral context, but it doesn't disclose critical details such as whether this is a destructive operation, what happens to session data, if it's reversible, or any permissions required. 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 and a key behavioral note ('without generating a test'). It's front-loaded with no unnecessary words, making it highly concise and well-structured.

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 that this is a mutation tool with no annotations and no output schema, the description is incomplete. It lacks details on behavioral traits (e.g., destructiveness, side effects), usage context compared to siblings, and expected outcomes, which are crucial for safe and effective tool invocation.

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 parameter 'sessionId' clearly documented. The description doesn't add any extra meaning about parameters beyond what the schema provides, so it meets the baseline of 3 for adequate coverage without additional 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 the resource ('a code generation session'), making the purpose understandable. However, it doesn't explicitly differentiate from its sibling 'end_codegen_session', which might serve a similar function, 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 noting 'without generating a test', which hints at a specific use case but doesn't explain when to use this tool versus alternatives like 'end_codegen_session' or other session management tools. No explicit when/when-not instructions or prerequisites are given.

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

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