vite-plugin-aipanel 1.2.8 → 1.2.10

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.
Files changed (58) hide show
  1. package/es/core/chrome-project.d.ts +15 -0
  2. package/es/core/chrome-project.mjs +13 -0
  3. package/es/core/mcp-chrome.d.ts +12 -8
  4. package/es/core/mcp-chrome.mjs +52 -10
  5. package/es/core/mcp-proxy.d.ts +21 -1
  6. package/es/core/mcp-proxy.mjs +83 -12
  7. package/es/core/mcp-tools.d.ts +51 -3
  8. package/es/core/mcp-tools.mjs +109 -659
  9. package/es/core/official-meta.d.ts +9 -0
  10. package/es/core/official-meta.mjs +62 -0
  11. package/es/core/official-tools.d.ts +7 -0
  12. package/es/core/official-tools.mjs +54 -0
  13. package/es/core/proxy-server.mjs +16 -13
  14. package/es/core/service.mjs +4 -5
  15. package/es/endpoints/context.mjs +2 -2
  16. package/es/endpoints/host-events.mjs +1 -2
  17. package/es/endpoints/index.d.ts +2 -2
  18. package/es/endpoints/index.mjs +2 -2
  19. package/es/endpoints/mcp.d.ts +2 -2
  20. package/es/endpoints/mcp.mjs +116 -87
  21. package/es/endpoints/sse.mjs +3 -3
  22. package/es/endpoints/vue-devtools.d.ts +5 -2
  23. package/es/endpoints/vue-devtools.mjs +3 -4
  24. package/es/index.mjs +29 -6
  25. package/lib/client.js +2380 -2369
  26. package/lib/core/chrome-project.cjs +36 -0
  27. package/lib/core/chrome-project.d.ts +15 -0
  28. package/lib/core/mcp-chrome.cjs +64 -10
  29. package/lib/core/mcp-chrome.d.ts +12 -8
  30. package/lib/core/mcp-proxy.cjs +87 -13
  31. package/lib/core/mcp-proxy.d.ts +21 -1
  32. package/lib/core/mcp-tools.cjs +124 -660
  33. package/lib/core/mcp-tools.d.ts +51 -3
  34. package/lib/core/official-meta.cjs +85 -0
  35. package/lib/core/official-meta.d.ts +9 -0
  36. package/lib/core/official-tools.cjs +70 -0
  37. package/lib/core/official-tools.d.ts +7 -0
  38. package/lib/core/proxy-server.cjs +16 -13
  39. package/lib/core/service.cjs +4 -5
  40. package/lib/endpoints/context.cjs +1 -1
  41. package/lib/endpoints/host-events.cjs +0 -1
  42. package/lib/endpoints/index.cjs +2 -2
  43. package/lib/endpoints/index.d.ts +2 -2
  44. package/lib/endpoints/mcp.cjs +114 -85
  45. package/lib/endpoints/mcp.d.ts +2 -2
  46. package/lib/endpoints/sse.cjs +2 -2
  47. package/lib/endpoints/vue-devtools.cjs +4 -5
  48. package/lib/endpoints/vue-devtools.d.ts +5 -2
  49. package/lib/index.cjs +29 -7
  50. package/package.json +10 -7
  51. package/es/utils/format-bridge.d.ts +0 -9
  52. package/es/utils/format-bridge.mjs +0 -80
  53. package/es/utils/system.d.ts +0 -3
  54. package/es/utils/system.mjs +0 -76
  55. package/lib/utils/format-bridge.cjs +0 -102
  56. package/lib/utils/format-bridge.d.ts +0 -9
  57. package/lib/utils/system.cjs +0 -110
  58. package/lib/utils/system.d.ts +0 -3
