feat: chat model selector#16
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…CDP method Co-authored-by: Cursor <cursoragent@cursor.com>
macieju-opera
left a comment
There was a problem hiding this comment.
Review
The implementation is clean and well-structured. Two things need fixing before merge.
Required
1. operaListModels description is missing the Opera Neon caveat
Every other Opera tool says: "Only available when connected to Opera Neon." operaListModels omits this. Without it, users on non-Neon browsers get a cryptic Opera.dispatchAction(listModels) failed error with no hint as to why. Needs to be added to both the definePageTool description in opera.ts and the CLI options entry.
2. chrome-devtools-cli-options.ts is auto-generated — should not be edited manually
The file header says // NOTE: do not edit manually. Auto-generated by 'npm run cli:generate'. The generate script (scripts/generate-cli.ts) spins up the local MCP server and fetches registered tools. Since operaListModels is exported from opera.ts and auto-registered via Object.values(operaTools) in tools.ts, running npm run gen after the opera.ts changes would produce the correct entries automatically. The manual additions will be silently overwritten the next time someone runs npm run gen. Please run npm run gen and commit the output instead of the hand-written entries.
Minor / Style
3. Payload construction inside try {} — operaResearch (the direct precedent for optional-param payload building) builds the payload before the try block. The new operaChat handler builds it inside. Not a bug, but inconsistent with the established pattern.
4. Bracket notation: payload['model'] → payload.model for consistency with the rest of the file.
Not Issues
Auto-registration is fine — operaListModels is correctly picked up via Object.values(operaTools) in tools.ts. The Record<string, unknown> type and optional-field pattern match existing precedent.
- Introduced the `opera_list_models` tool to list available AI models for Opera chat. - Updated README and tool reference documentation to reflect the addition of the new tool and its parameters. - Added optional `model` parameter to the `opera_chat` tool documentation.
…y availability - Enhanced the description of the `opera_list_models` tool to specify that it is only available when connected to Opera Neon.
…ate availability with Opera Neon
Add
opera_list_modelstool andmodelparam toopera_chatMCP-layer support for AI model selection. Adds a new tool to list available models and an optional
modelparameter onopera_chatto select which model to use [web:26][web:29].Changes
modelparam onopera_chat— optional string passed through toOpera.dispatchAction({ action: 'chat', prompt, model });omitted from the payload when not specified so the browser uses its default.opera_list_modelstool — new read-only page tool that callsOpera.dispatchAction({ action: 'listModels' })and returns the JSON response; errors are caught and surfaced as a readable message.chrome-devtools-cli-options.tsupdated with the newmodelarg onopera_chatand the newopera_list_modelscommand entry.CDP contract
Both tools use
Opera.dispatchAction— no new CDP methods required.ActionPayloadResponse
listModels{ "action": "listModels" }{ "models": [{ "id": "string", "name": "string", "isDefault": true }] }chatwith model{ "action": "chat", "prompt": "string", "model": "string" }Same as current chat response.
Usage
opera-browser-cli models opera-browser-cli chat --model claude-sonnet-4 "Summarize this page"Notes
--modelapplies tochatonly — extensible to other AI commands later.opera_chatandopera_list_models.