opera-devtools-mcp 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,7 +6,6 @@
6
6
  * Modified by Opera Software AS.
7
7
  */
8
8
  import { zod } from '../third_party/index.js';
9
- ;
10
9
  export function defineTool(definition) {
11
10
  if (typeof definition === 'function') {
12
11
  const factory = definition;
@@ -9,7 +9,7 @@ import { ToolCategory } from './categories.js';
9
9
  import { definePageTool } from './ToolDefinition.js';
10
10
  const getCDPSession = (page) => page._client();
11
11
  const MAX_SW_RETRIES = 5;
12
- const SW_RETRY_DELAY_MS = 1000;
12
+ const SW_RETRY_DELAY_MS = 2500;
13
13
  const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
14
14
  async function withServiceWorkerRetry(fn) {
15
15
  let lastError;
@@ -83,15 +83,23 @@ export const operaChat = definePageTool({
83
83
  },
84
84
  schema: {
85
85
  prompt: zod.string().describe('The prompt to send to Opera AI.'),
86
+ model: zod
87
+ .string()
88
+ .optional()
89
+ .describe('Model ID to use for the chat. Omit to use the browser default. Use opera_list_models to discover available IDs.'),
86
90
  },
87
91
  handler: async (request, response) => {
88
92
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
89
93
  const session = getCDPSession(request.page.pptrPage);
90
94
  try {
91
- const result = await dispatchAction(session, {
95
+ const payload = {
92
96
  action: 'chat',
93
97
  prompt: request.params.prompt,
94
- });
98
+ };
99
+ if (request.params.model !== undefined) {
100
+ payload['model'] = request.params.model;
101
+ }
102
+ const result = await dispatchAction(session, payload);
95
103
  response.appendResponseLine(result);
96
104
  }
97
105
  catch (e) {
@@ -123,8 +131,9 @@ export const operaDo = definePageTool({
123
131
  response.appendResponseLine(result);
124
132
  }
125
133
  catch (e) {
126
- if (e.name === 'AbortError')
134
+ if (e.name === 'AbortError') {
127
135
  throw e;
136
+ }
128
137
  response.appendResponseLine(`Opera.dispatchWithStreamedResponse(do) failed with error: ${e.message}`);
129
138
  }
130
139
  },
@@ -185,10 +194,32 @@ export const operaResearch = definePageTool({
185
194
  response.appendResponseLine(result);
186
195
  }
187
196
  catch (e) {
188
- if (e.name === 'AbortError')
197
+ if (e.name === 'AbortError') {
189
198
  throw e;
199
+ }
190
200
  response.appendResponseLine(`Opera.dispatchWithStreamedResponse(research) failed with error: ${e.message}`);
191
201
  }
192
202
  },
193
203
  });
204
+ export const operaListModels = definePageTool({
205
+ name: 'opera_list_models',
206
+ description: 'List available AI models for Opera chat. Returns model IDs, display names, and which is the default. Only available when connected to Opera Neon.',
207
+ blockedByDialog: false,
208
+ annotations: {
209
+ category: ToolCategory.OPERA,
210
+ readOnlyHint: true,
211
+ },
212
+ schema: {},
213
+ handler: async (request, response) => {
214
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
215
+ const session = getCDPSession(request.page.pptrPage);
216
+ try {
217
+ const result = await dispatchAction(session, { action: 'listModels' });
218
+ response.appendResponseLine(result);
219
+ }
220
+ catch (e) {
221
+ response.appendResponseLine(`Opera.dispatchAction(listModels) failed with error: ${e.message}`);
222
+ }
223
+ },
224
+ });
194
225
  //# sourceMappingURL=opera.js.map
@@ -3,7 +3,7 @@
3
3
  * Copyright 2026 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { zod, ajv, } from '../third_party/index.js';
6
+ import { zod, ajv } from '../third_party/index.js';
7
7
  import { ToolCategory } from './categories.js';
8
8
  import { definePageTool } from './ToolDefinition.js';
9
9
  export const listThirdPartyDeveloperTools = definePageTool({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opera-devtools-mcp",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "MCP server for Opera DevTools",
5
5
  "type": "module",
6
6
  "bin": {