@yezack/chrome-devtools-mcp-108 0.0.0-stage → 1.10.2

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 (360) hide show
  1. package/FORK-NOTICE.md +45 -0
  2. package/LICENSE +202 -0
  3. package/README.md +45 -2
  4. package/build/src/BrowserManager.js +401 -0
  5. package/build/src/McpContext.js +642 -0
  6. package/build/src/McpPage.js +850 -0
  7. package/build/src/McpResponse.js +1086 -0
  8. package/build/src/SlimMcpResponse.js +19 -0
  9. package/build/src/TextSnapshot.js +315 -0
  10. package/build/src/ToolHandler.js +322 -0
  11. package/build/src/bin/check-latest-version.js +51 -0
  12. package/build/src/bin/chrome-devtools-mcp-main.js +77 -0
  13. package/build/src/bin/chrome-devtools-mcp.js +23 -0
  14. package/build/src/bin/chrome-devtools.js +222 -0
  15. package/build/src/collectors/PageCollector.js +291 -0
  16. package/build/src/collectors/ServiceWorkerCollector.js +171 -0
  17. package/build/src/config/browser-options.js +125 -0
  18. package/build/src/config/category-options.js +89 -0
  19. package/build/src/config/cli-commands.js +26 -0
  20. package/build/src/config/cli-options.js +1473 -0
  21. package/build/src/config/mcp-options.js +417 -0
  22. package/build/src/daemon/client.js +221 -0
  23. package/build/src/daemon/daemon.js +266 -0
  24. package/build/src/daemon/types.js +7 -0
  25. package/build/src/daemon/utils.js +136 -0
  26. package/build/src/devtools/DevToolsCommentBridge.js +91 -0
  27. package/build/src/devtools/DevtoolsUtils.js +307 -0
  28. package/build/src/devtools/McpHostBindingAdapter.js +165 -0
  29. package/build/src/devtools/issueDescriptions.js +42 -0
  30. package/build/src/formatters/CommentFormatter.js +82 -0
  31. package/build/src/formatters/ConsoleFormatter.js +321 -0
  32. package/build/src/formatters/CssFormatter.js +812 -0
  33. package/build/src/formatters/HeapSnapshotFormatter.js +185 -0
  34. package/build/src/formatters/IssueFormatter.js +193 -0
  35. package/build/src/formatters/NetworkFormatter.js +241 -0
  36. package/build/src/formatters/SnapshotFormatter.js +135 -0
  37. package/build/src/index.js +237 -0
  38. package/build/src/processors/ChunkedTraceParser.js +361 -0
  39. package/build/src/processors/HeapSnapshotManager.js +270 -0
  40. package/build/src/processors/PerformanceTrace.js +132 -0
  41. package/build/src/telemetry/ClearcutLogger.js +242 -0
  42. package/build/src/telemetry/WatchdogClient.js +61 -0
  43. package/build/src/telemetry/errors.js +18 -0
  44. package/build/src/telemetry/flagUtils.js +90 -0
  45. package/build/src/telemetry/metricsRegistry.js +85 -0
  46. package/build/src/telemetry/persistence.js +82 -0
  47. package/build/src/telemetry/transformation.js +233 -0
  48. package/build/src/telemetry/types.js +36 -0
  49. package/build/src/telemetry/watchdog/ClearcutSender.js +205 -0
  50. package/build/src/telemetry/watchdog/main.js +128 -0
  51. package/build/src/third_party/THIRD_PARTY_NOTICES +4077 -0
  52. package/build/src/third_party/bundled-packages.json +12 -0
  53. package/build/src/third_party/devtools-formatter-worker.js +15494 -0
  54. package/build/src/third_party/devtools-heap-snapshot-worker.js +10979 -0
  55. package/build/src/third_party/index.js +200978 -0
  56. package/build/src/third_party/issue-descriptions/CoepCoopSandboxedIframeCannotNavigateToCoopPage.md +4 -0
  57. package/build/src/third_party/issue-descriptions/CoepCorpNotSameOrigin.md +8 -0
  58. package/build/src/third_party/issue-descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md +18 -0
  59. package/build/src/third_party/issue-descriptions/CoepCorpNotSameSite.md +7 -0
  60. package/build/src/third_party/issue-descriptions/CoepFrameResourceNeedsCoepHeader.md +10 -0
  61. package/build/src/third_party/issue-descriptions/CompatibilityModeQuirks.md +5 -0
  62. package/build/src/third_party/issue-descriptions/CookieAttributeValueExceedsMaxSize.md +5 -0
  63. package/build/src/third_party/issue-descriptions/LowTextContrast.md +5 -0
  64. package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorRead.md +8 -0
  65. package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorSet.md +8 -0
  66. package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnRead.md +8 -0
  67. package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnSet.md +8 -0
  68. package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeRead.md +9 -0
  69. package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeSet.md +9 -0
  70. package/build/src/third_party/issue-descriptions/bounceTrackingMitigations.md +3 -0
  71. package/build/src/third_party/issue-descriptions/clientHintMetaTagAllowListInvalidOrigin.md +4 -0
  72. package/build/src/third_party/issue-descriptions/clientHintMetaTagModifiedHTML.md +4 -0
  73. package/build/src/third_party/issue-descriptions/connectionAllowlistEmbeddingRequirementNotSatisfied.md +26 -0
  74. package/build/src/third_party/issue-descriptions/connectionAllowlistIFrameAttributeLoosensEmbeddingRequirement.md +19 -0
  75. package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowConnectionAllowlistFrom.md +21 -0
  76. package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowlistItemType.md +12 -0
  77. package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidHeader.md +12 -0
  78. package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidUrlPattern.md +8 -0
  79. package/build/src/third_party/issue-descriptions/connectionAllowlistItemNotInnerList.md +12 -0
  80. package/build/src/third_party/issue-descriptions/connectionAllowlistMoreThanOneList.md +7 -0
  81. package/build/src/third_party/issue-descriptions/connectionAllowlistReportingEndpointNotToken.md +10 -0
  82. package/build/src/third_party/issue-descriptions/cookieCrossSiteRedirectDowngrade.md +12 -0
  83. package/build/src/third_party/issue-descriptions/cookieExcludeDomainNonAscii.md +11 -0
  84. package/build/src/third_party/issue-descriptions/cookieExcludePortMismatch.md +8 -0
  85. package/build/src/third_party/issue-descriptions/cookieExcludeSchemeMismatch.md +7 -0
  86. package/build/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutRead.md +6 -0
  87. package/build/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutSet.md +6 -0
  88. package/build/src/third_party/issue-descriptions/cookieWarnDomainNonAscii.md +11 -0
  89. package/build/src/third_party/issue-descriptions/cookieWarnMetadataGrantRead.md +4 -0
  90. package/build/src/third_party/issue-descriptions/cookieWarnMetadataGrantSet.md +4 -0
  91. package/build/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutRead.md +6 -0
  92. package/build/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutSet.md +6 -0
  93. package/build/src/third_party/issue-descriptions/corsAllowCredentialsRequired.md +6 -0
  94. package/build/src/third_party/issue-descriptions/corsDisabledScheme.md +7 -0
  95. package/build/src/third_party/issue-descriptions/corsDisallowedByMode.md +7 -0
  96. package/build/src/third_party/issue-descriptions/corsHeaderDisallowedByPreflightResponse.md +5 -0
  97. package/build/src/third_party/issue-descriptions/corsInvalidHeaderValues.md +7 -0
  98. package/build/src/third_party/issue-descriptions/corsLocalNetworkAccessPermissionDenied.md +19 -0
  99. package/build/src/third_party/issue-descriptions/corsMethodDisallowedByPreflightResponse.md +5 -0
  100. package/build/src/third_party/issue-descriptions/corsNoCorsRedirectModeNotFollow.md +5 -0
  101. package/build/src/third_party/issue-descriptions/corsOriginMismatch.md +6 -0
  102. package/build/src/third_party/issue-descriptions/corsPreflightResponseInvalid.md +5 -0
  103. package/build/src/third_party/issue-descriptions/corsRedirectContainsCredentials.md +5 -0
  104. package/build/src/third_party/issue-descriptions/corsWildcardOriginNotAllowed.md +9 -0
  105. package/build/src/third_party/issue-descriptions/cspEvalViolation.md +9 -0
  106. package/build/src/third_party/issue-descriptions/cspInlineViolation.md +10 -0
  107. package/build/src/third_party/issue-descriptions/cspTrustedTypesPolicyViolation.md +5 -0
  108. package/build/src/third_party/issue-descriptions/cspTrustedTypesSinkViolation.md +8 -0
  109. package/build/src/third_party/issue-descriptions/cspURLViolation.md +10 -0
  110. package/build/src/third_party/issue-descriptions/deprecation.md +3 -0
  111. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsEmptyList.md +1 -0
  112. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsHttpNotFound.md +1 -0
  113. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidContentType.md +1 -0
  114. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidResponse.md +1 -0
  115. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsNoResponse.md +1 -0
  116. package/build/src/third_party/issue-descriptions/emailVerificationRequestDnsFetchFailed.md +1 -0
  117. package/build/src/third_party/issue-descriptions/emailVerificationRequestDnsInvalidRecord.md +1 -0
  118. package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownHttpNotFound.md +1 -0
  119. package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidContentType.md +1 -0
  120. package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidResponse.md +1 -0
  121. package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownNoResponse.md +1 -0
  122. package/build/src/third_party/issue-descriptions/emailVerificationRequestInvalidEmail.md +1 -0
  123. package/build/src/third_party/issue-descriptions/emailVerificationRequestJwksHttpNotFound.md +1 -0
  124. package/build/src/third_party/issue-descriptions/emailVerificationRequestJwksInvalidResponse.md +1 -0
  125. package/build/src/third_party/issue-descriptions/emailVerificationRequestKeyBindingSigningFailed.md +1 -0
  126. package/build/src/third_party/issue-descriptions/emailVerificationRequestRpOriginIsOpaque.md +1 -0
  127. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenHttpNotFound.md +1 -0
  128. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidContentType.md +1 -0
  129. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidResponse.md +1 -0
  130. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidSdJwt.md +1 -0
  131. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenMalformedSdJwt.md +1 -0
  132. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenNoResponse.md +1 -0
  133. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidAudience.md +1 -0
  134. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidIssuedAt.md +1 -0
  135. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidNonce.md +1 -0
  136. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidSdHash.md +1 -0
  137. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidTyp.md +1 -0
  138. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingAud.md +1 -0
  139. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingCnf.md +1 -0
  140. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingIat.md +1 -0
  141. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingNonce.md +1 -0
  142. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingSdHash.md +1 -0
  143. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbSignatureFailed.md +1 -0
  144. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmail.md +1 -0
  145. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmailVerified.md +1 -0
  146. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidHolderKey.md +1 -0
  147. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuedAt.md +1 -0
  148. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuer.md +1 -0
  149. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtJwksMissingKeys.md +1 -0
  150. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingCnf.md +1 -0
  151. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingEmail.md +1 -0
  152. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIat.md +1 -0
  153. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIss.md +1 -0
  154. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtSignatureFailed.md +1 -0
  155. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtUnsupportedHeaderAlg.md +1 -0
  156. package/build/src/third_party/issue-descriptions/emailVerificationRequestUserLoggedOut.md +1 -0
  157. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownAccountsEndpointCrossOrigin.md +1 -0
  158. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownHttpNotFound.md +1 -0
  159. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidContentType.md +1 -0
  160. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidResponse.md +1 -0
  161. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownIssuanceEndpointCrossOrigin.md +1 -0
  162. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownListEmpty.md +1 -0
  163. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingAccountsEndpoint.md +1 -0
  164. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingIssuanceEndpoint.md +1 -0
  165. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownNoResponse.md +1 -0
  166. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownUnsupportedSigningAlgorithm.md +1 -0
  167. package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsBlockedByConnectionAllowlist.md +1 -0
  168. package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsHttpNotFound.md +1 -0
  169. package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsInvalidResponse.md +1 -0
  170. package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsNoResponse.md +1 -0
  171. package/build/src/third_party/issue-descriptions/federatedAuthRequestApprovalDeclined.md +1 -0
  172. package/build/src/third_party/issue-descriptions/federatedAuthRequestCanceled.md +1 -0
  173. package/build/src/third_party/issue-descriptions/federatedAuthRequestConfigBlockedByConnectionAllowlist.md +1 -0
  174. package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorFetchingSignin.md +1 -0
  175. package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorIdToken.md +1 -0
  176. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenBlockedByConnectionAllowlist.md +1 -0
  177. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenHttpNotFound.md +1 -0
  178. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidRequest.md +1 -0
  179. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidResponse.md +1 -0
  180. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenNoResponse.md +1 -0
  181. package/build/src/third_party/issue-descriptions/federatedAuthRequestInvalidSigninResponse.md +1 -0
  182. package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestHttpNotFound.md +1 -0
  183. package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestInvalidResponse.md +1 -0
  184. package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestNoResponse.md +1 -0
  185. package/build/src/third_party/issue-descriptions/federatedAuthRequestTooManyRequests.md +1 -0
  186. package/build/src/third_party/issue-descriptions/federatedAuthRequestWellKnownBlockedByConnectionAllowlist.md +1 -0
  187. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidAccountsResponse.md +1 -0
  188. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidConfigOrWellKnown.md +1 -0
  189. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoAccountSharingPermission.md +1 -0
  190. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoApiPermission.md +1 -0
  191. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoReturningUserFromFetchedAccounts.md +1 -0
  192. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotIframe.md +1 -0
  193. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotPotentiallyTrustworthy.md +1 -0
  194. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSameOrigin.md +1 -0
  195. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSignedInWithIdp.md +1 -0
  196. package/build/src/third_party/issue-descriptions/fetchingPartitionedBlobURL.md +7 -0
  197. package/build/src/third_party/issue-descriptions/genericBackUINavigationWouldSkipAd.md +4 -0
  198. package/build/src/third_party/issue-descriptions/genericFormAriaLabelledByToNonExistingIdError.md +8 -0
  199. package/build/src/third_party/issue-descriptions/genericFormAutocompleteAttributeEmptyError.md +5 -0
  200. package/build/src/third_party/issue-descriptions/genericFormDuplicateIdForInputError.md +5 -0
  201. package/build/src/third_party/issue-descriptions/genericFormEmptyIdAndNameAttributesForInputError.md +5 -0
  202. package/build/src/third_party/issue-descriptions/genericFormInputAssignedAutocompleteValueToIdOrNameAttributeError.md +5 -0
  203. package/build/src/third_party/issue-descriptions/genericFormInputHasWrongButWellIntendedAutocompleteValueError.md +5 -0
  204. package/build/src/third_party/issue-descriptions/genericFormInputWithNoLabelError.md +5 -0
  205. package/build/src/third_party/issue-descriptions/genericFormLabelForMatchesNonExistingIdError.md +5 -0
  206. package/build/src/third_party/issue-descriptions/genericFormLabelForNameError.md +5 -0
  207. package/build/src/third_party/issue-descriptions/genericFormLabelHasNeitherForNorNestedInputError.md +5 -0
  208. package/build/src/third_party/issue-descriptions/genericFormModelContextMissingToolDescription.md +5 -0
  209. package/build/src/third_party/issue-descriptions/genericFormModelContextMissingToolName.md +5 -0
  210. package/build/src/third_party/issue-descriptions/genericFormModelContextParameterMissingName.md +5 -0
  211. package/build/src/third_party/issue-descriptions/genericFormModelContextParameterMissingTitleAndDescription.md +5 -0
  212. package/build/src/third_party/issue-descriptions/genericFormModelContextRequiredParameterMissingName.md +5 -0
  213. package/build/src/third_party/issue-descriptions/genericNavigationEntryMarkedSkippable.md +7 -0
  214. package/build/src/third_party/issue-descriptions/genericResponseWasBlockedByORB.md +4 -0
  215. package/build/src/third_party/issue-descriptions/heavyAd.md +10 -0
  216. package/build/src/third_party/issue-descriptions/lazyLoadImageZeroSize.md +7 -0
  217. package/build/src/third_party/issue-descriptions/mixedContent.md +5 -0
  218. package/build/src/third_party/issue-descriptions/navigatingPartitionedBlobURL.md +5 -0
  219. package/build/src/third_party/issue-descriptions/permissionElementActivationDisabled.md +7 -0
  220. package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluder.md +9 -0
  221. package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluderParent.md +9 -0
  222. package/build/src/third_party/issue-descriptions/permissionElementCspFrameAncestorsMissing.md +5 -0
  223. package/build/src/third_party/issue-descriptions/permissionElementFencedFrameDisallowed.md +5 -0
  224. package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooLarge.md +5 -0
  225. package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooSmall.md +5 -0
  226. package/build/src/third_party/issue-descriptions/permissionElementGeolocationDeprecated.md +5 -0
  227. package/build/src/third_party/issue-descriptions/permissionElementInsetBoxShadowUnsupported.md +5 -0
  228. package/build/src/third_party/issue-descriptions/permissionElementInvalidDisplayStyle.md +5 -0
  229. package/build/src/third_party/issue-descriptions/permissionElementInvalidSizeValue.md +5 -0
  230. package/build/src/third_party/issue-descriptions/permissionElementInvalidType.md +5 -0
  231. package/build/src/third_party/issue-descriptions/permissionElementInvalidTypeActivation.md +5 -0
  232. package/build/src/third_party/issue-descriptions/permissionElementLowContrast.md +5 -0
  233. package/build/src/third_party/issue-descriptions/permissionElementNonOpaqueColor.md +5 -0
  234. package/build/src/third_party/issue-descriptions/permissionElementPaddingBottomUnsupported.md +6 -0
  235. package/build/src/third_party/issue-descriptions/permissionElementPaddingRightUnsupported.md +6 -0
  236. package/build/src/third_party/issue-descriptions/permissionElementPermissionsPolicyBlocked.md +5 -0
  237. package/build/src/third_party/issue-descriptions/permissionElementRegistrationFailed.md +5 -0
  238. package/build/src/third_party/issue-descriptions/permissionElementRequestInProgress.md +5 -0
  239. package/build/src/third_party/issue-descriptions/permissionElementSecurityChecksFailed.md +5 -0
  240. package/build/src/third_party/issue-descriptions/permissionElementTypeNotSupported.md +5 -0
  241. package/build/src/third_party/issue-descriptions/permissionElementUntrustedEvent.md +7 -0
  242. package/build/src/third_party/issue-descriptions/placeholderDescriptionForInvisibleIssues.md +3 -0
  243. package/build/src/third_party/issue-descriptions/propertyRuleInvalidNameIssue.md +3 -0
  244. package/build/src/third_party/issue-descriptions/propertyRuleIssue.md +7 -0
  245. package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedOptGroupChild.md +7 -0
  246. package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedSelectChild.md +7 -0
  247. package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentAttributesSelectDescendant.md +3 -0
  248. package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentLegendChild.md +3 -0
  249. package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentOptionChild.md +3 -0
  250. package/build/src/third_party/issue-descriptions/selectElementAccessibilityNonPhrasingContentOptionChild.md +3 -0
  251. package/build/src/third_party/issue-descriptions/selectivePermissionsIntervention.md +7 -0
  252. package/build/src/third_party/issue-descriptions/sharedArrayBuffer.md +7 -0
  253. package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorCrossOriginNoCorsRequest.md +1 -0
  254. package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorDictionaryLoadFailure.md +3 -0
  255. package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorMatchingDictionaryNotUsed.md +3 -0
  256. package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorUnexpectedContentDictionaryHeader.md +1 -0
  257. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorCossOriginNoCorsRequest.md +1 -0
  258. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorDisallowedBySettings.md +1 -0
  259. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorExpiredResponse.md +3 -0
  260. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorFeatureDisabled.md +3 -0
  261. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInsufficientResources.md +1 -0
  262. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidMatchField.md +1 -0
  263. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidStructuredHeader.md +1 -0
  264. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidTTLField.md +1 -0
  265. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNavigationRequest.md +3 -0
  266. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNoMatchField.md +1 -0
  267. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonIntegerTTLField.md +1 -0
  268. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonListMatchDestField.md +1 -0
  269. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonSecureContext.md +3 -0
  270. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringIdField.md +1 -0
  271. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringInMatchDestList.md +1 -0
  272. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringMatchField.md +1 -0
  273. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonTokenTypeField.md +1 -0
  274. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorRequestAborted.md +1 -0
  275. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorShuttingDown.md +1 -0
  276. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorTooLongIdField.md +3 -0
  277. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorUnsupportedType.md +3 -0
  278. package/build/src/third_party/issue-descriptions/sriInvalidSignatureHeader.md +14 -0
  279. package/build/src/third_party/issue-descriptions/sriInvalidSignatureInputHeader.md +15 -0
  280. package/build/src/third_party/issue-descriptions/sriMissingSignatureHeader.md +8 -0
  281. package/build/src/third_party/issue-descriptions/sriMissingSignatureInputHeader.md +7 -0
  282. package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsIncorrectLength.md +11 -0
  283. package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsNotByteSequence.md +14 -0
  284. package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsParameterized.md +15 -0
  285. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentName.md +8 -0
  286. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentType.md +13 -0
  287. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidDerivedComponentParameter.md +4 -0
  288. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidHeaderComponentParameter.md +5 -0
  289. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidParameter.md +11 -0
  290. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderKeyIdLength.md +12 -0
  291. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingLabel.md +6 -0
  292. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingRequiredParameters.md +8 -0
  293. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueMissingComponents.md +11 -0
  294. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueNotInnerList.md +11 -0
  295. package/build/src/third_party/issue-descriptions/sriValidationFailedIntegrityMismatch.md +10 -0
  296. package/build/src/third_party/issue-descriptions/sriValidationFailedInvalidLength.md +5 -0
  297. package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureExpired.md +6 -0
  298. package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureMismatch.md +11 -0
  299. package/build/src/third_party/issue-descriptions/stylesheetLateImport.md +4 -0
  300. package/build/src/third_party/issue-descriptions/stylesheetRequestFailed.md +3 -0
  301. package/build/src/third_party/issue-descriptions/summaryElementAccessibilityInteractiveContentSummaryDescendant.md +3 -0
  302. package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestLength.md +12 -0
  303. package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestType.md +17 -0
  304. package/build/src/third_party/issue-descriptions/unencodedDigestMalformedDictionary.md +14 -0
  305. package/build/src/third_party/issue-descriptions/unencodedDigestUnknownAlgorithm.md +15 -0
  306. package/build/src/third_party/issue-descriptions/webInstallManifestMissingId.md +3 -0
  307. package/build/src/third_party/issue-descriptions/webInstallManifestMissingNameOrShortName.md +3 -0
  308. package/build/src/third_party/issue-descriptions/webInstallManifestParsingOrNetworkError.md +3 -0
  309. package/build/src/third_party/issue-descriptions/webInstallNoManifest.md +3 -0
  310. package/build/src/third_party/issue-descriptions/webInstallStartUrlInvalid.md +3 -0
  311. package/build/src/third_party/lighthouse-devtools-mcp-bundle.js +58435 -0
  312. package/build/src/tools/ToolDefinition.js +80 -0
  313. package/build/src/tools/categories.js +33 -0
  314. package/build/src/tools/comments.js +169 -0
  315. package/build/src/tools/console.js +104 -0
  316. package/build/src/tools/css.js +45 -0
  317. package/build/src/tools/emulation.js +84 -0
  318. package/build/src/tools/extensions.js +103 -0
  319. package/build/src/tools/input.js +652 -0
  320. package/build/src/tools/lighthouse.js +149 -0
  321. package/build/src/tools/memory.js +424 -0
  322. package/build/src/tools/network.js +128 -0
  323. package/build/src/tools/pages.js +363 -0
  324. package/build/src/tools/performance.js +212 -0
  325. package/build/src/tools/pwa.js +128 -0
  326. package/build/src/tools/screencast.js +119 -0
  327. package/build/src/tools/screenshot.js +277 -0
  328. package/build/src/tools/script.js +232 -0
  329. package/build/src/tools/slim/tools.js +96 -0
  330. package/build/src/tools/snapshot.js +63 -0
  331. package/build/src/tools/thirdPartyDeveloper.js +85 -0
  332. package/build/src/tools/tools.js +55 -0
  333. package/build/src/tools/webmcp.js +66 -0
  334. package/build/src/types.js +10 -0
  335. package/build/src/utils/WaitForHelper.js +316 -0
  336. package/build/src/utils/bytes.js +105 -0
  337. package/build/src/utils/check-for-updates.js +75 -0
  338. package/build/src/utils/files.js +57 -0
  339. package/build/src/utils/id.js +16 -0
  340. package/build/src/utils/keyboard.js +297 -0
  341. package/build/src/utils/logger.js +52 -0
  342. package/build/src/utils/pagination.js +50 -0
  343. package/build/src/utils/polyfill.js +11 -0
  344. package/build/src/utils/url.js +116 -0
  345. package/build/src/version.js +10 -0
  346. package/package.json +41 -4
  347. package/skills/a11y-debugging/SKILL.md +91 -0
  348. package/skills/a11y-debugging/references/a11y-snippets.md +92 -0
  349. package/skills/chrome-devtools/SKILL.md +74 -0
  350. package/skills/chrome-devtools-cli/SKILL.md +194 -0
  351. package/skills/chrome-devtools-cli/references/installation.md +14 -0
  352. package/skills/cookie-debugging/SKILL.md +149 -0
  353. package/skills/debug-optimize-lcp/SKILL.md +121 -0
  354. package/skills/debug-optimize-lcp/references/elements-and-size.md +27 -0
  355. package/skills/debug-optimize-lcp/references/lcp-breakdown.md +23 -0
  356. package/skills/debug-optimize-lcp/references/lcp-snippets.md +79 -0
  357. package/skills/debug-optimize-lcp/references/optimization-strategies.md +38 -0
  358. package/skills/memory-leak-debugging/SKILL.md +58 -0
  359. package/skills/memory-leak-debugging/references/common-leaks.md +33 -0
  360. package/skills/troubleshooting/SKILL.md +99 -0