@@ -17,678 +17,142 @@ var __copyProps = (to, from, except, desc) => {
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
18
  var mcp_tools_exports = {};
19
19
  __export(mcp_tools_exports, {
20
- CUSTOM_TOOLS: () => CUSTOM_TOOLS
20
+ CUSTOM_TOOLS: () => CUSTOM_TOOLS,
21
+ MCP_PREFIX: () => MCP_PREFIX,
22
+ OFFICIAL_GLOBAL_POLICY: () => OFFICIAL_GLOBAL_POLICY,
23
+ OFFICIAL_NO_PAGE_TOOLS: () => OFFICIAL_NO_PAGE_TOOLS,
24
+ PAGE_ID_PROP: () => PAGE_ID_PROP,
25
+ PROJECT_DESCRIPTION_NOTES: () => PROJECT_DESCRIPTION_NOTES,
26
+ configureToolScope: () => configureToolScope,
27
+ currentOfficialShorts: () => currentOfficialShorts,
28
+ displayToolName: () => displayToolName,
29
+ extraToolFlag: () => extraToolFlag,
30
+ isAllowedToolName: () => isAllowedToolName,
31
+ isOfficialExtraTool: () => isOfficialExtraTool,
32
+ officialDefaultShorts: () => officialDefaultShorts,
33
+ officialExtraCandidates: () => officialExtraCandidates,
34
+ withPageIdSchema: () => withPageIdSchema
21
35
  });
22
36
  module.exports = __toCommonJS(mcp_tools_exports);
37
+ var import_official_meta = require("./official-meta.cjs");
38
+ const MCP_PREFIX = "chrome-devtools_";
39
+ function displayToolName(short) {
40
+ return MCP_PREFIX + short;
41
+ }
42
+ const OFFICIAL_GLOBAL_POLICY = [
43
+ "evaluate_script",
44
+ "list_console_messages",
45
+ "list_pages",
46
+ "new_page"
47
+ ];
48
+ const OFFICIAL_NO_PAGE_TOOLS = /* @__PURE__ */ new Set(["list_pages", "new_page"]);
23
49
  const PAGE_ID_PROP = {
24
- pageId: { type: "number", description: "\u76EE\u6807\u9875\u9762 ID" }
50
+ pageId: {
51
+ type: "number",
52
+ description: "The ID of a page within the operation scope (project pages or chromeMcp.project.allowOrigins pages) to operate on"
53
+ }
25
54
  };
26
- function withPageId(properties, required = []) {
55
+ function withPageIdSchema(schema) {
27
56
  return {
28
- properties: { ...PAGE_ID_PROP, ...properties },
29
- required: ["pageId", ...required]
57
+ type: "object",
58
+ properties: { ...PAGE_ID_PROP, ...schema.properties },
59
+ required: ["pageId", ...schema.required ?? []]
30
60
  };
31
61
  }
62
+ const PROJECT_DESCRIPTION_NOTES = {
63
+ list_pages: "Lists pages within the operation scope (project pages + chromeMcp.project.allowOrigins).",
64
+ new_page: "Only URLs within the operation scope (project or allowOrigins) can be opened. Opening a project page is de-duplicated (returns the already-open page); allowOrigins pages are opened without a count limit.",
65
+ navigate_page: "Navigation target (type=url) must stay within the operation scope (project or allowOrigins)."
66
+ };
32
67
  const CUSTOM_TOOLS = [
33
- // ===== 页面管理 =====
34
- {
35
- name: "chrome-devtools_list_pages",
36
- description: "\u83B7\u53D6\u5F53\u524D\u9879\u76EE\u6240\u6709\u6253\u5F00\u7684\u9875\u9762\u5217\u8868\uFF0C\u542B active\uFF08\u7528\u6237\u6B63\u5728\u6D4F\u89C8\uFF09\u548C selected\uFF08Chrome DevTools \u5F53\u524D\u64CD\u4F5C\u76EE\u6807\uFF09\u6807\u8BB0",
37
- inputSchema: {
38
- type: "object",
39
- properties: {}
40
- }
41
- },
42
- {
43
- name: "chrome-devtools_current_page",
44
- description: "\u83B7\u53D6\u7528\u6237\u5F53\u524D\u6B63\u5728\u6D4F\u89C8\u5668\u6D4F\u89C8\u7684\u9875\u9762\u4E0A\u4E0B\u6587\u4FE1\u606F\uFF0C\u5305\u542B\u9875\u9762 URL\u3001\u6807\u9898\u3001\u9875\u9762 ID",
45
- inputSchema: {
46
- type: "object",
47
- properties: {}
48
- }
49
- },
50
- {
51
- name: "chrome-devtools_new_page",
52
- description: "\u6253\u5F00\u4E00\u4E2A\u65B0\u6807\u7B7E\u9875\u5E76\u52A0\u8F7D URL\uFF08\u4EC5\u5141\u8BB8\u6253\u5F00\u5F53\u524D\u9879\u76EE\u7684\u9875\u9762\uFF09\u3002\u82E5\u5F53\u524D\u9879\u76EE\u5DF2\u6709\u6253\u5F00\u7684\u9875\u9762\uFF0C\u5219\u4E0D\u4F1A\u91CD\u590D\u6253\u5F00\uFF0C\u800C\u662F\u8FD4\u56DE\u5DF2\u6709\u9875\u9762\u4FE1\u606F",
53
- inputSchema: {
54
- type: "object",
55
- properties: {
56
- url: {
57
- type: "string",
58
- description: "\u8981\u6253\u5F00\u7684\u9875\u9762 URL\uFF08\u5FC5\u987B\u662F\u5F53\u524D\u9879\u76EE\u7684\u9875\u9762\uFF09"
59
- },
60
- timeout: {
61
- type: "integer",
62
- description: "\u6700\u5927\u7B49\u5F85\u65F6\u95F4\uFF08\u6BEB\u79D2\uFF09\uFF0C0 \u4F7F\u7528\u9ED8\u8BA4\u8D85\u65F6"
63
- }
64
- },
65
- required: ["url"]
66
- }
67
- },
68
- // ===== 截图与快照 =====
69
- {
70
- name: "chrome-devtools_take_snapshot",
71
- description: "\u83B7\u53D6\u6307\u5B9A\u9875\u9762\u53EF\u8BBF\u95EE\u6027\u6811\u5FEB\u7167\uFF0C\u8FD4\u56DE\u5143\u7D20 uid\u3001\u89D2\u8272\u3001\u6587\u672C\u7B49",
72
- inputSchema: {
73
- type: "object",
74
- ...withPageId({
75
- verbose: { type: "boolean", description: "\u662F\u5426\u83B7\u53D6\u5B8C\u6574 a11y \u6811\u4FE1\u606F\uFF0C\u9ED8\u8BA4 false" },
76
- filePath: { type: "string", description: "\u4FDD\u5B58\u5FEB\u7167\u7684\u6587\u4EF6\u8DEF\u5F84\uFF0C\u7701\u7565\u5219\u5185\u8054\u8FD4\u56DE" }
77
- })
78
- }
79
- },
80
- {
81
- name: "chrome-devtools_take_screenshot",
82
- description: "\u622A\u53D6\u6307\u5B9A\u9875\u9762\u6216\u5143\u7D20\u5C4F\u5E55\u622A\u56FE\uFF0C\u8FD4\u56DE base64 \u6216\u4FDD\u5B58\u5230\u6587\u4EF6",
83
- inputSchema: {
84
- type: "object",
85
- ...withPageId({
86
- format: {
87
- type: "string",
88
- enum: ["png", "jpeg", "webp"],
89
- description: "\u56FE\u7247\u683C\u5F0F\uFF0C\u9ED8\u8BA4 png"
90
- },
91
- quality: {
92
- type: "number",
93
- minimum: 0,
94
- maximum: 100,
95
- description: "JPEG/WebP \u538B\u7F29\u8D28\u91CF 0-100"
96
- },
97
- uid: {
98
- type: "string",
99
- description: "\u5143\u7D20 uid\uFF08\u4ECE chrome-devtools_take_snapshot \u83B7\u53D6\uFF09\uFF0C\u7701\u7565\u622A\u53D6\u6574\u9875"
100
- },
101
- fullPage: { type: "boolean", description: "\u662F\u5426\u622A\u53D6\u5B8C\u6574\u9875\u9762\uFF08\u4E0E uid \u4E92\u65A5\uFF09" },
102
- filePath: { type: "string", description: "\u4FDD\u5B58\u622A\u56FE\u7684\u6587\u4EF6\u8DEF\u5F84\uFF0C\u7701\u7565\u8FD4\u56DE base64" }
103
- })
104
- }
105
- },
106
- // ===== 交互操作 =====
107
- {
108
- name: "chrome-devtools_click",
109
- description: "\u70B9\u51FB\u9875\u9762\u5143\u7D20",
110
- inputSchema: {
111
- type: "object",
112
- ...withPageId(
113
- {
114
- uid: { type: "string", description: "\u5143\u7D20 uid\uFF08\u4ECE chrome-devtools_take_snapshot \u83B7\u53D6\uFF09" },
115
- dblClick: { type: "boolean", description: "\u662F\u5426\u53CC\u51FB\uFF0C\u9ED8\u8BA4 false" },
116
- includeSnapshot: { type: "boolean", description: "\u662F\u5426\u5728\u54CD\u5E94\u4E2D\u5305\u542B\u5FEB\u7167\uFF0C\u9ED8\u8BA4 false" }
117
- },
118
- ["uid"]
119
- )
120
- }
121
- },
122
- {
123
- name: "chrome-devtools_hover",
124
- description: "\u9F20\u6807\u60AC\u505C\u5728\u9875\u9762\u5143\u7D20\u4E0A",
125
- inputSchema: {
126
- type: "object",
127
- ...withPageId(
128
- {
129
- uid: { type: "string", description: "\u5143\u7D20 uid" },
130
- includeSnapshot: { type: "boolean", description: "\u662F\u5426\u5728\u54CD\u5E94\u4E2D\u5305\u542B\u5FEB\u7167\uFF0C\u9ED8\u8BA4 false" }
131
- },
132
- ["uid"]
133
- )
134
- }
135
- },
136
- {
137
- name: "chrome-devtools_drag",
138
- description: "\u62D6\u62FD\u9875\u9762\u5143\u7D20\u5230\u53E6\u4E00\u4E2A\u5143\u7D20\u4E0A",
139
- inputSchema: {
140
- type: "object",
141
- ...withPageId(
142
- {
143
- from_uid: { type: "string", description: "\u88AB\u62D6\u62FD\u5143\u7D20\u7684 uid" },
144
- to_uid: { type: "string", description: "\u76EE\u6807\u653E\u7F6E\u5143\u7D20\u7684 uid" },
145
- includeSnapshot: { type: "boolean", description: "\u662F\u5426\u5728\u54CD\u5E94\u4E2D\u5305\u542B\u5FEB\u7167\uFF0C\u9ED8\u8BA4 false" }
146
- },
147
- ["from_uid", "to_uid"]
148
- )
149
- }
150
- },
151
- {
152
- name: "chrome-devtools_type_text",
153
- description: "\u5728\u5DF2\u805A\u7126\u7684\u8F93\u5165\u6846\u4E2D\u4F7F\u7528\u952E\u76D8\u8F93\u5165\u6587\u672C",
154
- inputSchema: {
155
- type: "object",
156
- ...withPageId(
157
- {
158
- text: { type: "string", description: "\u8981\u8F93\u5165\u7684\u6587\u672C" },
159
- submitKey: {
160
- type: "string",
161
- description: '\u8F93\u5165\u540E\u6309\u4E0B\u7684\u6309\u952E\uFF0C\u5982 "Enter"\u3001"Tab"\u3001"Escape"'
162
- }
163
- },
164
- ["text"]
165
- )
166
- }
167
- },
168
- {
169
- name: "chrome-devtools_press_key",
170
- description: "\u6309\u4E0B\u952E\u76D8\u6309\u952E\u6216\u7EC4\u5408\u952E\uFF08\u5FEB\u6377\u952E\u3001\u5BFC\u822A\u952E\u7B49\uFF09",
171
- inputSchema: {
172
- type: "object",
173
- ...withPageId(
174
- {
175
- key: {
176
- type: "string",
177
- description: '\u6309\u952E\u6216\u7EC4\u5408\u952E\uFF0C\u5982 "Enter"\u3001"Control+A"\u3002\u4FEE\u9970\u952E: Control, Shift, Alt, Meta'
178
- },
179
- includeSnapshot: { type: "boolean", description: "\u662F\u5426\u5728\u54CD\u5E94\u4E2D\u5305\u542B\u5FEB\u7167\uFF0C\u9ED8\u8BA4 false" }
180
- },
181
- ["key"]
182
- )
183
- }
184
- },
185
- {
186
- name: "chrome-devtools_fill",
187
- description: "\u586B\u5199\u8F93\u5165\u6846\u503C\u6216\u9009\u62E9 select \u9009\u9879\uFF0C\u89E6\u53D1 input/change \u4E8B\u4EF6",
188
- inputSchema: {
189
- type: "object",
190
- ...withPageId(
191
- {
192
- uid: { type: "string", description: "\u8F93\u5165\u6846/select \u5143\u7D20 uid" },
193
- value: {
194
- type: "string",
195
- description: '\u8981\u586B\u5165\u7684\u503C\u3002checkbox/toggle \u7528 "true"/"false"\uFF0Cradio \u7528 "true"'
196
- },
197
- includeSnapshot: { type: "boolean", description: "\u662F\u5426\u5728\u54CD\u5E94\u4E2D\u5305\u542B\u5FEB\u7167\uFF0C\u9ED8\u8BA4 false" }
198
- },
199
- ["uid", "value"]
200
- )
201
- }
202
- },
203
- {
204
- name: "chrome-devtools_fill_form",
205
- description: "\u6279\u91CF\u586B\u5199\u8868\u5355\u5B57\u6BB5\uFF0C\u6BD4\u591A\u6B21\u8C03\u7528 fill/click \u66F4\u5FEB\u66F4\u53EF\u9760",
206
- inputSchema: {
207
- type: "object",
208
- ...withPageId(
209
- {
210
- elements: {
211
- type: "array",
212
- items: {
213
- type: "object",
214
- properties: { uid: { type: "string" }, value: { type: "string" } }
215
- },
216
- description: "\u8868\u5355\u5143\u7D20\u6570\u7EC4 [{ uid, value }]"
217
- },
218
- includeSnapshot: { type: "boolean", description: "\u662F\u5426\u5728\u54CD\u5E94\u4E2D\u5305\u542B\u5FEB\u7167\uFF0C\u9ED8\u8BA4 false" }
219
- },
220
- ["elements"]
221
- )
222
- }
223
- },
224
- // ===== 页面导航 =====
225
- {
226
- name: "chrome-devtools_navigate_page",
227
- description: "\u5BFC\u822A\u9875\u9762\uFF08url/reload/back/forward\uFF09",
228
- inputSchema: {
229
- type: "object",
230
- ...withPageId(
231
- {
232
- type: {
233
- type: "string",
234
- enum: ["url", "back", "forward", "reload"],
235
- description: "\u5BFC\u822A\u7C7B\u578B"
236
- },
237
- url: { type: "string", description: "\u76EE\u6807 URL\uFF08type=url \u65F6\u5FC5\u586B\uFF09" },
238
- ignoreCache: { type: "boolean", description: "reload \u65F6\u662F\u5426\u5FFD\u7565\u7F13\u5B58" },
239
- handleBeforeUnload: {
240
- type: "string",
241
- enum: ["accept", "dismiss"],
242
- description: "beforeunload \u5BF9\u8BDD\u6846\u5904\u7406\u65B9\u5F0F"
243
- },
244
- initScript: {
245
- type: "string",
246
- description: "\u4E0B\u4E00\u6B21\u5BFC\u822A\u65F6\uFF0C\u5728\u6BCF\u4E2A\u65B0 document \u52A0\u8F7D\u524D\u6267\u884C\u7684 JS \u811A\u672C"
247
- },
248
- timeout: { type: "integer", description: "\u6700\u5927\u7B49\u5F85\u65F6\u95F4\uFF08\u6BEB\u79D2\uFF09\uFF0C0 \u4F7F\u7528\u9ED8\u8BA4\u8D85\u65F6" }
249
- },
250
- ["type"]
251
- )
252
- }
253
- },
254
- {
255
- name: "chrome-devtools_resize_page",
256
- description: "\u8C03\u6574\u9875\u9762\u89C6\u53E3\u5927\u5C0F",
257
- inputSchema: {
258
- type: "object",
259
- ...withPageId(
260
- {
261
- width: { type: "number", description: "\u89C6\u53E3\u5BBD\u5EA6" },
262
- height: { type: "number", description: "\u89C6\u53E3\u9AD8\u5EA6" }
263
- },
264
- ["width", "height"]
265
- )
266
- }
267
- },
268
- {
269
- name: "chrome-devtools_emulate",
270
- description: "\u6A21\u62DF\u8BBE\u5907\u7279\u6027\uFF08\u7F51\u7EDC\u8282\u6D41\u3001CPU \u964D\u901F\u3001\u5730\u7406\u4F4D\u7F6E\u3001UA\u3001\u989C\u8272\u65B9\u6848\u3001\u89C6\u53E3\u7B49\uFF09",
271
- inputSchema: {
272
- type: "object",
273
- ...withPageId({
274
- networkConditions: {
275
- type: "string",
276
- enum: ["Offline", "Slow 3G", "Fast 3G", "Slow 4G", "Fast 4G"],
277
- description: "\u7F51\u7EDC\u8282\u6D41\u6A21\u5F0F"
278
- },
279
- cpuThrottlingRate: {
280
- type: "number",
281
- minimum: 1,
282
- maximum: 20,
283
- description: "CPU \u964D\u901F\u500D\u6570\uFF0C1 \u4E0D\u964D\u901F"
284
- },
285
- geolocation: { type: "string", description: "\u5730\u7406\u4F4D\u7F6E\uFF0C\u683C\u5F0F `<\u7EAC\u5EA6>,<\u7ECF\u5EA6>`" },
286
- userAgent: { type: "string", description: "UA \u5B57\u7B26\u4E32\uFF0C\u7A7A\u5B57\u7B26\u4E32\u6E05\u9664" },
287
- colorScheme: {
288
- type: "string",
289
- enum: ["dark", "light", "auto"],
290
- description: '\u989C\u8272\u65B9\u6848\uFF0C"auto" \u6062\u590D\u9ED8\u8BA4'
291
- },
292
- viewport: {
293
- type: "string",
294
- description: "\u89C6\u53E3\u6A21\u62DF\uFF0C\u683C\u5F0F `<\u5BBD>x<\u9AD8>x<\u7F29\u653E\u6BD4>[,mobile][,touch][,landscape]`"
295
- },
296
- extraHttpHeaders: {
297
- type: "string",
298
- description: `\u989D\u5916 HTTP \u8BF7\u6C42\u5934 JSON\uFF0C\u5982 '{"X-Custom":"value"}'`
299
- }
300
- })
301
- }
302
- },
303
- // ===== JS 执行 =====
304
- {
305
- name: "chrome-devtools_evaluate_script",
306
- description: "\u5728\u6307\u5B9A\u9875\u9762\u6267\u884C JavaScript \u51FD\u6570\u5E76\u8FD4\u56DE\u7ED3\u679C\uFF08\u8FD4\u56DE\u503C\u9700\u53EF JSON \u5E8F\u5217\u5316\uFF09",
307
- inputSchema: {
308
- type: "object",
309
- ...withPageId(
310
- {
311
- function: {
312
- type: "string",
313
- description: "JS \u51FD\u6570\u58F0\u660E\u3002\u65E0\u53C2\u6570: `() => document.title`\uFF0C\u6709\u53C2\u6570: `(el) => el.innerText`"
314
- },
315
- args: {
316
- type: "array",
317
- items: { type: "string" },
318
- description: "\u4F20\u7ED9\u51FD\u6570\u7684\u53C2\u6570\u5217\u8868\uFF08\u5143\u7D20 uid\uFF09"
319
- },
320
- filePath: { type: "string", description: "\u4FDD\u5B58\u8F93\u51FA\u5230\u6587\u4EF6\uFF0C\u7701\u7565\u5219\u5185\u8054\u8FD4\u56DE" },
321
- dialogAction: {
322
- type: "string",
323
- description: '\u5BF9\u8BDD\u6846\u5904\u7406: "accept"\u3001"dismiss" \u6216 prompt \u6587\u672C'
324
- }
325
- },
326
- ["function"]
327
- )
328
- }
329
- },
330
- // ===== 网络监控 =====
331
- {
332
- name: "chrome-devtools_list_network_requests",
333
- description: "\u83B7\u53D6\u6307\u5B9A\u9875\u9762\u7F51\u7EDC\u8BF7\u6C42\u5217\u8868\uFF08\u652F\u6301\u5206\u9875\u548C\u8FC7\u6EE4\uFF09",
334
- inputSchema: {
335
- type: "object",
336
- ...withPageId({
337
- pageSize: { type: "integer", description: "\u6BCF\u9875\u6700\u5927\u8BF7\u6C42\u6570" },
338
- pageIdx: { type: "integer", minimum: 0, description: "\u9875\u7801\uFF08\u4ECE 0 \u5F00\u59CB\uFF09" },
339
- resourceTypes: {
340
- type: "array",
341
- items: {
342
- type: "string",
343
- enum: [
344
- "document",
345
- "stylesheet",
346
- "image",
347
- "media",
348
- "font",
349
- "script",
350
- "xhr",
351
- "fetch",
352
- "websocket",
353
- "manifest",
354
- "other"
355
- ]
356
- },
357
- description: "\u6309\u8D44\u6E90\u7C7B\u578B\u8FC7\u6EE4"
358
- },
359
- includePreservedRequests: {
360
- type: "boolean",
361
- description: "\u662F\u5426\u8FD4\u56DE\u6700\u8FD1 3 \u6B21\u5BFC\u822A\u7684\u4FDD\u7559\u8BF7\u6C42"
362
- }
363
- })
364
- }
365
- },
366
- {
367
- name: "chrome-devtools_get_network_request",
368
- description: "\u83B7\u53D6\u7F51\u7EDC\u8BF7\u6C42\u7684\u8BE6\u7EC6\u4FE1\u606F\uFF0C\u53EF\u4FDD\u5B58\u8BF7\u6C42/\u54CD\u5E94\u4F53\u5230\u6587\u4EF6",
369
- inputSchema: {
370
- type: "object",
371
- ...withPageId({
372
- reqid: {
373
- type: "number",
374
- description: "\u8BF7\u6C42 ID\uFF08\u4ECE chrome-devtools_list_network_requests \u83B7\u53D6\uFF09\uFF0C\u7701\u7565\u8FD4\u56DE\u5F53\u524D\u9009\u4E2D\u8BF7\u6C42"
375
- },
376
- requestFilePath: {
377
- type: "string",
378
- description: "\u4FDD\u5B58\u8BF7\u6C42\u4F53\u5230 .network-request \u6587\u4EF6\u7684\u8DEF\u5F84"
379
- },
380
- responseFilePath: {
381
- type: "string",
382
- description: "\u4FDD\u5B58\u54CD\u5E94\u4F53\u5230 .network-response \u6587\u4EF6\u7684\u8DEF\u5F84"
383
- }
384
- })
385
- }
386
- },
387
- // ===== 控制台 =====
388
- {
389
- name: "chrome-devtools_list_console_messages",
390
- description: "\u83B7\u53D6\u6307\u5B9A\u9875\u9762\u63A7\u5236\u53F0\u6D88\u606F\uFF08\u652F\u6301\u5206\u9875\u548C\u8FC7\u6EE4\uFF09",
391
- inputSchema: {
392
- type: "object",
393
- ...withPageId({
394
- pageSize: { type: "integer", description: "\u6BCF\u9875\u6700\u5927\u6D88\u606F\u6570" },
395
- pageIdx: { type: "integer", minimum: 0, description: "\u9875\u7801\uFF08\u4ECE 0 \u5F00\u59CB\uFF09" },
396
- types: {
397
- type: "array",
398
- items: {
399
- type: "string",
400
- enum: ["log", "debug", "info", "error", "warn", "trace", "verbose", "issue"]
401
- },
402
- description: "\u6309\u6D88\u606F\u7C7B\u578B\u8FC7\u6EE4"
403
- },
404
- includePreservedMessages: {
405
- type: "boolean",
406
- description: "\u662F\u5426\u8FD4\u56DE\u6700\u8FD1 3 \u6B21\u5BFC\u822A\u7684\u4FDD\u7559\u6D88\u606F"
407
- },
408
- serviceWorkerId: { type: "string", description: "\u6309 service worker ID \u8FC7\u6EE4" }
409
- })
410
- }
411
- },
412
- {
413
- name: "chrome-devtools_get_console_message",
414
- description: "\u83B7\u53D6\u67D0\u6761\u63A7\u5236\u53F0\u6D88\u606F\u7684\u8BE6\u7EC6\u4FE1\u606F",
415
- inputSchema: {
416
- type: "object",
417
- ...withPageId(
418
- {
419
- msgid: {
420
- type: "number",
421
- description: "\u6D88\u606F ID\uFF08\u4ECE chrome-devtools_list_console_messages \u83B7\u53D6\uFF09"
422
- }
423
- },
424
- ["msgid"]
425
- )
426
- }
427
- },
428
- // ===== 其他 =====
429
- {
430
- name: "chrome-devtools_wait_for",
431
- description: "\u7B49\u5F85\u6307\u5B9A\u9875\u9762\u51FA\u73B0\u6307\u5B9A\u6587\u672C\uFF08\u4EFB\u4E00\u5339\u914D\u5373\u8FD4\u56DE\uFF09",
432
- inputSchema: {
433
- type: "object",
434
- ...withPageId(
435
- {
436
- text: {
437
- type: "array",
438
- items: { type: "string" },
439
- minItems: 1,
440
- description: "\u7B49\u5F85\u51FA\u73B0\u7684\u6587\u672C\u5217\u8868"
441
- },
442
- timeout: { type: "integer", description: "\u6700\u5927\u7B49\u5F85\u65F6\u95F4\uFF08\u6BEB\u79D2\uFF09\uFF0C0 \u4F7F\u7528\u9ED8\u8BA4\u8D85\u65F6" }
443
- },
444
- ["text"]
445
- )
446
- }
447
- },
448
- {
449
- name: "chrome-devtools_handle_dialog",
450
- description: "\u5904\u7406 JavaScript \u5BF9\u8BDD\u6846\uFF08alert/confirm/prompt\uFF09",
451
- inputSchema: {
452
- type: "object",
453
- ...withPageId(
454
- {
455
- action: { type: "string", enum: ["accept", "dismiss"], description: "\u63A5\u53D7\u6216\u5173\u95ED\u5BF9\u8BDD\u6846" },
456
- promptText: { type: "string", description: "prompt \u5BF9\u8BDD\u6846\u7684\u8F93\u5165\u6587\u672C" }
457
- },
458
- ["action"]
459
- )
460
- }
461
- },
462
- {
463
- name: "chrome-devtools_upload_file",
464
- description: "\u4E0A\u4F20\u6587\u4EF6\u5230\u6587\u4EF6\u8F93\u5165\u6846",
465
- inputSchema: {
466
- type: "object",
467
- ...withPageId(
468
- {
469
- uid: { type: "string", description: "\u6587\u4EF6\u8F93\u5165\u6846\u5143\u7D20 uid" },
470
- filePath: { type: "string", description: "\u672C\u5730\u6587\u4EF6\u8DEF\u5F84" },
471
- includeSnapshot: { type: "boolean", description: "\u662F\u5426\u5728\u54CD\u5E94\u4E2D\u5305\u542B\u5FEB\u7167\uFF0C\u9ED8\u8BA4 false" }
472
- },
473
- ["uid", "filePath"]
474
- )
475
- }
476
- },
477
- // ===== 性能分析 =====
478
- {
479
- name: "chrome-devtools_performance_start_trace",
480
- description: "\u5728\u6307\u5B9A\u9875\u9762\u5F00\u59CB\u8BB0\u5F55\u6027\u80FD trace\uFF08\u7528\u4E8E\u53D1\u73B0 Core Web Vitals \u6027\u80FD\u95EE\u9898\uFF09",
481
- inputSchema: {
482
- type: "object",
483
- ...withPageId({
484
- reload: { type: "boolean", description: "\u5F00\u59CB\u540E\u662F\u5426\u81EA\u52A8\u5237\u65B0\u9875\u9762\uFF0C\u9ED8\u8BA4 true" },
485
- autoStop: { type: "boolean", description: "\u662F\u5426\u81EA\u52A8\u505C\u6B62\u5F55\u5236\uFF0C\u9ED8\u8BA4 true" },
486
- filePath: { type: "string", description: "\u4FDD\u5B58\u539F\u59CB trace \u6570\u636E\u7684\u8DEF\u5F84\uFF0C\u5982 trace.json.gz" }
487
- })
488
- }
489
- },
490
- {
491
- name: "chrome-devtools_performance_stop_trace",
492
- description: "\u505C\u6B62\u6027\u80FD trace \u8BB0\u5F55\u5E76\u8FD4\u56DE\u7ED3\u679C",
493
- inputSchema: {
494
- type: "object",
495
- ...withPageId({
496
- filePath: { type: "string", description: "\u4FDD\u5B58\u539F\u59CB trace \u6570\u636E\u7684\u8DEF\u5F84\uFF0C\u5982 trace.json.gz" }
497
- })
498
- }
499
- },
500
68
  {
501
- name: "chrome-devtools_performance_analyze_insight",
502
- description: "\u83B7\u53D6\u7279\u5B9A\u6027\u80FD\u6307\u6807\u7684\u8BE6\u7EC6\u5206\u6790",
503
- inputSchema: {
504
- type: "object",
505
- ...withPageId(
506
- {
507
- insightSetId: { type: "string", description: "\u6307\u6807\u96C6 ID\uFF08\u4ECE trace \u7ED3\u679C\u83B7\u53D6\uFF09" },
508
- insightName: {
509
- type: "string",
510
- description: '\u6307\u6807\u540D\u79F0\uFF0C\u5982 "DocumentLatency"\u3001"LCPBreakdown"'
511
- }
512
- },
513
- ["insightSetId", "insightName"]
514
- )
515
- }
516
- },
517
- {
518
- name: "chrome-devtools_lighthouse_audit",
519
- description: "\u5BF9\u6307\u5B9A\u9875\u9762\u8FD0\u884C Lighthouse \u5BA1\u8BA1\uFF08\u53EF\u8BBF\u95EE\u6027/SEO/\u6700\u4F73\u5B9E\u8DF5\uFF0C\u4E0D\u542B\u6027\u80FD\uFF09",
520
- inputSchema: {
521
- type: "object",
522
- ...withPageId({
523
- mode: {
524
- type: "string",
525
- enum: ["navigation", "snapshot"],
526
- description: "navigation \u5237\u65B0\u5BA1\u8BA1\uFF0Csnapshot \u5206\u6790\u5F53\u524D\u72B6\u6001"
527
- },
528
- device: {
529
- type: "string",
530
- enum: ["desktop", "mobile"],
531
- description: "\u6A21\u62DF\u8BBE\u5907\u7C7B\u578B\uFF0C\u9ED8\u8BA4 desktop"
532
- },
533
- outputDirPath: { type: "string", description: "\u62A5\u544A\u8F93\u51FA\u76EE\u5F55\uFF0C\u7701\u7565\u4F7F\u7528\u4E34\u65F6\u6587\u4EF6" }
534
- })
535
- }
536
- },
537
- {
538
- name: "chrome-devtools_take_heapsnapshot",
539
- description: "\u6355\u83B7\u6307\u5B9A\u9875\u9762\u5806\u5185\u5B58\u5FEB\u7167\uFF0C\u7528\u4E8E\u5206\u6790 JS \u5BF9\u8C61\u5185\u5B58\u5206\u5E03\u548C\u8C03\u8BD5\u5185\u5B58\u6CC4\u6F0F",
540
- inputSchema: {
541
- type: "object",
542
- ...withPageId(
543
- {
544
- filePath: { type: "string", description: "\u4FDD\u5B58 .heapsnapshot \u6587\u4EF6\u7684\u8DEF\u5F84" }
545
- },
546
- ["filePath"]
547
- )
548
- }
549
- },
550
- // ===== Vue DevTools =====
551
- {
552
- name: "vue-devtools_get_apps",
553
- description: `\u83B7\u53D6\u6307\u5B9A\u9875\u9762\u6240\u6709 Vue \u5E94\u7528\u5B9E\u4F8B\u5217\u8868\u3002
554
-
555
- **\u4F55\u65F6\u4F7F\u7528**\uFF1A
556
- - \u6392\u67E5\u5FAE\u524D\u7AEF/\u591A\u5B9E\u4F8B\u573A\u666F\u4E0B\u64CD\u4F5C\u7684\u662F\u54EA\u4E2A\u5E94\u7528
557
- - \u5207\u6362\u6D3B\u8DC3\u5E94\u7528\u524D\u67E5\u770B\u6709\u54EA\u4E9B\u53EF\u7528`,
558
- inputSchema: {
559
- type: "object",
560
- ...withPageId({})
561
- }
562
- },
563
- {
564
- name: "vue-devtools_set_active_app",
565
- description: `\u5207\u6362\u6307\u5B9A\u9875\u9762\u7684\u6D3B\u8DC3 Vue \u5E94\u7528\u5B9E\u4F8B\u3002\u540E\u7EED\u6240\u6709 vue-devtools_* \u5DE5\u5177\u90FD\u64CD\u4F5C\u8FD9\u4E2A\u5E94\u7528\u3002`,
566
- inputSchema: {
567
- type: "object",
568
- ...withPageId(
569
- {
570
- appId: { type: "string", description: "\u5E94\u7528 ID\uFF08\u4ECE vue-devtools_get_apps \u83B7\u53D6\uFF09" }
571
- },
572
- ["appId"]
573
- )
574
- }
575
- },
576
- {
577
- name: "vue-devtools_get_component_tree",
578
- description: `\u83B7\u53D6\u6307\u5B9A\u9875\u9762\u5F53\u524D\u6D3B\u8DC3 Vue \u5E94\u7528\u7684\u7EC4\u4EF6\u6811\u3002
579
-
580
- **\u4F55\u65F6\u4F7F\u7528**\uFF1A
581
- - \u4E86\u89E3\u9875\u9762\u7EC4\u4EF6\u5C42\u7EA7\u7ED3\u6784
582
- - \u627E\u5230\u76EE\u6807\u7EC4\u4EF6\u7684 nodeId\uFF08\u540E\u7EED\u67E5\u72B6\u6001\u7528\uFF09
583
- - \u6392\u67E5\u7EC4\u4EF6\u672A\u6E32\u67D3\u95EE\u9898
584
- - \u53EA\u5173\u5FC3\u67D0\u7C7B\u7EC4\u4EF6\u65F6\u7528 filter \u7F29\u5C0F\u8303\u56F4
585
-
586
- **\u8FD4\u56DE**\uFF1A\u7EC4\u4EF6\u6811 [{ id, name, children, file, ... }]`,
587
- inputSchema: {
588
- type: "object",
589
- ...withPageId({
590
- filter: { type: "string", description: "\u6309\u7EC4\u4EF6\u540D\u8FC7\u6EE4\uFF08\u5927\u5C0F\u5199\u4E0D\u654F\u611F\u7684\u5B50\u4E32\u5339\u914D\uFF09\uFF0C\u53EF\u9009" }
591
- })
592
- }
593
- },
594
- {
595
- name: "vue-devtools_get_component_state",
596
- description: `\u83B7\u53D6\u6307\u5B9A\u7EC4\u4EF6\u7684\u5B8C\u6574\u8FD0\u884C\u65F6\u72B6\u6001\u3002
597
-
598
- **\u4F55\u65F6\u4F7F\u7528**\uFF1A
599
- - \u6392\u67E5 props \u4F20\u503C\u662F\u5426\u6B63\u786E
600
- - \u67E5\u770B ref/reactive \u54CD\u5E94\u5F0F\u6570\u636E\u7684\u5F53\u524D\u503C
601
- - \u68C0\u67E5 computed \u8BA1\u7B97\u7ED3\u679C
602
- - \u67E5\u770B attrs / events / inject / provide / template refs`,
603
- inputSchema: {
604
- type: "object",
605
- ...withPageId(
606
- {
607
- nodeId: {
608
- type: "string",
609
- description: "\u7EC4\u4EF6\u8282\u70B9 ID\uFF08\u4ECE vue-devtools_get_component_tree \u83B7\u53D6\uFF09"
610
- }
611
- },
612
- ["nodeId"]
613
- )
614
- }
615
- },
616
- {
617
- name: "vue-devtools_get_component_render_code",
618
- description: `\u83B7\u53D6\u7EC4\u4EF6\u7684\u6E32\u67D3\u51FD\u6570\u6E90\u7801\u3002`,
619
- inputSchema: {
620
- type: "object",
621
- ...withPageId({ nodeId: { type: "string", description: "\u7EC4\u4EF6\u8282\u70B9 ID" } }, ["nodeId"])
622
- }
623
- },
624
- {
625
- name: "vue-devtools_get_current_route",
626
- description: `\u83B7\u53D6 Vue Router \u7684\u5F53\u524D\u8DEF\u7531\u4FE1\u606F\u3002
627
-
628
- **\u4F55\u65F6\u4F7F\u7528**\uFF1A
629
- - \u6392\u67E5\u8DEF\u7531\u8DF3\u8F6C\u95EE\u9898
630
- - \u67E5\u770B\u5F53\u524D\u8DEF\u7531 path/params/query/hash
631
- - \u786E\u8BA4\u8DEF\u7531\u5B88\u536B\u548C matched \u8BB0\u5F55`,
632
- inputSchema: {
633
- type: "object",
634
- ...withPageId({})
635
- }
636
- },
637
- {
638
- name: "vue-devtools_get_routes",
639
- description: `\u83B7\u53D6 Vue Router \u7684\u5B8C\u6574\u8DEF\u7531\u8868\u3002
640
-
641
- **\u4F55\u65F6\u4F7F\u7528**\uFF1A
642
- - \u67E5\u770B\u6240\u6709\u5DF2\u6CE8\u518C\u8DEF\u7531
643
- - \u786E\u8BA4\u8DEF\u7531\u914D\u7F6E\u662F\u5426\u6B63\u786E
644
- - \u67E5\u770B\u8DEF\u7531\u5D4C\u5957\u5173\u7CFB`,
645
- inputSchema: {
646
- type: "object",
647
- ...withPageId({})
69
+ name: displayToolName("current_page"),
70
+ description: "Get the page the user is currently browsing (URL, title, and page ID). Resolves the project page with injected context; for allowOrigins pages use list_pages and pass its pageId to page tools instead.",
71
+ inputSchema: { type: "object", properties: {} }
72
+ }
73
+ ];
74
+ const UNSAFE_CATEGORIES = /* @__PURE__ */ new Set(["EXTENSIONS", "PWA", "THIRD_PARTY", "WEBMCP"]);
75
+ function metaByName(short) {
76
+ return import_official_meta.OFFICIAL_TOOL_META.find((m) => m.name === short);
77
+ }
78
+ function isOfficialExtraTool(short) {
79
+ const m = metaByName(short);
80
+ return !!m && m.conditions.length > 0 && !UNSAFE_CATEGORIES.has(m.category);
81
+ }
82
+ function camelToKebab(name) {
83
+ return name.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
84
+ }
85
+ function extraToolFlag(short) {
86
+ const m = metaByName(short);
87
+ if (!m) return void 0;
88
+ const cond = m.conditions.find((c) => c.startsWith("experimental"));
89
+ return cond ? `--${camelToKebab(cond)}` : void 0;
90
+ }
91
+ function officialExtraCandidates() {
92
+ return import_official_meta.OFFICIAL_TOOL_META.filter(
93
+ (m) => m.conditions.length > 0 && !UNSAFE_CATEGORIES.has(m.category)
94
+ ).map((m) => m.name);
95
+ }
96
+ function officialDefaultShorts() {
97
+ const pages = import_official_meta.OFFICIAL_TOOL_META.filter(
98
+ (m) => m.pageScoped && m.conditions.length === 0 && !UNSAFE_CATEGORIES.has(m.category)
99
+ ).map((m) => m.name).sort();
100
+ return [...pages, ...OFFICIAL_GLOBAL_POLICY];
101
+ }
102
+ let extraAllowed = /* @__PURE__ */ new Set();
103
+ let deniedShorts = /* @__PURE__ */ new Set();
104
+ function configureToolScope(extra = [], deny = [], warn = (msg) => console.warn(msg)) {
105
+ const allowedExtra = /* @__PURE__ */ new Set();
106
+ for (const short of extra) {
107
+ if (isOfficialExtraTool(short)) {
108
+ allowedExtra.add(short);
109
+ } else {
110
+ warn(`chromeMcp.project.tools.extra \u5DF2\u5FFD\u7565\u975E\u4E8C\u7EA7\u76EE\u5F55\u5DE5\u5177: ${short}`);
648
111
  }
649
- },
650
- // ===== Vite 进程日志 =====
651
- {
652
- name: "logs-devtools_vite_logs",
653
- description: `\u83B7\u53D6 Vite \u5F00\u53D1\u670D\u52A1\u5668\u7684\u8FD0\u884C\u65E5\u5FD7\u3002
654
-
655
- **\u4F55\u65F6\u4F7F\u7528\u6B64\u5DE5\u5177**\uFF1A
656
- - \u7528\u6237\u62A5\u544A"\u9875\u9762\u6CA1\u66F4\u65B0"\u3001"\u70ED\u66F4\u65B0\u4E0D\u5DE5\u4F5C"\u3001"HMR \u5931\u6548"\u65F6
657
- - \u6784\u5EFA\u62A5\u9519\u6216\u7F16\u8BD1\u5931\u8D25\uFF0C\u9700\u8981\u67E5\u770B\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F
658
- - \u9875\u9762\u767D\u5C4F\u3001\u6837\u5F0F\u4E22\u5931\u3001\u6A21\u5757\u52A0\u8F7D\u5931\u8D25\u7B49\u5F00\u53D1\u95EE\u9898
659
- - \u7528\u6237\u63D0\u5230"\u5F00\u53D1\u670D\u52A1\u5668\u6709\u95EE\u9898"\u3001"vite \u62A5\u9519"
660
- - \u9700\u8981\u786E\u8BA4\u6700\u8FD1\u7684\u6587\u4EF6\u53D8\u66F4\u662F\u5426\u88AB Vite \u6B63\u786E\u5904\u7406
661
-
662
- **\u65E5\u5FD7\u5185\u5BB9**\uFF1A
663
- - Vite HMR \u70ED\u66F4\u65B0\u65E5\u5FD7\uFF08\u54EA\u4E9B\u6587\u4EF6\u88AB\u66F4\u65B0\u3001\u66F4\u65B0\u72B6\u6001\uFF09
664
- - \u6784\u5EFA\u7F16\u8BD1\u65E5\u5FD7\uFF08\u9519\u8BEF\u3001\u8B66\u544A\u3001\u6210\u529F\u4FE1\u606F\uFF09
665
- - OpenCode Web \u8FDB\u7A0B\u8F93\u51FA
666
- - \u63D2\u4EF6\u8FD0\u884C\u65E5\u5FD7
667
-
668
- \u65E5\u5FD7\u4FDD\u5B58\u5728\u5185\u5B58\u7F13\u51B2\u533A\uFF08\u6700\u8FD1 500 \u6761\uFF09\u3002`,
669
- inputSchema: {
670
- type: "object",
671
- properties: {
672
- level: {
673
- type: "string",
674
- description: "\u65E5\u5FD7\u7EA7\u522B\u8FC7\u6EE4\uFF1Aerror(\u9519\u8BEF)\u3001warn(\u8B66\u544A)\u3001info(\u4FE1\u606F)\u3001debug(\u8C03\u8BD5)\u3001log(\u666E\u901A)\u3002\u591A\u4E2A\u7528\u9017\u53F7\u5206\u9694\uFF0C\u5982 'error,warn'"
675
- },
676
- limit: {
677
- type: "integer",
678
- minimum: 1,
679
- maximum: 200,
680
- default: 50,
681
- description: "\u8FD4\u56DE\u6761\u6570\uFF0C\u9ED8\u8BA4 50\uFF0C\u6700\u5927 200"
682
- },
683
- source: {
684
- type: "string",
685
- description: "\u6765\u6E90\u8FC7\u6EE4\uFF1Aconsole(\u63A7\u5236\u53F0)\u3001provider-stdout(\u670D\u52A1\u8F93\u51FA)\u3001provider-stderr(\u670D\u52A1\u9519\u8BEF)"
686
- }
687
- }
112
+ }
113
+ const known = /* @__PURE__ */ new Set([
114
+ ...officialDefaultShorts(),
115
+ ...officialExtraCandidates(),
116
+ "current_page"
117
+ ]);
118
+ const denied = /* @__PURE__ */ new Set();
119
+ for (const short of deny) {
120
+ if (known.has(short)) {
121
+ denied.add(short);
122
+ } else {
123
+ warn(`chromeMcp.project.tools.deny \u5DF2\u5FFD\u7565\u672A\u77E5\u5DE5\u5177\u540D: ${short}`);
688
124
  }
689
125
  }
690
- ];
126
+ extraAllowed = allowedExtra;
127
+ deniedShorts = denied;
128
+ }
129
+ function currentOfficialShorts() {
130
+ const base = officialDefaultShorts().filter((s) => !deniedShorts.has(s));
131
+ const extra = [...extraAllowed].filter((s) => !officialDefaultShorts().includes(s));
132
+ return [...base, ...extra];
133
+ }
134
+ function isAllowedToolName(name) {
135
+ if (name === displayToolName("current_page")) return true;
136
+ const short = name.startsWith(MCP_PREFIX) ? name.slice(MCP_PREFIX.length) : name;
137
+ if (deniedShorts.has(short)) return false;
138
+ if (officialDefaultShorts().includes(short)) return true;
139
+ return extraAllowed.has(short);
140
+ }
691
141
  // Annotate the CommonJS export names for ESM import in node:
692
142
  0 && (module.exports = {
693
- CUSTOM_TOOLS
143
+ CUSTOM_TOOLS,
144
+ MCP_PREFIX,
145
+ OFFICIAL_GLOBAL_POLICY,
146
+ OFFICIAL_NO_PAGE_TOOLS,
147
+ PAGE_ID_PROP,
148
+ PROJECT_DESCRIPTION_NOTES,
149
+ configureToolScope,
150
+ currentOfficialShorts,
151
+ displayToolName,
152
+ extraToolFlag,
153
+ isAllowedToolName,
154
+ isOfficialExtraTool,
155
+ officialDefaultShorts,
156
+ officialExtraCandidates,
157
+ withPageIdSchema
694
158
  });