@chenpx976/chrome-devtools-mcp 0.0.0-stage → 1.13.0

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 (398) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +223 -2
  3. package/out/Default/gen/src/ArcBrowser.js +128 -0
  4. package/out/Default/gen/src/BrowserManager.js +562 -0
  5. package/out/Default/gen/src/LogpointManager.js +287 -0
  6. package/out/Default/gen/src/McpContext.js +1031 -0
  7. package/out/Default/gen/src/McpPage.js +1427 -0
  8. package/out/Default/gen/src/McpResponse.js +1350 -0
  9. package/out/Default/gen/src/McpWorker.js +66 -0
  10. package/out/Default/gen/src/NetworkOverrideManager.js +447 -0
  11. package/out/Default/gen/src/SlimMcpResponse.js +23 -0
  12. package/out/Default/gen/src/TextSnapshot.js +336 -0
  13. package/out/Default/gen/src/ToolHandler.js +531 -0
  14. package/out/Default/gen/src/bin/check-latest-version.js +53 -0
  15. package/out/Default/gen/src/bin/chrome-devtools-mcp-main.js +80 -0
  16. package/out/Default/gen/src/bin/chrome-devtools-mcp.js +23 -0
  17. package/out/Default/gen/src/bin/chrome-devtools.js +213 -0
  18. package/out/Default/gen/src/collectors/PageCollector.js +325 -0
  19. package/out/Default/gen/src/collectors/ServiceWorkerCollector.js +198 -0
  20. package/out/Default/gen/src/collectors/constants.js +7 -0
  21. package/out/Default/gen/src/config/ConfigLocator.js +70 -0
  22. package/out/Default/gen/src/config/ConfigParser.js +163 -0
  23. package/out/Default/gen/src/config/ConfigWatcher.js +94 -0
  24. package/out/Default/gen/src/config/ServerConfig.js +284 -0
  25. package/out/Default/gen/src/config/browser-options.js +135 -0
  26. package/out/Default/gen/src/config/category-options.js +84 -0
  27. package/out/Default/gen/src/config/cli-commands.js +208 -0
  28. package/out/Default/gen/src/config/cli-options.js +2090 -0
  29. package/out/Default/gen/src/config/mcp-options.js +371 -0
  30. package/out/Default/gen/src/config/puppeteer-options.js +69 -0
  31. package/out/Default/gen/src/config/tool-options.js +60 -0
  32. package/out/Default/gen/src/daemon/client.js +281 -0
  33. package/out/Default/gen/src/daemon/daemon.js +280 -0
  34. package/out/Default/gen/src/daemon/types.js +7 -0
  35. package/out/Default/gen/src/daemon/utils.js +173 -0
  36. package/out/Default/gen/src/devtools/DevToolsCommentBridge.js +151 -0
  37. package/out/Default/gen/src/devtools/DevtoolsUtils.js +413 -0
  38. package/out/Default/gen/src/devtools/McpHostBindingAdapter.js +164 -0
  39. package/out/Default/gen/src/devtools/issueDescriptions.js +42 -0
  40. package/out/Default/gen/src/formatters/CommentFormatter.js +73 -0
  41. package/out/Default/gen/src/formatters/ConsoleFormatter.js +363 -0
  42. package/out/Default/gen/src/formatters/CssFormatter.js +883 -0
  43. package/out/Default/gen/src/formatters/HeapSnapshotFormatter.js +239 -0
  44. package/out/Default/gen/src/formatters/IssueFormatter.js +194 -0
  45. package/out/Default/gen/src/formatters/LogpointFormatter.js +62 -0
  46. package/out/Default/gen/src/formatters/NetworkFormatter.js +295 -0
  47. package/out/Default/gen/src/formatters/NetworkOverridesFormatter.js +57 -0
  48. package/out/Default/gen/src/formatters/RemoteObjectFormatter.js +231 -0
  49. package/out/Default/gen/src/formatters/SnapshotFormatter.js +172 -0
  50. package/out/Default/gen/src/formatters/WebAuthnFormatter.js +56 -0
  51. package/out/Default/gen/src/formatters/constants.js +8 -0
  52. package/out/Default/gen/src/index.js +434 -0
  53. package/out/Default/gen/src/processors/ChunkedTraceParser.js +361 -0
  54. package/out/Default/gen/src/processors/HeapSnapshotManager.js +595 -0
  55. package/out/Default/gen/src/processors/PerformanceTrace.js +132 -0
  56. package/out/Default/gen/src/telemetry/ClearcutLogger.js +271 -0
  57. package/out/Default/gen/src/telemetry/WatchdogClient.js +60 -0
  58. package/out/Default/gen/src/telemetry/errors.js +18 -0
  59. package/out/Default/gen/src/telemetry/flagUtils.js +89 -0
  60. package/out/Default/gen/src/telemetry/metricsRegistry.js +85 -0
  61. package/out/Default/gen/src/telemetry/persistence.js +82 -0
  62. package/out/Default/gen/src/telemetry/transformation.js +229 -0
  63. package/out/Default/gen/src/telemetry/types.js +36 -0
  64. package/out/Default/gen/src/telemetry/watchdog/ClearcutSender.js +213 -0
  65. package/out/Default/gen/src/telemetry/watchdog/main.js +142 -0
  66. package/out/Default/gen/src/third_party/THIRD_PARTY_NOTICES +3774 -0
  67. package/out/Default/gen/src/third_party/browser.js +808 -0
  68. package/out/Default/gen/src/third_party/bundled-packages.json +11 -0
  69. package/out/Default/gen/src/third_party/cli.js +139 -0
  70. package/out/Default/gen/src/third_party/devtools-formatter-worker.js +125 -0
  71. package/out/Default/gen/src/third_party/devtools-heap-snapshot-worker.js +111 -0
  72. package/out/Default/gen/src/third_party/index.js +128 -0
  73. package/out/Default/gen/src/third_party/issue-descriptions/CoepCoopSandboxedIframeCannotNavigateToCoopPage.md +4 -0
  74. package/out/Default/gen/src/third_party/issue-descriptions/CoepCorpNotSameOrigin.md +8 -0
  75. package/out/Default/gen/src/third_party/issue-descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md +18 -0
  76. package/out/Default/gen/src/third_party/issue-descriptions/CoepCorpNotSameSite.md +7 -0
  77. package/out/Default/gen/src/third_party/issue-descriptions/CoepFrameResourceNeedsCoepHeader.md +10 -0
  78. package/out/Default/gen/src/third_party/issue-descriptions/CompatibilityModeQuirks.md +5 -0
  79. package/out/Default/gen/src/third_party/issue-descriptions/CookieAttributeValueExceedsMaxSize.md +5 -0
  80. package/out/Default/gen/src/third_party/issue-descriptions/LowTextContrast.md +5 -0
  81. package/out/Default/gen/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorRead.md +8 -0
  82. package/out/Default/gen/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorSet.md +8 -0
  83. package/out/Default/gen/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnRead.md +8 -0
  84. package/out/Default/gen/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnSet.md +8 -0
  85. package/out/Default/gen/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeRead.md +9 -0
  86. package/out/Default/gen/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeSet.md +9 -0
  87. package/out/Default/gen/src/third_party/issue-descriptions/bounceTrackingMitigations.md +3 -0
  88. package/out/Default/gen/src/third_party/issue-descriptions/clientHintMetaTagAllowListInvalidOrigin.md +4 -0
  89. package/out/Default/gen/src/third_party/issue-descriptions/clientHintMetaTagModifiedHTML.md +4 -0
  90. package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistEmbeddingRequirementNotSatisfied.md +26 -0
  91. package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistIFrameAttributeLoosensEmbeddingRequirement.md +19 -0
  92. package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowConnectionAllowlistFrom.md +21 -0
  93. package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowlistItemType.md +12 -0
  94. package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistInvalidHeader.md +12 -0
  95. package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistInvalidUrlPattern.md +8 -0
  96. package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistItemNotInnerList.md +12 -0
  97. package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistMoreThanOneList.md +7 -0
  98. package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistReportingEndpointNotToken.md +10 -0
  99. package/out/Default/gen/src/third_party/issue-descriptions/cookieCrossSiteRedirectDowngrade.md +12 -0
  100. package/out/Default/gen/src/third_party/issue-descriptions/cookieExcludeDomainNonAscii.md +11 -0
  101. package/out/Default/gen/src/third_party/issue-descriptions/cookieExcludePortMismatch.md +8 -0
  102. package/out/Default/gen/src/third_party/issue-descriptions/cookieExcludeSchemeMismatch.md +7 -0
  103. package/out/Default/gen/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutRead.md +6 -0
  104. package/out/Default/gen/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutSet.md +6 -0
  105. package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnDomainNonAscii.md +11 -0
  106. package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnMetadataGrantRead.md +3 -0
  107. package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnMetadataGrantReadOptOut.md +5 -0
  108. package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnMetadataGrantSet.md +3 -0
  109. package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnMetadataGrantSetOptOut.md +5 -0
  110. package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutRead.md +6 -0
  111. package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutSet.md +6 -0
  112. package/out/Default/gen/src/third_party/issue-descriptions/corsAllowCredentialsRequired.md +6 -0
  113. package/out/Default/gen/src/third_party/issue-descriptions/corsDisabledScheme.md +7 -0
  114. package/out/Default/gen/src/third_party/issue-descriptions/corsDisallowedByMode.md +7 -0
  115. package/out/Default/gen/src/third_party/issue-descriptions/corsHeaderDisallowedByPreflightResponse.md +5 -0
  116. package/out/Default/gen/src/third_party/issue-descriptions/corsInvalidHeaderValues.md +7 -0
  117. package/out/Default/gen/src/third_party/issue-descriptions/corsLocalNetworkAccessPermissionDenied.md +19 -0
  118. package/out/Default/gen/src/third_party/issue-descriptions/corsMethodDisallowedByPreflightResponse.md +5 -0
  119. package/out/Default/gen/src/third_party/issue-descriptions/corsNoCorsRedirectModeNotFollow.md +5 -0
  120. package/out/Default/gen/src/third_party/issue-descriptions/corsOriginMismatch.md +6 -0
  121. package/out/Default/gen/src/third_party/issue-descriptions/corsPreflightResponseInvalid.md +5 -0
  122. package/out/Default/gen/src/third_party/issue-descriptions/corsRedirectContainsCredentials.md +5 -0
  123. package/out/Default/gen/src/third_party/issue-descriptions/corsWildcardOriginNotAllowed.md +9 -0
  124. package/out/Default/gen/src/third_party/issue-descriptions/cspEvalViolation.md +9 -0
  125. package/out/Default/gen/src/third_party/issue-descriptions/cspInlineViolation.md +10 -0
  126. package/out/Default/gen/src/third_party/issue-descriptions/cspTrustedTypesPolicyViolation.md +5 -0
  127. package/out/Default/gen/src/third_party/issue-descriptions/cspTrustedTypesSinkViolation.md +8 -0
  128. package/out/Default/gen/src/third_party/issue-descriptions/cspURLViolation.md +10 -0
  129. package/out/Default/gen/src/third_party/issue-descriptions/deprecation.md +3 -0
  130. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestAccountsEmptyList.md +1 -0
  131. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestAccountsHttpNotFound.md +1 -0
  132. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidContentType.md +1 -0
  133. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidResponse.md +1 -0
  134. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestAccountsNoResponse.md +1 -0
  135. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestDnsFetchFailed.md +1 -0
  136. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestDnsInvalidRecord.md +1 -0
  137. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownHttpNotFound.md +1 -0
  138. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidContentType.md +1 -0
  139. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidResponse.md +1 -0
  140. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownNoResponse.md +1 -0
  141. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestInvalidEmail.md +1 -0
  142. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestJwksHttpNotFound.md +1 -0
  143. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestJwksInvalidResponse.md +1 -0
  144. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestKeyBindingSigningFailed.md +1 -0
  145. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestRpOriginIsOpaque.md +1 -0
  146. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenHttpNotFound.md +1 -0
  147. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidContentType.md +1 -0
  148. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidResponse.md +1 -0
  149. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidSdJwt.md +1 -0
  150. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenMalformedSdJwt.md +1 -0
  151. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenNoResponse.md +1 -0
  152. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidAudience.md +1 -0
  153. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidIssuedAt.md +1 -0
  154. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidNonce.md +1 -0
  155. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidSdHash.md +1 -0
  156. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidTyp.md +1 -0
  157. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingAud.md +1 -0
  158. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingCnf.md +1 -0
  159. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingIat.md +1 -0
  160. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingNonce.md +1 -0
  161. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingSdHash.md +1 -0
  162. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbSignatureFailed.md +1 -0
  163. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmail.md +1 -0
  164. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmailVerified.md +1 -0
  165. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidHolderKey.md +1 -0
  166. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuedAt.md +1 -0
  167. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuer.md +1 -0
  168. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtJwksMissingKeys.md +1 -0
  169. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingCnf.md +1 -0
  170. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingEmail.md +1 -0
  171. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIat.md +1 -0
  172. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIss.md +1 -0
  173. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtSignatureFailed.md +1 -0
  174. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtUnsupportedHeaderAlg.md +1 -0
  175. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestUserLoggedOut.md +1 -0
  176. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownAccountsEndpointCrossOrigin.md +1 -0
  177. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownHttpNotFound.md +1 -0
  178. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidContentType.md +1 -0
  179. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidResponse.md +1 -0
  180. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownIssuanceEndpointCrossOrigin.md +1 -0
  181. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownListEmpty.md +1 -0
  182. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingAccountsEndpoint.md +1 -0
  183. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingIssuanceEndpoint.md +1 -0
  184. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownNoResponse.md +1 -0
  185. package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownUnsupportedSigningAlgorithm.md +1 -0
  186. package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestAccountsBlockedByConnectionAllowlist.md +1 -0
  187. package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestAccountsHttpNotFound.md +1 -0
  188. package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestAccountsInvalidResponse.md +1 -0
  189. package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestAccountsNoResponse.md +1 -0
  190. package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestApprovalDeclined.md +1 -0
  191. package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestCanceled.md +1 -0
  192. package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestConfigBlockedByConnectionAllowlist.md +1 -0
  193. package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestErrorFetchingSignin.md +1 -0
  194. package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestErrorIdToken.md +1 -0
  195. package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestIdTokenBlockedByConnectionAllowlist.md +1 -0
  196. package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestIdTokenHttpNotFound.md +1 -0
  197. package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidRequest.md +1 -0
  198. package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidResponse.md +1 -0
  199. package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestIdTokenNoResponse.md +1 -0
  200. package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestInvalidSigninResponse.md +1 -0
  201. package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestManifestHttpNotFound.md +1 -0
  202. package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestManifestInvalidResponse.md +1 -0
  203. package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestManifestNoResponse.md +1 -0
  204. package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestTooManyRequests.md +1 -0
  205. package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestWellKnownBlockedByConnectionAllowlist.md +1 -0
  206. package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidAccountsResponse.md +1 -0
  207. package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidConfigOrWellKnown.md +1 -0
  208. package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoAccountSharingPermission.md +1 -0
  209. package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoApiPermission.md +1 -0
  210. package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoReturningUserFromFetchedAccounts.md +1 -0
  211. package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotIframe.md +1 -0
  212. package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotPotentiallyTrustworthy.md +1 -0
  213. package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSameOrigin.md +1 -0
  214. package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSignedInWithIdp.md +1 -0
  215. package/out/Default/gen/src/third_party/issue-descriptions/fetchingPartitionedBlobURL.md +7 -0
  216. package/out/Default/gen/src/third_party/issue-descriptions/genericBackUINavigationWouldSkipAd.md +4 -0
  217. package/out/Default/gen/src/third_party/issue-descriptions/genericFormAriaLabelledByToNonExistingIdError.md +8 -0
  218. package/out/Default/gen/src/third_party/issue-descriptions/genericFormAutocompleteAttributeEmptyError.md +5 -0
  219. package/out/Default/gen/src/third_party/issue-descriptions/genericFormDuplicateIdForInputError.md +5 -0
  220. package/out/Default/gen/src/third_party/issue-descriptions/genericFormEmptyIdAndNameAttributesForInputError.md +5 -0
  221. package/out/Default/gen/src/third_party/issue-descriptions/genericFormInputAssignedAutocompleteValueToIdOrNameAttributeError.md +5 -0
  222. package/out/Default/gen/src/third_party/issue-descriptions/genericFormInputHasWrongButWellIntendedAutocompleteValueError.md +5 -0
  223. package/out/Default/gen/src/third_party/issue-descriptions/genericFormInputWithNoLabelError.md +5 -0
  224. package/out/Default/gen/src/third_party/issue-descriptions/genericFormLabelForMatchesNonExistingIdError.md +5 -0
  225. package/out/Default/gen/src/third_party/issue-descriptions/genericFormLabelForNameError.md +5 -0
  226. package/out/Default/gen/src/third_party/issue-descriptions/genericFormLabelHasNeitherForNorNestedInputError.md +5 -0
  227. package/out/Default/gen/src/third_party/issue-descriptions/genericFormModelContextMissingToolDescription.md +5 -0
  228. package/out/Default/gen/src/third_party/issue-descriptions/genericFormModelContextMissingToolName.md +5 -0
  229. package/out/Default/gen/src/third_party/issue-descriptions/genericFormModelContextParameterMissingName.md +5 -0
  230. package/out/Default/gen/src/third_party/issue-descriptions/genericFormModelContextParameterMissingTitleAndDescription.md +5 -0
  231. package/out/Default/gen/src/third_party/issue-descriptions/genericFormModelContextRequiredParameterMissingName.md +5 -0
  232. package/out/Default/gen/src/third_party/issue-descriptions/genericGeolocationPromptWithoutUserGesture.md +5 -0
  233. package/out/Default/gen/src/third_party/issue-descriptions/genericNavigationEntryMarkedSkippable.md +7 -0
  234. package/out/Default/gen/src/third_party/issue-descriptions/genericResponseWasBlockedByORB.md +4 -0
  235. package/out/Default/gen/src/third_party/issue-descriptions/heavyAd.md +10 -0
  236. package/out/Default/gen/src/third_party/issue-descriptions/lazyLoadImageZeroSize.md +7 -0
  237. package/out/Default/gen/src/third_party/issue-descriptions/mixedContent.md +5 -0
  238. package/out/Default/gen/src/third_party/issue-descriptions/navigatingPartitionedBlobURL.md +5 -0
  239. package/out/Default/gen/src/third_party/issue-descriptions/permissionElementActivationDisabled.md +7 -0
  240. package/out/Default/gen/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluder.md +9 -0
  241. package/out/Default/gen/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluderParent.md +9 -0
  242. package/out/Default/gen/src/third_party/issue-descriptions/permissionElementCspFrameAncestorsMissing.md +5 -0
  243. package/out/Default/gen/src/third_party/issue-descriptions/permissionElementFencedFrameDisallowed.md +5 -0
  244. package/out/Default/gen/src/third_party/issue-descriptions/permissionElementFontSizeTooLarge.md +5 -0
  245. package/out/Default/gen/src/third_party/issue-descriptions/permissionElementFontSizeTooSmall.md +5 -0
  246. package/out/Default/gen/src/third_party/issue-descriptions/permissionElementGeolocationDeprecated.md +5 -0
  247. package/out/Default/gen/src/third_party/issue-descriptions/permissionElementInsetBoxShadowUnsupported.md +5 -0
  248. package/out/Default/gen/src/third_party/issue-descriptions/permissionElementInvalidDisplayStyle.md +5 -0
  249. package/out/Default/gen/src/third_party/issue-descriptions/permissionElementInvalidSizeValue.md +5 -0
  250. package/out/Default/gen/src/third_party/issue-descriptions/permissionElementInvalidType.md +5 -0
  251. package/out/Default/gen/src/third_party/issue-descriptions/permissionElementInvalidTypeActivation.md +5 -0
  252. package/out/Default/gen/src/third_party/issue-descriptions/permissionElementLowContrast.md +5 -0
  253. package/out/Default/gen/src/third_party/issue-descriptions/permissionElementNonOpaqueColor.md +5 -0
  254. package/out/Default/gen/src/third_party/issue-descriptions/permissionElementPaddingBottomUnsupported.md +6 -0
  255. package/out/Default/gen/src/third_party/issue-descriptions/permissionElementPaddingRightUnsupported.md +6 -0
  256. package/out/Default/gen/src/third_party/issue-descriptions/permissionElementPermissionsPolicyBlocked.md +5 -0
  257. package/out/Default/gen/src/third_party/issue-descriptions/permissionElementRegistrationFailed.md +5 -0
  258. package/out/Default/gen/src/third_party/issue-descriptions/permissionElementRequestInProgress.md +5 -0
  259. package/out/Default/gen/src/third_party/issue-descriptions/permissionElementSecurityChecksFailed.md +5 -0
  260. package/out/Default/gen/src/third_party/issue-descriptions/permissionElementTypeNotSupported.md +5 -0
  261. package/out/Default/gen/src/third_party/issue-descriptions/permissionElementUntrustedEvent.md +7 -0
  262. package/out/Default/gen/src/third_party/issue-descriptions/placeholderDescriptionForInvisibleIssues.md +3 -0
  263. package/out/Default/gen/src/third_party/issue-descriptions/propertyRuleInvalidNameIssue.md +3 -0
  264. package/out/Default/gen/src/third_party/issue-descriptions/propertyRuleIssue.md +7 -0
  265. package/out/Default/gen/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedOptGroupChild.md +7 -0
  266. package/out/Default/gen/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedSelectChild.md +7 -0
  267. package/out/Default/gen/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentAttributesSelectDescendant.md +3 -0
  268. package/out/Default/gen/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentLegendChild.md +3 -0
  269. package/out/Default/gen/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentOptionChild.md +3 -0
  270. package/out/Default/gen/src/third_party/issue-descriptions/selectElementAccessibilityNonPhrasingContentOptionChild.md +3 -0
  271. package/out/Default/gen/src/third_party/issue-descriptions/selectivePermissionsIntervention.md +7 -0
  272. package/out/Default/gen/src/third_party/issue-descriptions/sharedArrayBuffer.md +7 -0
  273. package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryUseErrorCrossOriginNoCorsRequest.md +1 -0
  274. package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryUseErrorDictionaryLoadFailure.md +3 -0
  275. package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryUseErrorMatchingDictionaryNotUsed.md +3 -0
  276. package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryUseErrorUnexpectedContentDictionaryHeader.md +1 -0
  277. package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorCossOriginNoCorsRequest.md +1 -0
  278. package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorDisallowedBySettings.md +1 -0
  279. package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorExpiredResponse.md +3 -0
  280. package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorFeatureDisabled.md +3 -0
  281. package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInsufficientResources.md +1 -0
  282. package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidMatchField.md +1 -0
  283. package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidStructuredHeader.md +1 -0
  284. package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidTTLField.md +1 -0
  285. package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNavigationRequest.md +3 -0
  286. package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNoMatchField.md +1 -0
  287. package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonIntegerTTLField.md +1 -0
  288. package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonListMatchDestField.md +1 -0
  289. package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonSecureContext.md +3 -0
  290. package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringIdField.md +1 -0
  291. package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringInMatchDestList.md +1 -0
  292. package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringMatchField.md +1 -0
  293. package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonTokenTypeField.md +1 -0
  294. package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorRequestAborted.md +1 -0
  295. package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorShuttingDown.md +1 -0
  296. package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorTooLongIdField.md +3 -0
  297. package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorUnsupportedType.md +3 -0
  298. package/out/Default/gen/src/third_party/issue-descriptions/sriInvalidSignatureHeader.md +14 -0
  299. package/out/Default/gen/src/third_party/issue-descriptions/sriInvalidSignatureInputHeader.md +15 -0
  300. package/out/Default/gen/src/third_party/issue-descriptions/sriMissingSignatureHeader.md +8 -0
  301. package/out/Default/gen/src/third_party/issue-descriptions/sriMissingSignatureInputHeader.md +7 -0
  302. package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureHeaderValueIsIncorrectLength.md +11 -0
  303. package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureHeaderValueIsNotByteSequence.md +14 -0
  304. package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureHeaderValueIsParameterized.md +15 -0
  305. package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentName.md +8 -0
  306. package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentType.md +13 -0
  307. package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidDerivedComponentParameter.md +4 -0
  308. package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidHeaderComponentParameter.md +5 -0
  309. package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidParameter.md +11 -0
  310. package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderKeyIdLength.md +12 -0
  311. package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingLabel.md +6 -0
  312. package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingRequiredParameters.md +8 -0
  313. package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderValueMissingComponents.md +11 -0
  314. package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderValueNotInnerList.md +11 -0
  315. package/out/Default/gen/src/third_party/issue-descriptions/sriValidationFailedIntegrityMismatch.md +12 -0
  316. package/out/Default/gen/src/third_party/issue-descriptions/sriValidationFailedInvalidLength.md +5 -0
  317. package/out/Default/gen/src/third_party/issue-descriptions/sriValidationFailedSignatureExpired.md +6 -0
  318. package/out/Default/gen/src/third_party/issue-descriptions/sriValidationFailedSignatureMismatch.md +11 -0
  319. package/out/Default/gen/src/third_party/issue-descriptions/stylesheetLateImport.md +4 -0
  320. package/out/Default/gen/src/third_party/issue-descriptions/stylesheetRequestFailed.md +3 -0
  321. package/out/Default/gen/src/third_party/issue-descriptions/summaryElementAccessibilityInteractiveContentSummaryDescendant.md +3 -0
  322. package/out/Default/gen/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestLength.md +12 -0
  323. package/out/Default/gen/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestType.md +17 -0
  324. package/out/Default/gen/src/third_party/issue-descriptions/unencodedDigestMalformedDictionary.md +14 -0
  325. package/out/Default/gen/src/third_party/issue-descriptions/unencodedDigestUnknownAlgorithm.md +15 -0
  326. package/out/Default/gen/src/third_party/issue-descriptions/webInstallManifestMissingId.md +3 -0
  327. package/out/Default/gen/src/third_party/issue-descriptions/webInstallManifestMissingNameOrShortName.md +3 -0
  328. package/out/Default/gen/src/third_party/issue-descriptions/webInstallManifestParsingOrNetworkError.md +3 -0
  329. package/out/Default/gen/src/third_party/issue-descriptions/webInstallNoManifest.md +3 -0
  330. package/out/Default/gen/src/third_party/issue-descriptions/webInstallStartUrlInvalid.md +3 -0
  331. package/out/Default/gen/src/third_party/lighthouse-devtools-mcp-bundle.js +60395 -0
  332. package/out/Default/gen/src/tools/ToolDefinition.js +180 -0
  333. package/out/Default/gen/src/tools/categories.js +37 -0
  334. package/out/Default/gen/src/tools/comments.js +230 -0
  335. package/out/Default/gen/src/tools/console.js +122 -0
  336. package/out/Default/gen/src/tools/css.js +54 -0
  337. package/out/Default/gen/src/tools/emulation.js +98 -0
  338. package/out/Default/gen/src/tools/extensions.js +108 -0
  339. package/out/Default/gen/src/tools/input.js +658 -0
  340. package/out/Default/gen/src/tools/lighthouse.js +279 -0
  341. package/out/Default/gen/src/tools/logpoints.js +51 -0
  342. package/out/Default/gen/src/tools/memory.js +531 -0
  343. package/out/Default/gen/src/tools/network.js +325 -0
  344. package/out/Default/gen/src/tools/pages.js +420 -0
  345. package/out/Default/gen/src/tools/performance.js +258 -0
  346. package/out/Default/gen/src/tools/pwa.js +152 -0
  347. package/out/Default/gen/src/tools/screencast.js +160 -0
  348. package/out/Default/gen/src/tools/screenshot.js +315 -0
  349. package/out/Default/gen/src/tools/script.js +319 -0
  350. package/out/Default/gen/src/tools/slim/tools.js +110 -0
  351. package/out/Default/gen/src/tools/snapshot.js +88 -0
  352. package/out/Default/gen/src/tools/thirdPartyDeveloper.js +73 -0
  353. package/out/Default/gen/src/tools/toolNames.js +10 -0
  354. package/out/Default/gen/src/tools/tools.js +72 -0
  355. package/out/Default/gen/src/tools/webauthn.js +51 -0
  356. package/out/Default/gen/src/tools/webmcp.js +55 -0
  357. package/out/Default/gen/src/types.js +21 -0
  358. package/out/Default/gen/src/utils/TaskRunner.js +151 -0
  359. package/out/Default/gen/src/utils/WaitForHelper.js +343 -0
  360. package/out/Default/gen/src/utils/bytes.js +95 -0
  361. package/out/Default/gen/src/utils/check-for-updates.js +81 -0
  362. package/out/Default/gen/src/utils/disclaimers.js +27 -0
  363. package/out/Default/gen/src/utils/errorHandling.js +23 -0
  364. package/out/Default/gen/src/utils/files.js +81 -0
  365. package/out/Default/gen/src/utils/id.js +16 -0
  366. package/out/Default/gen/src/utils/keyboard.js +307 -0
  367. package/out/Default/gen/src/utils/logger.js +145 -0
  368. package/out/Default/gen/src/utils/logpoint.js +44 -0
  369. package/out/Default/gen/src/utils/network.js +81 -0
  370. package/out/Default/gen/src/utils/pagination.js +50 -0
  371. package/out/Default/gen/src/utils/polyfill.js +11 -0
  372. package/out/Default/gen/src/utils/raceWithSignal.js +26 -0
  373. package/out/Default/gen/src/utils/resourceType.js +27 -0
  374. package/out/Default/gen/src/utils/text.js +43 -0
  375. package/out/Default/gen/src/utils/timeout.js +14 -0
  376. package/out/Default/gen/src/utils/url.js +311 -0
  377. package/out/Default/gen/src/version.js +11 -0
  378. package/package.json +125 -4
  379. package/skills/a11y-debugging/SKILL.md +86 -0
  380. package/skills/a11y-debugging/references/a11y-snippets.md +92 -0
  381. package/skills/arc-compatibility/SKILL.md +168 -0
  382. package/skills/arc-compatibility/SOURCES.md +216 -0
  383. package/skills/arc-compatibility/references/compatibility.md +113 -0
  384. package/skills/arc-compatibility/references/output-contract.md +62 -0
  385. package/skills/arc-compatibility/references/workflows.md +105 -0
  386. package/skills/chrome-devtools/SKILL.md +80 -0
  387. package/skills/chrome-devtools-cli/SKILL.md +208 -0
  388. package/skills/chrome-devtools-cli/references/installation.md +24 -0
  389. package/skills/cookie-debugging/SKILL.md +152 -0
  390. package/skills/debug-optimize-lcp/SKILL.md +121 -0
  391. package/skills/debug-optimize-lcp/references/elements-and-size.md +27 -0
  392. package/skills/debug-optimize-lcp/references/lcp-breakdown.md +23 -0
  393. package/skills/debug-optimize-lcp/references/lcp-snippets.md +79 -0
  394. package/skills/debug-optimize-lcp/references/optimization-strategies.md +38 -0
  395. package/skills/inspect-in-devtools/SKILL.md +82 -0
  396. package/skills/memory-leak-debugging/SKILL.md +58 -0
  397. package/skills/memory-leak-debugging/references/common-leaks.md +33 -0
  398. package/skills/troubleshooting/SKILL.md +107 -0
