Skip to main content
Glama

get_logs

Retrieve recent browser automation logs from Selenix-MCP server, with pagination support for accessing historical test data.

Instructions

Get recent logs from Selenix (all types). Returns 20 logs per page, most recent first. Use page parameter to paginate (0 = most recent, 1 = next 20, etc.).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNoPage number (0 = most recent 20 logs, 1 = next 20, etc.). Defaults to 0.

Implementation Reference

  • The BridgeClient class acts as a universal handler for all tool definitions, dynamically routing requests to the Selenix HTTP API based on the tool name.
    export class BridgeClient {
      async call(endpoint: string, body: Record<string, unknown> = {}): Promise<unknown> {
        // Re-read config on every call so we pick up new tokens after Selenix restarts
        const config = readConfig()
    
        return new Promise((resolve, reject) => {
          const data = JSON.stringify(body)
          const req = http.request(
            {
              hostname: '127.0.0.1',
              port: config.port,
              path: `/api/${endpoint}`,
              method: 'POST',
              headers: {
                'Content-Type': 'application/json',
                Authorization: `Bearer ${config.token}`,
                'Content-Length': Buffer.byteLength(data),
              },
              timeout: 180000, // 3 minutes for long-running operations like run_test
            },
            (res) => {
              let responseData = ''
              res.on('data', (chunk: string) => (responseData += chunk))
              res.on('end', () => {
                try {
                  resolve(JSON.parse(responseData))
                } catch {
                  resolve({ raw: responseData })
                }
              })
            }
          )
          req.on('error', (err) =>
            reject(
              new Error(
                `Cannot connect to Selenix bridge at 127.0.0.1:${config.port}. ` +
                  `Is Selenix running with MCP Server enabled? (${err.message})`
              )
            )
          )
          req.on('timeout', () => {
            req.destroy()
            reject(new Error('Request timed out after 180 seconds'))
          })
          req.write(data)
          req.end()
        })
      }
    }
  • src/tools.ts:148-278 (registration)
    The get_logs tool is registered here within the TOOL_DEFINITIONS array.
        name: 'get_logs',
        description:
          'Get recent logs from Selenix (all types). Returns 20 logs per page, most recent first. Use page parameter to paginate (0 = most recent, 1 = next 20, etc.).',
        inputSchema: {
          type: 'object' as const,
          properties: {
            page: {
              type: 'number',
              description: 'Page number (0 = most recent 20 logs, 1 = next 20, etc.). Defaults to 0.',
            },
          },
        },
      },
      {
        name: 'get_workspace_context',
        description:
          'Get a summary of the current Selenix workspace: project name, active test, test count, selected command count.',
        inputSchema: { type: 'object' as const, properties: {} },
      },
    
      // --- Write tools ---
      {
        name: 'add_commands',
        description:
          'Add one or more commands to a test at a specific index. Commands use camelCase names (e.g., "click", "type", "open", "executeScript").',
        inputSchema: {
          type: 'object' as const,
          properties: {
            test_id: {
              type: 'string',
              description: 'The test ID to add commands to',
            },
            index: {
              type: 'number',
              description: 'The 0-based index at which to insert commands',
            },
            commands: {
              type: 'array',
              items: {
                type: 'object',
                properties: {
                  command: { type: 'string' },
                  target: { type: 'string' },
                  value: { type: 'string' },
                },
                required: ['command'],
              },
              description: 'Array of commands to add',
            },
          },
          required: ['test_id', 'index', 'commands'],
        },
      },
      {
        name: 'run_test',
        description:
          'Run a test and wait for it to complete. Returns the pass/fail result for each command. This operation may take up to 2 minutes.',
        inputSchema: {
          type: 'object' as const,
          properties: {
            test_id: {
              type: 'string',
              description: 'Optional test ID. If omitted, runs the active test.',
            },
          },
        },
      },
      {
        name: 'clear_and_replace_commands',
        description:
          'Replace ALL commands in a test with a new set. This removes all existing commands first.',
        inputSchema: {
          type: 'object' as const,
          properties: {
            test_id: {
              type: 'string',
              description: 'The test ID',
            },
            commands: {
              type: 'array',
              items: {
                type: 'object',
                properties: {
                  command: { type: 'string' },
                  target: { type: 'string' },
                  value: { type: 'string' },
                },
                required: ['command'],
              },
              description: 'The new set of commands for the test',
            },
          },
          required: ['test_id', 'commands'],
        },
      },
      {
        name: 'fix_commands',
        description:
          'Apply targeted fixes to commands in a test: update, remove, or insert at specific indexes. Indexes refer to the current command list BEFORE any fixes are applied.',
        inputSchema: {
          type: 'object' as const,
          properties: {
            test_id: {
              type: 'string',
              description: 'The test ID',
            },
            fixes: {
              type: 'array',
              items: {
                type: 'object',
                properties: {
                  action: {
                    type: 'string',
                    enum: ['update', 'remove', 'insert'],
                  },
                  index: {
                    type: 'number',
                    description: '0-based command index',
                  },
                  command: { type: 'string' },
                  target: { type: 'string' },
                  value: { type: 'string' },
                },
                required: ['action', 'index'],
              },
            },
          },
          required: ['test_id', 'fixes'],
        },
      },
    ]

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/markmircea/Selenix-MCP-Server'

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