Skip to main content
Glama
lucad87

MCP Server - Test Migration (WDIO to Playwright)

by lucad87

register_custom_commands

Registers custom WebDriverIO commands with Playwright equivalents to handle project-specific functionality during test migration.

Instructions

Registers custom WDIO commands with their Playwright equivalents for migration. Allows handling project-specific custom commands.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandsYesJSON string of custom command mappings: { "customCommand": { "method": "playwrightMethod", "description": "..." } }

Implementation Reference

  • The handler function that executes the registration logic for custom commands by updating the COMMAND_MAPPINGS constant.
    export async function handleRegisterCustomCommands(args) {
      const { commands } = args;
    
      let customCommands = {};
      try {
        customCommands = JSON.parse(commands);
      } catch (e) {
        return {
          content: [{
            type: 'text',
            text: 'Error: commands must be a valid JSON object',
          }],
          isError: true,
        };
      }
    
      const addedCommands = [];
      for (const [wdioCmd, mapping] of Object.entries(customCommands)) {
        if (!COMMAND_MAPPINGS[wdioCmd]) {
          COMMAND_MAPPINGS[wdioCmd] = mapping;
          addedCommands.push(wdioCmd);
        }
      }
    
      return {
        content: [{
          type: 'text',
          text: `# Custom Commands Registered
    
    ## Added Commands:
    ${addedCommands.length > 0 ? addedCommands.map(cmd => `- ${cmd} → ${COMMAND_MAPPINGS[cmd].method}`).join('\n') : 'No new commands added (already exist)'}
    
    ## Total Command Mappings: ${Object.keys(COMMAND_MAPPINGS).length}
    
    ## Usage:
    These commands will now be automatically migrated when using \`migrate_to_playwright\`.
    `,
        }],
      };
    }
  • The MCP tool definition for 'register_custom_commands', including its input schema.
      name: 'register_custom_commands',
      description: 'Registers custom WDIO commands with their Playwright equivalents for migration. Allows handling project-specific custom commands.',
      inputSchema: {
        type: 'object',
        properties: {
          commands: {
            type: 'string',
            description: 'JSON string of custom command mappings: { "customCommand": { "method": "playwrightMethod", "description": "..." } }',
          },
        },
        required: ['commands'],
      },
    },
Behavior3/5

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

Without annotations, the description carries the full burden but provides only basic behavioral information. It states that registration occurs but omits critical details: whether registrations persist across sessions, whether they modify files or internal state, validation behavior for the JSON input, and how these mappings interact with the migration process.

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

Conciseness4/5

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

The description is appropriately brief with two sentences. However, the second sentence ('Allows handling project-specific custom commands') is somewhat redundant, merely restating the purpose rather than adding new information. It is front-loaded with the core action.

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

Completeness3/5

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

For a single-parameter registration tool, the description is minimally adequate. However, given the complexity of migration tooling and lack of output schema, it should clarify what 'registration' means (persistence scope, validation) and whether this is a prerequisite step for 'migrate_to_playwright'. It leaves ambiguity about side effects.

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%, providing detailed structure for the 'commands' parameter (including example JSON format). The description itself adds no additional parameter semantics beyond the schema, so it meets the baseline score of 3 for high schema coverage.

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 identifies the action ('Registers') and the specific resource (custom WDIO commands with Playwright equivalents). It implicitly distinguishes from sibling 'migrate_to_playwright' by focusing on 'custom' commands versus general test migration, though it could be more explicit about this distinction.

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?

No explicit guidance on when to use this tool versus alternatives like 'migrate_to_playwright'. While 'project-specific custom commands' implies usage for user-defined extensions rather than built-in commands, there is no explicit 'when to use' or 'when not to use' instruction.

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/lucad87/mcp-server-tests-migration'

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