@@ -0,0 +1,420 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { zod } from '../third_party/index.js';
7
+ import { logger } from '../utils/logger.js';
8
+ import { validateUrl } from '../utils/url.js';
9
+ import { ToolCategory } from './categories.js';
10
+ import { CLOSE_PAGE_ERROR, definePageTool, defineTool, timeoutSchema, } from './ToolDefinition.js';
11
+ export const listPages = defineTool((args) => {
12
+ return {
13
+ name: 'list_pages',
14
+ description: `Get a list of pages${args?.categoryExtensions ? ' including extension service workers' : ''} open in the browser.`,
15
+ annotations: {
16
+ category: ToolCategory.NAVIGATION,
17
+ readOnlyHint: true,
18
+ },
19
+ schema: {},
20
+ blockedByDialog: false,
21
+ concurrency: 'exclusive',
22
+ verifyFilesSchema: {},
23
+ handler: async (_request, response) => {
24
+ response.setIncludePages(true);
25
+ response.setListThirdPartyDeveloperTools();
26
+ response.setListWebMcpTools();
27
+ },
28
+ };
29
+ });
30
+ export const selectPage = defineTool((args) => ({
31
+ name: 'select_page',
32
+ description: `Select a page as a context for future tool calls.`,
33
+ annotations: {
34
+ category: ToolCategory.NAVIGATION,
35
+ readOnlyHint: true,
36
+ },
37
+ schema: {
38
+ pageId: zod
39
+ .number()
40
+ .describe(`The ID of the page to select. Call ${listPages(args).name} to get available pages.`),
41
+ bringToFront: zod
42
+ .boolean()
43
+ .optional()
44
+ .describe('Whether to focus the page and bring it to the top.'),
45
+ },
46
+ blockedByDialog: false,
47
+ concurrency: 'exclusive',
48
+ verifyFilesSchema: {},
49
+ handler: async (request, response, context) => {
50
+ const page = context.getPageById(request.params.pageId);
51
+ await page.init({ emulateFocus: true });
52
+ context.selectPage(page);
53
+ response.setIncludePages(true);
54
+ response.setListThirdPartyDeveloperTools();
55
+ response.setListWebMcpTools();
56
+ if (request.params.bringToFront) {
57
+ await page.pptrPage.bringToFront();
58
+ }
59
+ },
60
+ }));
61
+ export const closePage = defineTool(() => ({
62
+ name: 'close_page',
63
+ description: `Closes the page by its index. The last open page cannot be closed.`,
64
+ annotations: {
65
+ category: ToolCategory.NAVIGATION,
66
+ readOnlyHint: false,
67
+ },
68
+ schema: {
69
+ pageId: zod
70
+ .number()
71
+ .describe('The ID of the page to close. Call list_pages to list pages.'),
72
+ },
73
+ blockedByDialog: false,
74
+ concurrency: 'exclusive',
75
+ verifyFilesSchema: {},
76
+ handler: async (request, response, context) => {
77
+ try {
78
+ await context.closePage(request.params.pageId);
79
+ }
80
+ catch (err) {
81
+ if (err.message === CLOSE_PAGE_ERROR) {
82
+ response.appendResponseLine(err.message);
83
+ }
84
+ else {
85
+ throw err;
86
+ }
87
+ }
88
+ response.setIncludePages(true);
89
+ response.setListThirdPartyDeveloperTools();
90
+ },
91
+ }));
92
+ export const newPage = defineTool((args) => {
93
+ return {
94
+ name: 'new_page',
95
+ description: `Open a new tab and load a URL. Use project URL if not specified otherwise.${args?.backgroundNewPages ? ' The tab always opens in the background.' : ''}`,
96
+ annotations: {
97
+ category: ToolCategory.NAVIGATION,
98
+ readOnlyHint: false,
99
+ },
100
+ schema: {
101
+ url: zod.string().describe('URL to load in a new page.'),
102
+ // With --backgroundNewPages the server decides, so the model is not offered the choice.
103
+ ...(args?.backgroundNewPages
104
+ ? {}
105
+ : {
106
+ background: zod
107
+ .boolean()
108
+ .optional()
109
+ .describe('Whether to open the page in the background without bringing it to the front. Default is false (foreground).'),
110
+ }),
111
+ isolatedContext: zod
112
+ .string()
113
+ .optional()
114
+ .refine(value => !args.arc || value === undefined, {
115
+ message: 'Arc does not support new_page isolatedContext.',
116
+ })
117
+ .describe('If specified, the page is created in an isolated browser context with the given name. ' +
118
+ 'Pages in the same browser context share cookies and storage. ' +
119
+ 'Pages in different browser contexts are fully isolated (useful for clean-slate testing of cookies and authentication). ' +
120
+ 'Not supported with --arc.'),
121
+ ...timeoutSchema,
122
+ },
123
+ blockedByDialog: false,
124
+ concurrency: 'exclusive',
125
+ verifyFilesSchema: {},
126
+ handler: async (request, response, context) => {
127
+ validateUrl(request.params.url, {
128
+ javascriptEvaluation: args?.javascriptEvaluation,
129
+ categoryExtensions: args?.categoryExtensions,
130
+ fileNavigations: args?.fileNavigations,
131
+ });
132
+ let previousPage;
133
+ try {
134
+ previousPage = context.getSelectedMcpPage();
135
+ }
136
+ catch {
137
+ // Nothing is selected, so there is no selection to restore on failure.
138
+ }
139
+ const page = await context.newPage(args?.backgroundNewPages
140
+ ? true
141
+ : request.params.background, request.params.isolatedContext);
142
+ response.includeConsoleErrorsFrom(page);
143
+ try {
144
+ await page.waitForEventsAfterAction(async () => {
145
+ await page.pptrPage.goto(request.params.url, {
146
+ timeout: request.params.timeout,
147
+ });
148
+ }, { timeout: request.params.timeout });
149
+ }
150
+ catch (error) {
151
+ // A dialog-blocked load stays open for handle_dialog. Otherwise cleanup is
152
+ // best-effort: the navigation error is always what gets rethrown.
153
+ if (page.getDialog()) {
154
+ response.setIncludePages(true);
155
+ }
156
+ else {
157
+ try {
158
+ if (previousPage && !previousPage.isClosed()) {
159
+ context.selectPage(previousPage);
160
+ }
161
+ }
162
+ catch {
163
+ // Keep the new tab selected.
164
+ }
165
+ try {
166
+ await context.closePage(page.id);
167
+ }
168
+ catch {
169
+ // The tab survived, so list pages to tell the caller its pageId.
170
+ response.setIncludePages(true);
171
+ }
172
+ }
173
+ throw error;
174
+ }
175
+ response.setIncludePages(true);
176
+ response.setListThirdPartyDeveloperTools();
177
+ },
178
+ };
179
+ });
180
+ export const navigatePage = definePageTool((args) => {
181
+ return {
182
+ name: 'navigate_page',
183
+ description: `Go to a URL, or back, forward, or reload. Use project URL if not specified otherwise.`,
184
+ annotations: {
185
+ category: ToolCategory.NAVIGATION,
186
+ readOnlyHint: false,
187
+ },
188
+ schema: {
189
+ type: zod
190
+ .enum(['url', 'back', 'forward', 'reload'])
191
+ .optional()
192
+ .describe('Navigate the page by URL, back or forward in history, or reload.'),
193
+ url: zod.string().optional().describe('Target URL (only type=url)'),
194
+ ignoreCache: zod
195
+ .boolean()
196
+ .optional()
197
+ .describe('Whether to ignore cache on reload.'),
198
+ handleBeforeUnload: zod
199
+ .enum(['accept', 'dismiss'])
200
+ .optional()
201
+ .describe('Whether to auto accept or beforeunload dialogs triggered by this navigation. Default is accept.'),
202
+ ...(args?.javascriptEvaluation !== false
203
+ ? {
204
+ initScript: zod
205
+ .string()
206
+ .optional()
207
+ .describe('A JavaScript script to be executed on each new document before any other scripts for the next navigation.'),
208
+ }
209
+ : {}),
210
+ ...timeoutSchema,
211
+ },
212
+ blockedByDialog: false,
213
+ concurrency: 'page',
214
+ verifyFilesSchema: {},
215
+ handler: async (request, response) => {
216
+ const page = request.page;
217
+ const options = {
218
+ timeout: request.params.timeout,
219
+ };
220
+ if (!request.params.type && !request.params.url) {
221
+ throw new Error('Either URL or a type is required.');
222
+ }
223
+ if (!request.params.type) {
224
+ request.params.type = 'url';
225
+ }
226
+ if (request.params.url) {
227
+ validateUrl(request.params.url, {
228
+ javascriptEvaluation: args?.javascriptEvaluation,
229
+ categoryExtensions: args?.categoryExtensions,
230
+ fileNavigations: args?.fileNavigations,
231
+ });
232
+ }
233
+ let initScriptId;
234
+ if (request.params.initScript) {
235
+ const { identifier } = await page.pptrPage.evaluateOnNewDocument(request.params.initScript);
236
+ initScriptId = identifier;
237
+ }
238
+ try {
239
+ const action = request.params.handleBeforeUnload ?? 'accept';
240
+ const result = await page.waitForEventsAfterAction(async () => {
241
+ switch (request.params.type) {
242
+ case 'url':
243
+ if (!request.params.url) {
244
+ throw new Error('A URL is required for navigation of type=url.');
245
+ }
246
+ try {
247
+ await page.pptrPage.goto(request.params.url, options);
248
+ response.appendResponseLine(`Successfully navigated to ${request.params.url}.`);
249
+ }
250
+ catch (error) {
251
+ response.appendResponseLine(`Unable to navigate in the selected page: ${error.message}.`);
252
+ }
253
+ break;
254
+ case 'back':
255
+ try {
256
+ await page.pptrPage.goBack(options);
257
+ response.appendResponseLine(`Successfully navigated back to ${page.pptrPage.url()}.`);
258
+ }
259
+ catch (error) {
260
+ response.appendResponseLine(`Unable to navigate back in the selected page: ${error.message}.`);
261
+ }
262
+ break;
263
+ case 'forward':
264
+ try {
265
+ await page.pptrPage.goForward(options);
266
+ response.appendResponseLine(`Successfully navigated forward to ${page.pptrPage.url()}.`);
267
+ }
268
+ catch (error) {
269
+ response.appendResponseLine(`Unable to navigate forward in the selected page: ${error.message}.`);
270
+ }
271
+ break;
272
+ case 'reload':
273
+ try {
274
+ await page.pptrPage.reload({
275
+ ...options,
276
+ ignoreCache: request.params.ignoreCache,
277
+ });
278
+ response.appendResponseLine(`Successfully reloaded the page.`);
279
+ }
280
+ catch (error) {
281
+ response.appendResponseLine(`Unable to reload the selected page: ${error.message}.`);
282
+ }
283
+ break;
284
+ }
285
+ }, {
286
+ timeout: request.params.timeout,
287
+ handleDialog: { beforeunload: action },
288
+ });
289
+ if (result.dialogHandled) {
290
+ response.appendResponseLine(`${action === 'dismiss' ? 'Dismissed' : 'Accepted'} a beforeunload dialog.`);
291
+ page.clearDialog();
292
+ }
293
+ }
294
+ finally {
295
+ if (initScriptId) {
296
+ await page.pptrPage
297
+ .removeScriptToEvaluateOnNewDocument(initScriptId)
298
+ .catch(error => {
299
+ logger?.(`Failed to remove init script`, error);
300
+ });
301
+ }
302
+ }
303
+ response.setIncludePages(true);
304
+ response.setListThirdPartyDeveloperTools();
305
+ response.setListWebMcpTools();
306
+ },
307
+ };
308
+ });
309
+ export const resizePage = definePageTool(() => ({
310
+ name: 'resize_page',
311
+ description: 'Requests the specified page dimensions. Chrome may enforce a minimum window size, so the resulting page dimensions can differ from the requested values.',
312
+ annotations: {
313
+ category: ToolCategory.EMULATION,
314
+ readOnlyHint: false,
315
+ },
316
+ schema: {
317
+ width: zod.number().int().positive().describe('Page width'),
318
+ height: zod.number().int().positive().describe('Page height'),
319
+ },
320
+ blockedByDialog: false,
321
+ concurrency: 'exclusive',
322
+ verifyFilesSchema: {},
323
+ handler: async (request, response) => {
324
+ const page = request.page;
325
+ try {
326
+ const browser = page.pptrPage.browser();
327
+ const windowId = await page.pptrPage.windowId();
328
+ const bounds = await browser.getWindowBounds(windowId);
329
+ if (bounds.windowState === 'fullscreen') {
330
+ // Have to call this twice on Ubuntu when the window is in fullscreen mode.
331
+ await browser.setWindowBounds(windowId, { windowState: 'normal' });
332
+ await browser.setWindowBounds(windowId, { windowState: 'normal' });
333
+ }
334
+ else if (bounds.windowState !== 'normal') {
335
+ await browser.setWindowBounds(windowId, { windowState: 'normal' });
336
+ }
337
+ }
338
+ catch {
339
+ // Window APIs are not supported on all platforms
340
+ }
341
+ await page.pptrPage.resize({
342
+ contentWidth: request.params.width,
343
+ contentHeight: request.params.height,
344
+ });
345
+ response.setIncludePages(true);
346
+ },
347
+ }));
348
+ export const handleDialog = definePageTool(() => ({
349
+ name: 'handle_dialog',
350
+ description: `If a browser dialog was opened, use this command to handle it`,
351
+ annotations: {
352
+ category: ToolCategory.INPUT,
353
+ readOnlyHint: false,
354
+ },
355
+ schema: {
356
+ action: zod
357
+ .enum(['accept', 'dismiss'])
358
+ .describe('Whether to dismiss or accept the dialog'),
359
+ promptText: zod
360
+ .string()
361
+ .optional()
362
+ .describe('Optional prompt text to enter into the dialog.'),
363
+ },
364
+ blockedByDialog: false,
365
+ concurrency: 'page',
366
+ verifyFilesSchema: {},
367
+ handler: async (request, response) => {
368
+ const page = request.page;
369
+ const dialog = page.getDialog();
370
+ if (!dialog) {
371
+ throw new Error('No open dialog found');
372
+ }
373
+ switch (request.params.action) {
374
+ case 'accept': {
375
+ try {
376
+ await dialog.accept(request.params.promptText);
377
+ }
378
+ catch (err) {
379
+ // Likely already handled by the user outside of MCP.
380
+ logger?.(err);
381
+ }
382
+ response.appendResponseLine('Successfully accepted the dialog');
383
+ break;
384
+ }
385
+ case 'dismiss': {
386
+ try {
387
+ await dialog.dismiss();
388
+ }
389
+ catch (err) {
390
+ // Likely already handled.
391
+ logger?.(err);
392
+ }
393
+ response.appendResponseLine('Successfully dismissed the dialog');
394
+ break;
395
+ }
396
+ }
397
+ page.clearDialog();
398
+ response.setIncludePages(true);
399
+ },
400
+ }));
401
+ export const getTabId = definePageTool(() => ({
402
+ name: 'get_tab_id',
403
+ description: `Get the tab ID of the page`,
404
+ annotations: {
405
+ category: ToolCategory.NAVIGATION,
406
+ readOnlyHint: true,
407
+ conditions: ['experimentalInteropTools'],
408
+ },
409
+ schema: {},
410
+ blockedByDialog: false,
411
+ concurrency: 'page',
412
+ verifyFilesSchema: {},
413
+ handler: async (request, response) => {
414
+ const page = request.page;
415
+ const tabId = page.pptrPage._tabId;
416
+ response.setTabId(tabId);
417
+ response.appendResponseLine(`Tab ID: ${tabId}`);
418
+ },
419
+ }));
420
+ //# sourceMappingURL=pages.js.map
@@ -0,0 +1,258 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import zlib from 'node:zlib';
7
+ import { loadBrowser, zod } from '../third_party/index.js';
8
+ import { logger } from '../utils/logger.js';
9
+ import { NetworkOverridesFormatter } from '../formatters/NetworkOverridesFormatter.js';
10
+ import { ToolCategory } from './categories.js';
11
+ import { definePageTool, } from './ToolDefinition.js';
12
+ const filePathSchema = zod
13
+ .string()
14
+ .optional()
15
+ .describe('The absolute file path, or a file path relative to the current working directory, to save the raw trace data. For example, trace.json.gz (compressed) or trace.json (uncompressed).');
16
+ export const startTrace = definePageTool(() => ({
17
+ name: 'performance_start_trace',
18
+ description: `Start a performance trace on the target webpage. Use to find frontend performance issues, Core Web Vitals (LCP, INP, CLS), and improve page load speed.`,
19
+ annotations: {
20
+ category: ToolCategory.PERFORMANCE,
21
+ readOnlyHint: false,
22
+ },
23
+ schema: {
24
+ reload: zod
25
+ .boolean()
26
+ .default(true)
27
+ .describe('Determines if, once tracing has started, the target page should be automatically reloaded. Navigate the page to the right URL using the navigate_page tool BEFORE starting the trace if reload or autoStop is set to true.'),
28
+ autoStop: zod
29
+ .boolean()
30
+ .default(true)
31
+ .describe('Determines if the trace recording should be automatically stopped.'),
32
+ ignoreCache: zod
33
+ .boolean()
34
+ .optional()
35
+ .describe('Whether to bypass the HTTP cache when reloading the page, to measure a cold page load. Only applies if reload is true. Active network mocks always disable the page HTTP cache.'),
36
+ filePath: filePathSchema,
37
+ },
38
+ blockedByDialog: true,
39
+ concurrency: 'exclusive',
40
+ verifyFilesSchema: {
41
+ filePath: true,
42
+ },
43
+ handler: async (request, response, context) => {
44
+ if (context.isRunningPerformanceTrace()) {
45
+ response.appendResponseLine('Error: a performance trace is already running. Use performance_stop_trace to stop it. Only one trace can be running at any given time.');
46
+ return;
47
+ }
48
+ const page = request.page;
49
+ const networkOverrides = page.listNetworkMocks();
50
+ const { warning } = new NetworkOverridesFormatter(networkOverrides).toJSON();
51
+ if (warning) {
52
+ response.appendResponseLine(warning);
53
+ }
54
+ page.setIsRunningPerformanceTrace(true);
55
+ const pageUrlForTracing = page.pptrPage.url();
56
+ try {
57
+ if (request.params.reload) {
58
+ // Before starting the recording, navigate to about:blank to clear out any state.
59
+ // We use `load` because `networkidle0` is known to be flaky for about:blank in Puppeteer.
60
+ await page.pptrPage.goto('about:blank', {
61
+ waitUntil: 'load',
62
+ });
63
+ }
64
+ const { DevTools } = await loadBrowser();
65
+ const categories = [
66
+ '-*',
67
+ ...DevTools.TracingDefaultCategories,
68
+ // These categories are optional in DevTools, but enabled by default in the DevTools UI, so we enable them here too.
69
+ ...DevTools.TracingOptionalCategories.JsSampling,
70
+ ...DevTools.TracingOptionalCategories.Screenshot,
71
+ ];
72
+ await page.pptrPage.tracing.start({
73
+ categories,
74
+ bufferSize: 1200 * 1000,
75
+ });
76
+ if (request.params.reload) {
77
+ const ignoreCache = request.params.ignoreCache === true && networkOverrides.length === 0;
78
+ if (ignoreCache) {
79
+ // Disable the HTTP cache so that the main document and all
80
+ // subresources are fetched from the network, like a hard reload.
81
+ await page.pptrPage.setCacheEnabled(false);
82
+ }
83
+ try {
84
+ await page.pptrPage.goto(pageUrlForTracing, {
85
+ waitUntil: ['load'],
86
+ });
87
+ }
88
+ finally {
89
+ if (ignoreCache) {
90
+ await page.pptrPage.setCacheEnabled(true);
91
+ }
92
+ }
93
+ }
94
+ if (request.params.autoStop) {
95
+ await new Promise(resolve => setTimeout(resolve, 5_000));
96
+ await stopTracingAndAppendOutput(page, response, context, request.params.filePath);
97
+ }
98
+ else {
99
+ response.appendResponseLine(`The performance trace is being recorded. Use performance_stop_trace to stop it.`);
100
+ }
101
+ }
102
+ catch (error) {
103
+ // If a setup step (navigation, tracing.start) throws before
104
+ // stopTracingAndAppendOutput runs, the running flag would otherwise stay
105
+ // stuck `true` for the rest of the session, blocking all future traces.
106
+ // Unwind here: stop tracing if it was started and clear the flag. When
107
+ // autoStop already ran stopTracingAndAppendOutput the flag is already
108
+ // false and this is a no-op.
109
+ if (context.isRunningPerformanceTrace()) {
110
+ try {
111
+ await page.pptrPage.tracing.stop();
112
+ }
113
+ catch {
114
+ // Tracing may not have started yet; ignore.
115
+ }
116
+ page.setIsRunningPerformanceTrace(false);
117
+ }
118
+ throw error;
119
+ }
120
+ },
121
+ }));
122
+ export const stopTrace = definePageTool((args) => ({
123
+ name: 'performance_stop_trace',
124
+ description: 'Stop the active performance trace recording on the target webpage.',
125
+ annotations: {
126
+ category: ToolCategory.PERFORMANCE,
127
+ readOnlyHint: false,
128
+ },
129
+ schema: {
130
+ filePath: filePathSchema,
131
+ },
132
+ blockedByDialog: true,
133
+ concurrency: 'exclusive',
134
+ verifyFilesSchema: {
135
+ filePath: true,
136
+ },
137
+ handler: async (request, response, context) => {
138
+ if (!context.isRunningPerformanceTrace()) {
139
+ response.appendResponseLine('Error: no active performance trace recording to stop.');
140
+ return;
141
+ }
142
+ const page = request.page;
143
+ if (!page.isRunningPerformanceTrace()) {
144
+ const tracedPage = context
145
+ .getPages()
146
+ .find(p => p.isRunningPerformanceTrace());
147
+ const pageHint = tracedPage ? ` on page ${tracedPage.id}` : '';
148
+ const actionHint = tracedPage
149
+ ? args.pageIdRouting
150
+ ? `Pass pageId: ${tracedPage.id} to performance_stop_trace to stop it.`
151
+ : `Select page ${tracedPage.id} with select_page first, then call performance_stop_trace.`
152
+ : 'Select the page that started the trace and try again.';
153
+ response.appendResponseLine(`Error: the active performance trace is running${pageHint}, not on page ${page.id}. ${actionHint}`);
154
+ return;
155
+ }
156
+ const { warning } = new NetworkOverridesFormatter(page.listNetworkMocks()).toJSON();
157
+ if (warning) {
158
+ response.appendResponseLine(warning);
159
+ }
160
+ await stopTracingAndAppendOutput(page, response, context, request.params.filePath);
161
+ },
162
+ }));
163
+ export const analyzeInsight = definePageTool(() => ({
164
+ name: 'performance_analyze_insight',
165
+ description: 'Provides more detailed information on a specific Performance Insight of an insight set that was highlighted in the results of a trace recording.',
166
+ annotations: {
167
+ category: ToolCategory.PERFORMANCE,
168
+ readOnlyHint: true,
169
+ },
170
+ schema: {
171
+ insightSetId: zod
172
+ .string()
173
+ .describe('The id for the specific insight set. Only use the ids given in the "Available insight sets" list.'),
174
+ insightName: zod
175
+ .string()
176
+ .describe('The name of the Insight you want more information on. For example: "DocumentLatency" or "LCPBreakdown"'),
177
+ },
178
+ blockedByDialog: false,
179
+ concurrency: 'exclusive',
180
+ verifyFilesSchema: {},
181
+ handler: async (request, response, context) => {
182
+ const lastRecording = context.recordedTraces().at(-1);
183
+ if (!lastRecording) {
184
+ response.appendResponseLine('No recorded traces found. Record a performance trace so you have Insights to analyze.');
185
+ return;
186
+ }
187
+ response.attachTraceInsight(lastRecording, request.params.insightSetId, request.params.insightName);
188
+ },
189
+ }));
190
+ async function stopTracingAndAppendOutput(page, response, context, filePath) {
191
+ try {
192
+ const traceEventsBuffer = await page.pptrPage.tracing.stop();
193
+ if (filePath && traceEventsBuffer) {
194
+ let dataToWrite = traceEventsBuffer;
195
+ if (filePath.endsWith('.gz')) {
196
+ dataToWrite = await new Promise((resolve, reject) => {
197
+ zlib.gzip(traceEventsBuffer, (error, result) => {
198
+ if (error) {
199
+ reject(error);
200
+ }
201
+ else {
202
+ resolve(result);
203
+ }
204
+ });
205
+ });
206
+ }
207
+ const file = await context.saveFile(dataToWrite, filePath, filePath.endsWith('.gz') ? '.gz' : '.json');
208
+ response.appendResponseLine(`The raw trace data was saved to ${file.filename}.`);
209
+ }
210
+ const { parseRawTraceBuffer, traceResultIsSuccess } = await import('../processors/PerformanceTrace.js');
211
+ const result = await parseRawTraceBuffer(traceEventsBuffer, {
212
+ cpuThrottling: page.cpuThrottlingRate,
213
+ networkThrottling: page.networkConditions ?? undefined,
214
+ });
215
+ response.appendResponseLine('The performance trace has been stopped.');
216
+ if (traceResultIsSuccess(result)) {
217
+ if (context.isCruxEnabled()) {
218
+ await populateCruxData(result);
219
+ }
220
+ context.storeTraceRecording(result);
221
+ response.attachTraceSummary(result);
222
+ }
223
+ else {
224
+ throw new Error(`There was an unexpected error parsing the trace: ${result.error}`);
225
+ }
226
+ }
227
+ finally {
228
+ page.setIsRunningPerformanceTrace(false);
229
+ }
230
+ }
231
+ /** We tell CrUXManager to fetch data so it's available when DevTools.PerformanceTraceFormatter is invoked */
232
+ async function populateCruxData(result) {
233
+ logger?.('populateCruxData called');
234
+ const { DevTools } = await loadBrowser();
235
+ const cruxManager = DevTools.CrUXManager.CrUXManager.instance();
236
+ // go/jtfbx. Yes, we're aware this API key is public. ;)
237
+ cruxManager.setEndpointForTesting('https://chromeuxreport.googleapis.com/v1/records:queryRecord?key=AIzaSyBn5gimNjhiEyA_euicSKko6IlD3HdgUfk');
238
+ const cruxSetting = DevTools.Common.Settings.Settings.instance().createSetting('field-data', {
239
+ enabled: true,
240
+ });
241
+ cruxSetting.set({ enabled: true });
242
+ // Gather URLs to fetch CrUX data for
243
+ const urls = [...(result.parsedTrace.insights?.values() ?? [])].map(c => c.url.toString());
244
+ urls.push(result.parsedTrace.data.Meta.mainFrameURL);
245
+ const urlSet = new Set(urls);
246
+ if (urlSet.size === 0) {
247
+ logger?.('No URLs found for CrUX data');
248
+ return;
249
+ }
250
+ logger?.(`Fetching CrUX data for ${urlSet.size} URLs: ${Array.from(urlSet).join(', ')}`);
251
+ const cruxData = await Promise.all(Array.from(urlSet).map(async (url) => {
252
+ const data = await cruxManager.getFieldDataForPage(url);
253
+ logger?.(`CrUX data for ${url}: ${data ? 'found' : 'not found'}`);
254
+ return data;
255
+ }));
256
+ result.parsedTrace.metadata.cruxFieldData = cruxData;
257
+ }
258
+ //# sourceMappingURL=performance.js.map