Skip to main content
Glama
devskido

Playwright MCP Server

by devskido

get_codegen_session

Retrieve details about a specific code generation session using its session ID to access browser automation results and generated test code.

Instructions

Get information about a code generation session

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesID of the session to retrieve

Implementation Reference

  • The core handler implementation for the 'get_codegen_session' tool. It retrieves the codegen session data using ActionRecorder.getInstance().getSession(sessionId) and returns it, or throws an error if not found.
    export const getCodegenSession: Tool = {
      name: 'get_codegen_session',
      description: 'Get information about a code generation session',
      parameters: {
        type: 'object',
        properties: {
          sessionId: {
            type: 'string',
            description: 'ID of the session to retrieve'
          }
        },
        required: ['sessionId']
      },
      handler: async ({ sessionId }: { sessionId: string }) => {
        const session = ActionRecorder.getInstance().getSession(sessionId);
        if (!session) {
          throw new Error(`Session ${sessionId} not found`);
        }
        return session;
      }
    };
  • Registration/dispatch logic in the main toolHandler where 'get_codegen_session' is handled by calling its handler via handleCodegenResult.
    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));
    }
  • Input schema definition for 'get_codegen_session' tool provided to the MCP server via createToolDefinitions().
    {
      name: "get_codegen_session",
      description: "Get information about a code generation session",
      inputSchema: {
        type: "object",
        properties: {
          sessionId: { 
            type: "string", 
            description: "ID of the session to retrieve" 
          }
        },
        required: ["sessionId"]
      }
  • Import statement registering the getCodegenSession tool object into the main toolHandler.
    import { 
      startCodegenSession,
      endCodegenSession,
      getCodegenSession,
      clearCodegenSession
    } from './tools/codegen/index.js';
  • Export of codegenTools array including getCodegenSession for use in other modules.
    export const codegenTools = [
      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 of behavioral disclosure. It states this is a 'Get' operation, implying read-only behavior, but doesn't specify what information is returned (e.g., session status, code generated, errors), whether it requires authentication, or any rate limits. This leaves significant gaps for a tool with no annotation coverage.

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 is appropriately sized and front-loaded, making it easy to understand at a glance.

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 lack of annotations and output schema, the description is incomplete. It doesn't explain what 'information' is returned (e.g., session details, generated code, errors), which is critical for a tool with no structured output documentation. This gap reduces its usefulness for an AI agent.

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 single parameter 'sessionId' clearly documented in the schema. The description adds no additional parameter information beyond what the schema provides, so it meets the baseline of 3 for adequate coverage when the schema handles the documentation.

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 verb ('Get') and resource ('information about a code generation session'), making the purpose understandable. It distinguishes from most sibling tools (which are Playwright actions), though it doesn't explicitly differentiate from 'clear_codegen_session' and 'end_codegen_session' which also operate on codegen sessions.

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 no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a session ID from 'start_codegen_session'), nor does it differentiate from similar tools like 'clear_codegen_session' or 'end_codegen_session' beyond their names.

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/devskido/customed-playwright'

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