@@ -0,0 +1,212 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import zlib from 'node:zlib';
7
+ import { zod, DevTools } from '../third_party/index.js';
8
+ import { parseRawTraceBuffer, traceResultIsSuccess, } from '../processors/PerformanceTrace.js';
9
+ import { logger } from '../utils/logger.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
+ filePath: filePathSchema,
33
+ },
34
+ blockedByDialog: true,
35
+ verifyFilesSchema: {
36
+ filePath: true,
37
+ },
38
+ handler: async (request, response, context) => {
39
+ if (context.isRunningPerformanceTrace()) {
40
+ 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.');
41
+ return;
42
+ }
43
+ context.setIsRunningPerformanceTrace(true);
44
+ const page = request.page;
45
+ const pageUrlForTracing = page.pptrPage.url();
46
+ try {
47
+ if (request.params.reload) {
48
+ // Before starting the recording, navigate to about:blank to clear out any state.
49
+ // We use `load` because `networkidle0` is known to be flaky for about:blank in Puppeteer.
50
+ await page.pptrPage.goto('about:blank', {
51
+ waitUntil: 'load',
52
+ });
53
+ }
54
+ const categories = [
55
+ '-*',
56
+ ...DevTools.TracingDefaultCategories,
57
+ // These categories are optional in DevTools, but enabled by default in the DevTools UI, so we enable them here too.
58
+ ...DevTools.TracingOptionalCategories.JsSampling,
59
+ ...DevTools.TracingOptionalCategories.Screenshot,
60
+ ];
61
+ await page.pptrPage.tracing.start({
62
+ categories,
63
+ bufferSize: 1200 * 1000,
64
+ });
65
+ if (request.params.reload) {
66
+ await page.pptrPage.goto(pageUrlForTracing, {
67
+ waitUntil: ['load'],
68
+ });
69
+ }
70
+ if (request.params.autoStop) {
71
+ await new Promise(resolve => setTimeout(resolve, 5_000));
72
+ await stopTracingAndAppendOutput(page, response, context, request.params.filePath);
73
+ }
74
+ else {
75
+ response.appendResponseLine(`The performance trace is being recorded. Use performance_stop_trace to stop it.`);
76
+ }
77
+ }
78
+ catch (error) {
79
+ // If a setup step (navigation, tracing.start) throws before
80
+ // stopTracingAndAppendOutput runs, the running flag would otherwise stay
81
+ // stuck `true` for the rest of the session, blocking all future traces.
82
+ // Unwind here: stop tracing if it was started and clear the flag. When
83
+ // autoStop already ran stopTracingAndAppendOutput the flag is already
84
+ // false and this is a no-op.
85
+ if (context.isRunningPerformanceTrace()) {
86
+ try {
87
+ await page.pptrPage.tracing.stop();
88
+ }
89
+ catch {
90
+ // Tracing may not have started yet; ignore.
91
+ }
92
+ context.setIsRunningPerformanceTrace(false);
93
+ }
94
+ throw error;
95
+ }
96
+ },
97
+ }));
98
+ export const stopTrace = definePageTool(() => ({
99
+ name: 'performance_stop_trace',
100
+ description: 'Stop the active performance trace recording on the target webpage.',
101
+ annotations: {
102
+ category: ToolCategory.PERFORMANCE,
103
+ readOnlyHint: false,
104
+ },
105
+ schema: {
106
+ filePath: filePathSchema,
107
+ },
108
+ blockedByDialog: true,
109
+ verifyFilesSchema: {
110
+ filePath: true,
111
+ },
112
+ handler: async (request, response, context) => {
113
+ if (!context.isRunningPerformanceTrace()) {
114
+ return;
115
+ }
116
+ const page = request.page;
117
+ await stopTracingAndAppendOutput(page, response, context, request.params.filePath);
118
+ },
119
+ }));
120
+ export const analyzeInsight = definePageTool(() => ({
121
+ name: 'performance_analyze_insight',
122
+ description: 'Provides more detailed information on a specific Performance Insight of an insight set that was highlighted in the results of a trace recording.',
123
+ annotations: {
124
+ category: ToolCategory.PERFORMANCE,
125
+ readOnlyHint: true,
126
+ },
127
+ schema: {
128
+ insightSetId: zod
129
+ .string()
130
+ .describe('The id for the specific insight set. Only use the ids given in the "Available insight sets" list.'),
131
+ insightName: zod
132
+ .string()
133
+ .describe('The name of the Insight you want more information on. For example: "DocumentLatency" or "LCPBreakdown"'),
134
+ },
135
+ blockedByDialog: false,
136
+ verifyFilesSchema: {},
137
+ handler: async (request, response, context) => {
138
+ const lastRecording = context.recordedTraces().at(-1);
139
+ if (!lastRecording) {
140
+ response.appendResponseLine('No recorded traces found. Record a performance trace so you have Insights to analyze.');
141
+ return;
142
+ }
143
+ response.attachTraceInsight(lastRecording, request.params.insightSetId, request.params.insightName);
144
+ },
145
+ }));
146
+ async function stopTracingAndAppendOutput(page, response, context, filePath) {
147
+ try {
148
+ const traceEventsBuffer = await page.pptrPage.tracing.stop();
149
+ if (filePath && traceEventsBuffer) {
150
+ let dataToWrite = traceEventsBuffer;
151
+ if (filePath.endsWith('.gz')) {
152
+ dataToWrite = await new Promise((resolve, reject) => {
153
+ zlib.gzip(traceEventsBuffer, (error, result) => {
154
+ if (error) {
155
+ reject(error);
156
+ }
157
+ else {
158
+ resolve(result);
159
+ }
160
+ });
161
+ });
162
+ }
163
+ const file = await context.saveFile(dataToWrite, filePath, filePath.endsWith('.gz') ? '.gz' : '.json');
164
+ response.appendResponseLine(`The raw trace data was saved to ${file.filename}.`);
165
+ }
166
+ const result = await parseRawTraceBuffer(traceEventsBuffer, {
167
+ cpuThrottling: page.cpuThrottlingRate,
168
+ networkThrottling: page.networkConditions ?? undefined,
169
+ });
170
+ response.appendResponseLine('The performance trace has been stopped.');
171
+ if (traceResultIsSuccess(result)) {
172
+ if (context.isCruxEnabled()) {
173
+ await populateCruxData(result);
174
+ }
175
+ context.storeTraceRecording(result);
176
+ response.attachTraceSummary(result);
177
+ }
178
+ else {
179
+ throw new Error(`There was an unexpected error parsing the trace: ${result.error}`);
180
+ }
181
+ }
182
+ finally {
183
+ context.setIsRunningPerformanceTrace(false);
184
+ }
185
+ }
186
+ /** We tell CrUXManager to fetch data so it's available when DevTools.PerformanceTraceFormatter is invoked */
187
+ async function populateCruxData(result) {
188
+ logger?.('populateCruxData called');
189
+ const cruxManager = DevTools.CrUXManager.CrUXManager.instance();
190
+ // go/jtfbx. Yes, we're aware this API key is public. ;)
191
+ cruxManager.setEndpointForTesting('https://chromeuxreport.googleapis.com/v1/records:queryRecord?key=AIzaSyBn5gimNjhiEyA_euicSKko6IlD3HdgUfk');
192
+ const cruxSetting = DevTools.Common.Settings.Settings.instance().createSetting('field-data', {
193
+ enabled: true,
194
+ });
195
+ cruxSetting.set({ enabled: true });
196
+ // Gather URLs to fetch CrUX data for
197
+ const urls = [...(result.parsedTrace.insights?.values() ?? [])].map(c => c.url.toString());
198
+ urls.push(result.parsedTrace.data.Meta.mainFrameURL);
199
+ const urlSet = new Set(urls);
200
+ if (urlSet.size === 0) {
201
+ logger?.('No URLs found for CrUX data');
202
+ return;
203
+ }
204
+ logger?.(`Fetching CrUX data for ${urlSet.size} URLs: ${Array.from(urlSet).join(', ')}`);
205
+ const cruxData = await Promise.all(Array.from(urlSet).map(async (url) => {
206
+ const data = await cruxManager.getFieldDataForPage(url);
207
+ logger?.(`CrUX data for ${url}: ${data ? 'found' : 'not found'}`);
208
+ return data;
209
+ }));
210
+ result.parsedTrace.metadata.cruxFieldData = cruxData;
211
+ }
212
+ //# sourceMappingURL=performance.js.map
@@ -0,0 +1,128 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { zod } from '../third_party/index.js';
7
+ import { ToolCategory } from './categories.js';
8
+ import { defineTool } from './ToolDefinition.js';
9
+ const manifestIdSchema = zod
10
+ .string()
11
+ .describe('The manifest ID of the web app: the resolved `id` member of its manifest. ' +
12
+ 'If `id` is omitted, it defaults to the resolved `start_url` ' +
13
+ '(e.g. "https://example.com/"). See https://w3c.github.io/manifest/#id-member.');
14
+ const displayModeSchema = zod
15
+ .enum(['standalone', 'browser'])
16
+ .optional()
17
+ .describe('Optional user display mode preference applied after install. ' +
18
+ '"standalone" opens the app in its own window; "browser" opens it as a ' +
19
+ 'tab. Installs via the PWA CDP domain default to "browser" because they ' +
20
+ 'do not simulate the install dialog, so pass "standalone" to get an ' +
21
+ 'app-window experience.');
22
+ export const installPwa = defineTool(() => ({
23
+ name: 'install_pwa',
24
+ description: 'Installs a Progressive Web App (PWA) identified by its manifest ID. ' +
25
+ 'This installs through the PWA CDP domain without a user gesture or install ' +
26
+ 'dialog. DevTools installs default to browser display mode.',
27
+ annotations: {
28
+ category: ToolCategory.PWA,
29
+ readOnlyHint: false,
30
+ },
31
+ schema: {
32
+ manifestId: manifestIdSchema,
33
+ installUrlOrBundleUrl: zod
34
+ .string()
35
+ .describe('The location of the app or bundle. For a normal site this is the page ' +
36
+ 'URL; for an Isolated Web App it can be a file:// or http(s):// ' +
37
+ 'signed web bundle.'),
38
+ displayMode: displayModeSchema,
39
+ },
40
+ blockedByDialog: false,
41
+ // We do not validate file paths for remote browser instances
42
+ // because they are on the remote host and not accessed by the MCP server.
43
+ verifyFilesSchema: {
44
+ installUrlOrBundleUrl: {
45
+ local: true,
46
+ remote: false,
47
+ },
48
+ },
49
+ handler: async (request, response, context) => {
50
+ const { manifestId, installUrlOrBundleUrl, displayMode } = request.params;
51
+ await context.installPWA({
52
+ manifestId,
53
+ installUrlOrBundleUrl,
54
+ displayMode,
55
+ });
56
+ response.appendResponseLine(`Installed PWA with manifest ID: ${manifestId}`);
57
+ if (displayMode) {
58
+ response.appendResponseLine(`Display mode set to: ${displayMode}`);
59
+ }
60
+ },
61
+ }));
62
+ export const uninstallPwa = defineTool(() => ({
63
+ name: 'uninstall_pwa',
64
+ description: 'Uninstalls a Progressive Web App identified by its manifest ID and ' +
65
+ 'closes any open app windows.',
66
+ annotations: {
67
+ category: ToolCategory.PWA,
68
+ readOnlyHint: false,
69
+ },
70
+ schema: {
71
+ manifestId: manifestIdSchema,
72
+ },
73
+ blockedByDialog: false,
74
+ verifyFilesSchema: {},
75
+ handler: async (request, response, context) => {
76
+ const { manifestId } = request.params;
77
+ await context.uninstallPWA({ manifestId });
78
+ response.appendResponseLine(`Uninstalled PWA with manifest ID: ${manifestId}`);
79
+ response.setIncludePages(true);
80
+ },
81
+ }));
82
+ export const launchPwa = defineTool(() => ({
83
+ name: 'launch_pwa',
84
+ description: 'Launches an installed Progressive Web App using its saved display mode. ' +
85
+ 'Optionally opens a specific URL within the same app instead of the default ' +
86
+ 'start URL.',
87
+ annotations: {
88
+ category: ToolCategory.PWA,
89
+ readOnlyHint: false,
90
+ },
91
+ schema: {
92
+ manifestId: manifestIdSchema,
93
+ url: zod
94
+ .string()
95
+ .optional()
96
+ .describe('Optional URL within the app to open instead of the default start URL.'),
97
+ },
98
+ blockedByDialog: false,
99
+ verifyFilesSchema: {},
100
+ handler: async (request, response, context) => {
101
+ const { manifestId, url } = request.params;
102
+ const page = await context.launchPWA({ manifestId, url });
103
+ response.appendResponseLine(`Launched PWA with manifest ID: ${manifestId} (${page.url()})`);
104
+ response.setIncludePages(true);
105
+ },
106
+ }));
107
+ export const getOsAppState = defineTool(() => ({
108
+ name: 'get_os_app_state',
109
+ description: 'Returns the OS integration state (badge count and registered file ' +
110
+ 'handlers) for an installed web app, identified by its manifest ID.',
111
+ annotations: {
112
+ category: ToolCategory.PWA,
113
+ readOnlyHint: true,
114
+ },
115
+ schema: {
116
+ manifestId: manifestIdSchema,
117
+ },
118
+ blockedByDialog: false,
119
+ verifyFilesSchema: {},
120
+ handler: async (request, response, context) => {
121
+ const { manifestId } = request.params;
122
+ const state = await context.getPWAState({ manifestId });
123
+ response.appendResponseLine(`OS app state for manifest ID: ${manifestId}`);
124
+ response.appendResponseLine(`Badge count: ${state.badgeCount}`);
125
+ response.appendResponseLine(`File handlers: ${JSON.stringify(state.fileHandlers)}`);
126
+ },
127
+ }));
128
+ //# sourceMappingURL=pwa.js.map
@@ -0,0 +1,119 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import fs from 'node:fs/promises';
7
+ import os from 'node:os';
8
+ import path from 'node:path';
9
+ import { zod } from '../third_party/index.js';
10
+ import { ToolCategory } from './categories.js';
11
+ import { definePageTool } from './ToolDefinition.js';
12
+ async function generateTempFilePath() {
13
+ const dir = await fs.mkdtemp(path.join(os.tmpdir(), 'chrome-devtools-mcp-'));
14
+ return path.join(dir, `screencast.mp4`);
15
+ }
16
+ const supportedExtensions = ['.webm', '.mp4'];
17
+ export const startScreencast = definePageTool((args) => ({
18
+ name: 'screencast_start',
19
+ description: `Starts recording a screencast (video) of the target page in specified format.`,
20
+ annotations: {
21
+ category: ToolCategory.DEBUGGING,
22
+ readOnlyHint: false,
23
+ conditions: ['experimentalScreencast'],
24
+ },
25
+ schema: {
26
+ filePath: zod
27
+ .string()
28
+ .optional()
29
+ .describe(`Output file path (${supportedExtensions.join(',')} are supported). Uses mkdtemp to generate a unique path if not provided.`),
30
+ },
31
+ blockedByDialog: false,
32
+ verifyFilesSchema: {
33
+ filePath: true,
34
+ },
35
+ handler: async (request, response, context) => {
36
+ if (context.getScreenRecorder() !== null) {
37
+ response.appendResponseLine('Error: a screencast recording is already in progress. Use screencast_stop to stop it before starting a new one.');
38
+ return;
39
+ }
40
+ const requestedFilePath = request.params.filePath;
41
+ const filePath = requestedFilePath ?? (await generateTempFilePath());
42
+ // Match the extension case-insensitively so e.g. `.WEBM` is recognized as
43
+ // WebM. An explicitly requested but unsupported extension is rejected
44
+ // rather than being silently rewritten to `.mp4` (which would change both
45
+ // the format and the output path from what was requested). A missing
46
+ // extension falls back to `.mp4`. The matched extension is normalized to
47
+ // lower case.
48
+ const requestedExtension = path.extname(filePath);
49
+ const matchedExtension = supportedExtensions.find(supportedExtension => supportedExtension === requestedExtension.toLowerCase());
50
+ if (!matchedExtension && requestedExtension !== '') {
51
+ throw new Error(`Unsupported screencast file extension "${requestedExtension}". ` +
52
+ `Supported formats: ${supportedExtensions.join(', ')} (case-insensitive).`);
53
+ }
54
+ const enforcedExtension = matchedExtension ?? '.mp4';
55
+ const format = (matchedExtension?.substring(1) ??
56
+ 'mp4');
57
+ const resolvedPath = await context.ensureExtension(filePath, enforcedExtension);
58
+ const page = request.page;
59
+ let recorder;
60
+ try {
61
+ recorder = await page.pptrPage.screencast({
62
+ path: resolvedPath,
63
+ format: format,
64
+ ffmpegPath: args?.experimentalFfmpegPath,
65
+ fps: args?.experimentalScreencastFps,
66
+ });
67
+ }
68
+ catch (err) {
69
+ // If we generated a temporary directory for this recording, remove it so
70
+ // a failed start (e.g. ffmpeg missing) does not leak an empty directory.
71
+ if (requestedFilePath === undefined) {
72
+ try {
73
+ await fs.rm(path.dirname(resolvedPath), {
74
+ recursive: true,
75
+ force: true,
76
+ });
77
+ }
78
+ catch {
79
+ // no-op
80
+ }
81
+ }
82
+ const message = err instanceof Error ? err.message : String(err);
83
+ if (message.includes('ENOENT') && message.includes('ffmpeg')) {
84
+ throw new Error('ffmpeg is required for screencast recording but was not found. ' +
85
+ 'Install ffmpeg (https://ffmpeg.org/) and ensure it is available in your PATH.');
86
+ }
87
+ throw err;
88
+ }
89
+ context.setScreenRecorder({ recorder, filePath: resolvedPath });
90
+ response.appendResponseLine(`Screencast recording started. The recording will be saved to ${resolvedPath}. Use ${stopScreencast(args).name} to stop recording.`);
91
+ },
92
+ }));
93
+ export const stopScreencast = definePageTool(() => ({
94
+ name: 'screencast_stop',
95
+ description: 'Stops the active screencast recording on the target page.',
96
+ annotations: {
97
+ category: ToolCategory.DEBUGGING,
98
+ readOnlyHint: false,
99
+ conditions: ['experimentalScreencast'],
100
+ },
101
+ schema: {},
102
+ blockedByDialog: false,
103
+ verifyFilesSchema: {},
104
+ handler: async (_request, response, context) => {
105
+ const data = context.getScreenRecorder();
106
+ if (!data) {
107
+ response.appendResponseLine('Error: no active screencast recording to stop.');
108
+ return;
109
+ }
110
+ try {
111
+ await data.recorder.stop();
112
+ response.appendResponseLine(`The screencast recording has been stopped and saved to ${data.filePath}.`);
113
+ }
114
+ finally {
115
+ context.setScreenRecorder(null);
116
+ }
117
+ },
118
+ }));
119
+ //# sourceMappingURL=screencast.js.map