get_selected_command_info
Retrieve detailed context for browser automation commands, including DOM hierarchy, accessibility data, surrounding HTML, and interactive properties to aid in test debugging and execution.
Instructions
Get comprehensive context about a command target element: DOM hierarchy, accessibility info, surrounding HTML, interactive properties.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| command_id | No | Optional command ID. If omitted, uses the currently selected command. |
Implementation Reference
- src/tools.ts:50-63 (registration)Tool definition/registration for get_selected_command_info.
name: 'get_selected_command_info', description: 'Get comprehensive context about a command target element: DOM hierarchy, accessibility info, surrounding HTML, interactive properties.', inputSchema: { type: 'object' as const, properties: { command_id: { type: 'string', description: 'Optional command ID. If omitted, uses the currently selected command.', }, }, }, }, - src/index.ts:25-25 (handler)Request handler calls the bridge with the tool name as the API endpoint.
const result = (await bridge.call(name, (args as Record<string, unknown>) || {})) as Record<string, unknown> - src/bridge-client.ts:24-72 (helper)Bridge client translates tool calls to HTTP POST requests to the Selenix backend API.
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() }) } }