@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,149 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import path from 'node:path';
7
+ import { lighthouseRunner, generateReport, zod, } from '../third_party/index.js';
8
+ import { ToolCategory } from './categories.js';
9
+ import { startTrace } from './performance.js';
10
+ import { definePageTool } from './ToolDefinition.js';
11
+ // Kept in sync with `constants.userAgents` in Lighthouse's
12
+ // core/config/constants.js, which `lighthouse:default` and the `desktop`
13
+ // preset use. The bundle in src/third_party only re-exports the runner
14
+ // entrypoints, so these cannot be imported and are mirrored here alongside the
15
+ // screen emulation metrics below. Refresh via scripts/update-lighthouse.ts.
16
+ const MOBILE_USER_AGENT = 'Mozilla/5.0 (Linux; Android 11; moto g power (2022)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Mobile Safari/537.36';
17
+ const DESKTOP_USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36';
18
+ export const lighthouseAudit = definePageTool((args) => ({
19
+ name: 'lighthouse_audit',
20
+ description: `Get Lighthouse score and reports for accessibility, SEO, best practices, and agentic browsing. This excludes performance. For performance audits, run ${startTrace(args).name}`,
21
+ annotations: {
22
+ category: ToolCategory.DEBUGGING,
23
+ readOnlyHint: false,
24
+ },
25
+ schema: {
26
+ mode: zod
27
+ .enum(['navigation', 'snapshot'])
28
+ .default('navigation')
29
+ .describe('"navigation" reloads & audits. "snapshot" analyzes current state.'),
30
+ device: zod
31
+ .enum(['desktop', 'mobile'])
32
+ .default('desktop')
33
+ .describe('Device to emulate.'),
34
+ outputDirPath: zod
35
+ .string()
36
+ .optional()
37
+ .describe('Directory for reports. If omitted, uses temporary files.'),
38
+ },
39
+ blockedByDialog: true,
40
+ verifyFilesSchema: {
41
+ outputDirPath: true,
42
+ },
43
+ handler: async (request, response, context) => {
44
+ const page = request.page;
45
+ const categories = [
46
+ 'accessibility',
47
+ 'seo',
48
+ 'best-practices',
49
+ 'agentic-browsing',
50
+ ];
51
+ const formats = ['json', 'html'];
52
+ const { mode = 'navigation', device = 'desktop', outputDirPath, } = request.params;
53
+ const flags = {
54
+ onlyCategories: categories,
55
+ output: formats,
56
+ // Default 30 second timeout for page load.
57
+ maxWaitForLoad: 30_000,
58
+ };
59
+ if (device === 'desktop') {
60
+ flags.formFactor = 'desktop';
61
+ flags.screenEmulation = {
62
+ mobile: false,
63
+ width: 1350,
64
+ height: 940,
65
+ deviceScaleFactor: 1,
66
+ disabled: false,
67
+ };
68
+ flags.emulatedUserAgent = DESKTOP_USER_AGENT;
69
+ }
70
+ else {
71
+ flags.formFactor = 'mobile';
72
+ flags.screenEmulation = {
73
+ mobile: true,
74
+ width: 412,
75
+ height: 823,
76
+ deviceScaleFactor: 1.75,
77
+ disabled: false,
78
+ };
79
+ flags.emulatedUserAgent = MOBILE_USER_AGENT;
80
+ }
81
+ let result;
82
+ try {
83
+ if (mode === 'navigation') {
84
+ result = await lighthouseRunner.navigation(page.pptrPage, page.pptrPage.url(), {
85
+ flags,
86
+ });
87
+ }
88
+ else {
89
+ result = await lighthouseRunner.snapshot(page.pptrPage, {
90
+ flags,
91
+ });
92
+ }
93
+ if (!result) {
94
+ throw new Error('Lighthouse audit failed.');
95
+ }
96
+ }
97
+ finally {
98
+ await page.restoreEmulation();
99
+ }
100
+ const lhr = result.lhr;
101
+ const reportPaths = [];
102
+ const encoder = new TextEncoder();
103
+ const savePromises = formats.map(async (format) => {
104
+ const report = generateReport(lhr, format);
105
+ const data = encoder.encode(report);
106
+ if (outputDirPath) {
107
+ const reportPath = path.join(outputDirPath, `report`);
108
+ const { filename } = await context.saveFile(data, reportPath, `.${format}`);
109
+ return filename;
110
+ }
111
+ const { filepath } = await context.saveTemporaryFile(data, `report.${format}`);
112
+ return filepath;
113
+ });
114
+ const results = await Promise.allSettled(savePromises);
115
+ for (const res of results) {
116
+ if (res.status === 'rejected') {
117
+ throw res.reason;
118
+ }
119
+ reportPaths.push(res.value);
120
+ }
121
+ const categoryScores = Object.values(lhr.categories).map(c => ({
122
+ id: c.id,
123
+ title: c.title,
124
+ score: c.score,
125
+ }));
126
+ const failedAudits = Object.values(lhr.audits).filter(a => a.score !== null && a.score < 1).length;
127
+ const passedAudits = Object.values(lhr.audits).filter(a => a.score === 1).length;
128
+ const output = {
129
+ summary: {
130
+ mode,
131
+ device,
132
+ // `mainDocumentUrl` is only set for navigations, whereas
133
+ // `finalDisplayedUrl` is populated for every gather mode.
134
+ url: lhr.finalDisplayedUrl,
135
+ scores: categoryScores,
136
+ audits: {
137
+ failed: failedAudits,
138
+ passed: passedAudits,
139
+ },
140
+ timing: {
141
+ total: lhr.timing.total,
142
+ },
143
+ },
144
+ reports: reportPaths,
145
+ };
146
+ response.attachLighthouseResult(output);
147
+ },
148
+ }));
149
+ //# sourceMappingURL=lighthouse.js.map
@@ -0,0 +1,424 @@
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 { byteSizeRangeSchema } from '../utils/bytes.js';
8
+ import { ToolCategory } from './categories.js';
9
+ import { definePageTool, defineTool } from './ToolDefinition.js';
10
+ const HEAP_SNAPSHOT_FILTERS = [
11
+ 'objectsRetainedByDetachedDomNodes',
12
+ 'objectsRetainedByConsole',
13
+ 'objectsRetainedByEventHandlers',
14
+ 'objectsRetainedByContexts',
15
+ 'sharedNativeContext',
16
+ 'noNativeContext',
17
+ 'attributedToSpecificNativeContext',
18
+ ];
19
+ export const takeHeapSnapshot = definePageTool(() => ({
20
+ name: 'take_heapsnapshot',
21
+ description: `Capture a heap snapshot of the target page. Use to analyze the memory distribution of JavaScript objects and debug memory leaks.`,
22
+ annotations: {
23
+ category: ToolCategory.MEMORY,
24
+ readOnlyHint: false,
25
+ },
26
+ schema: {
27
+ filePath: zod
28
+ .string()
29
+ .describe('A path to a .heapsnapshot file to save the heapsnapshot to.'),
30
+ },
31
+ blockedByDialog: true,
32
+ verifyFilesSchema: {
33
+ filePath: true,
34
+ },
35
+ handler: async (request, response, context) => {
36
+ const page = request.page;
37
+ const snapshotPath = await context.ensureExtension(request.params.filePath, '.heapsnapshot');
38
+ await page.pptrPage.captureHeapSnapshot({
39
+ path: snapshotPath,
40
+ });
41
+ response.appendResponseLine(`Heap snapshot saved to ${snapshotPath}`);
42
+ },
43
+ }));
44
+ export const getHeapSnapshotSummary = defineTool(() => ({
45
+ name: 'get_heapsnapshot_summary',
46
+ description: 'Loads a memory heapsnapshot and returns snapshot summary stats, including native contexts and their sizes, and retained by context summary.',
47
+ annotations: {
48
+ category: ToolCategory.MEMORY,
49
+ readOnlyHint: true,
50
+ conditions: ['memoryDebugging'],
51
+ },
52
+ schema: {
53
+ filePath: zod.string().describe('A path to a .heapsnapshot file to read.'),
54
+ },
55
+ blockedByDialog: false,
56
+ verifyFilesSchema: {
57
+ filePath: true,
58
+ },
59
+ handler: async (request, response, context) => {
60
+ const stats = await context.getHeapSnapshotStats(request.params.filePath);
61
+ const staticData = await context.getHeapSnapshotStaticData(request.params.filePath);
62
+ const nativeContextSizes = await context.getHeapSnapshotNativeContextSizes(request.params.filePath);
63
+ const retainedByContextSummary = await context.getHeapSnapshotRetainedByContextSummary(request.params.filePath);
64
+ response.setHeapSnapshotStats(stats, staticData, nativeContextSizes, retainedByContextSummary);
65
+ },
66
+ }));
67
+ export const getHeapSnapshotDetails = defineTool(() => ({
68
+ name: 'get_heapsnapshot_details',
69
+ description: 'Loads a memory heapsnapshot and returns all available information including statistics, static data, and aggregated node information. Supports pagination for aggregates.',
70
+ annotations: {
71
+ category: ToolCategory.MEMORY,
72
+ readOnlyHint: true,
73
+ conditions: ['memoryDebugging'],
74
+ },
75
+ schema: {
76
+ filePath: zod.string().describe('A path to a .heapsnapshot file to read.'),
77
+ filterName: zod
78
+ .enum(HEAP_SNAPSHOT_FILTERS)
79
+ .optional()
80
+ .describe('An optional filter to apply to the aggregates.'),
81
+ objectId: zod
82
+ .number()
83
+ .optional()
84
+ .describe('The object ID (nodeId) of the specific native context to filter by when filterName is attributedToSpecificNativeContext.'),
85
+ pageIdx: zod
86
+ .number()
87
+ .optional()
88
+ .describe('The page index for pagination of aggregates.'),
89
+ pageSize: zod
90
+ .number()
91
+ .optional()
92
+ .describe('The page size for pagination of aggregates.'),
93
+ },
94
+ blockedByDialog: false,
95
+ verifyFilesSchema: {
96
+ filePath: true,
97
+ },
98
+ handler: async (request, response, context) => {
99
+ const aggregates = await context.getHeapSnapshotAggregates(request.params.filePath, request.params.filterName, request.params.objectId);
100
+ response.setHeapSnapshotAggregates(aggregates, {
101
+ pageIdx: request.params.pageIdx,
102
+ pageSize: request.params.pageSize,
103
+ });
104
+ },
105
+ }));
106
+ export const getHeapSnapshotClassNodes = defineTool(() => ({
107
+ name: 'get_heapsnapshot_class_nodes',
108
+ description: 'Loads a memory heapsnapshot and returns instances of a specific class with their IDs.',
109
+ annotations: {
110
+ category: ToolCategory.MEMORY,
111
+ readOnlyHint: true,
112
+ conditions: ['memoryDebugging'],
113
+ },
114
+ schema: {
115
+ filePath: zod.string().describe('A path to a .heapsnapshot file to read.'),
116
+ id: zod.number().describe('The ID for the class, obtained from details.'),
117
+ filterName: zod
118
+ .enum(HEAP_SNAPSHOT_FILTERS)
119
+ .optional()
120
+ .describe('An optional filter to apply to the nodes.'),
121
+ objectId: zod
122
+ .number()
123
+ .optional()
124
+ .describe('The object ID (nodeId) of the specific native context to filter by when filterName is attributedToSpecificNativeContext.'),
125
+ pageIdx: zod.number().optional().describe('The page index for pagination.'),
126
+ pageSize: zod.number().optional().describe('The page size for pagination.'),
127
+ },
128
+ blockedByDialog: false,
129
+ verifyFilesSchema: {
130
+ filePath: true,
131
+ },
132
+ handler: async (request, response, context) => {
133
+ const nodes = await context.getHeapSnapshotNodesById(request.params.filePath, request.params.id, request.params.filterName, request.params.objectId);
134
+ response.setHeapSnapshotNodes(nodes, {
135
+ pageIdx: request.params.pageIdx,
136
+ pageSize: request.params.pageSize,
137
+ });
138
+ },
139
+ }));
140
+ export const getHeapSnapshotRetainers = defineTool(() => ({
141
+ name: 'get_heapsnapshot_retainers',
142
+ description: 'Loads a memory heapsnapshot and returns retainers for a specific node ID.',
143
+ annotations: {
144
+ category: ToolCategory.MEMORY,
145
+ readOnlyHint: true,
146
+ conditions: ['memoryDebugging'],
147
+ },
148
+ blockedByDialog: false,
149
+ verifyFilesSchema: {
150
+ filePath: true,
151
+ },
152
+ schema: {
153
+ filePath: zod.string().describe('A path to a .heapsnapshot file to read.'),
154
+ nodeId: zod.number().describe('The node ID to get retainers for.'),
155
+ pageIdx: zod.number().optional().describe('The page index for pagination.'),
156
+ pageSize: zod.number().optional().describe('The page size for pagination.'),
157
+ },
158
+ handler: async (request, response, context) => {
159
+ const retainers = await context.getHeapSnapshotRetainers(request.params.filePath, request.params.nodeId);
160
+ response.setHeapSnapshotNodes(retainers, {
161
+ pageIdx: request.params.pageIdx,
162
+ pageSize: request.params.pageSize,
163
+ });
164
+ },
165
+ }));
166
+ export const closeHeapSnapshot = defineTool(() => ({
167
+ name: 'close_heapsnapshot',
168
+ description: 'Closes a previously loaded memory heapsnapshot, freeing its memory.',
169
+ annotations: {
170
+ category: ToolCategory.MEMORY,
171
+ readOnlyHint: false,
172
+ conditions: ['memoryDebugging'],
173
+ },
174
+ verifyFilesSchema: {
175
+ filePath: true,
176
+ },
177
+ schema: {
178
+ filePath: zod
179
+ .string()
180
+ .describe('A path to the .heapsnapshot file to close.'),
181
+ },
182
+ blockedByDialog: false,
183
+ handler: async (request, response, context) => {
184
+ const closed = await context.closeHeapSnapshot(request.params.filePath);
185
+ if (!closed) {
186
+ throw new Error(`Failed to close heap snapshot: ${request.params.filePath} was not loaded.`);
187
+ }
188
+ response.appendResponseLine(`Closed heap snapshot: ${request.params.filePath}`);
189
+ },
190
+ }));
191
+ export const getHeapSnapshotRetainingPaths = defineTool(() => ({
192
+ name: 'get_heapsnapshot_retaining_paths',
193
+ description: 'Loads a memory heapsnapshot and returns retaining paths for a specific node ID. This helps to understand why a node is not being garbage collected.',
194
+ annotations: {
195
+ category: ToolCategory.MEMORY,
196
+ readOnlyHint: true,
197
+ conditions: ['memoryDebugging'],
198
+ },
199
+ verifyFilesSchema: {
200
+ filePath: true,
201
+ },
202
+ blockedByDialog: false,
203
+ schema: {
204
+ filePath: zod.string().describe('A path to a .heapsnapshot file to read.'),
205
+ nodeId: zod.number().describe('The node ID to get retaining paths for.'),
206
+ maxDepth: zod
207
+ .number()
208
+ .optional()
209
+ .describe('The maximum depth to search for retaining paths.'),
210
+ maxNodes: zod
211
+ .number()
212
+ .optional()
213
+ .describe('The maximum number of nodes to return.'),
214
+ maxSiblings: zod
215
+ .number()
216
+ .optional()
217
+ .describe('The maximum number of siblings to return.'),
218
+ },
219
+ handler: async (request, response, context) => {
220
+ const retainingPaths = await context.getHeapSnapshotRetainingPaths(request.params.filePath, request.params.nodeId, request.params.maxDepth, request.params.maxNodes, request.params.maxSiblings);
221
+ response.setHeapSnapshotRetainingPaths(retainingPaths);
222
+ },
223
+ }));
224
+ export const getHeapSnapshotEdges = defineTool(() => ({
225
+ name: 'get_heapsnapshot_edges',
226
+ description: 'Loads a memory heapsnapshot and returns outgoing edges (references) for a specific node ID.',
227
+ annotations: {
228
+ category: ToolCategory.MEMORY,
229
+ readOnlyHint: true,
230
+ conditions: ['memoryDebugging'],
231
+ },
232
+ blockedByDialog: false,
233
+ verifyFilesSchema: {
234
+ filePath: true,
235
+ },
236
+ schema: {
237
+ filePath: zod.string().describe('A path to a .heapsnapshot file to read.'),
238
+ nodeId: zod.number().describe('The node ID to get outgoing edges for.'),
239
+ sortBy: zod
240
+ .enum(['retainedSize', 'selfSize', 'name'])
241
+ .optional()
242
+ .describe('Sort order for edges. Default is retainedSize.'),
243
+ retainedSize: byteSizeRangeSchema('Inclusive retained size range (e.g. "1MB-2MB", "-1MB", or "1MB-") for target nodes. A single value is treated as a minimum. Currently, only the lower bound is applied.').optional(),
244
+ excludePrimitives: zod
245
+ .boolean()
246
+ .optional()
247
+ .describe('Whether to exclude primitive target nodes. Default is true.'),
248
+ pageIdx: zod.number().optional().describe('The page index for pagination.'),
249
+ pageSize: zod.number().optional().describe('The page size for pagination.'),
250
+ },
251
+ handler: async (request, response, context) => {
252
+ const edges = await context.getHeapSnapshotEdges(request.params.filePath, request.params.nodeId, {
253
+ sortBy: request.params.sortBy ?? 'retainedSize',
254
+ // DevTools currently only supports a lower retained-size bound here.
255
+ minRetainedSize: request.params.retainedSize?.min,
256
+ excludePrimitives: request.params.excludePrimitives ?? true,
257
+ });
258
+ response.setHeapSnapshotNodes(edges, {
259
+ pageIdx: request.params.pageIdx,
260
+ pageSize: request.params.pageSize,
261
+ });
262
+ },
263
+ }));
264
+ export const getHeapSnapshotDominators = defineTool(() => ({
265
+ name: 'get_heapsnapshot_dominators',
266
+ description: 'Loads a memory heapsnapshot and returns the dominator chain for a specific node ID. This helps to identify which objects are keeping the target node alive.',
267
+ annotations: {
268
+ category: ToolCategory.MEMORY,
269
+ readOnlyHint: true,
270
+ conditions: ['memoryDebugging'],
271
+ },
272
+ blockedByDialog: false,
273
+ verifyFilesSchema: {
274
+ filePath: true,
275
+ },
276
+ schema: {
277
+ filePath: zod.string().describe('A path to a .heapsnapshot file to read.'),
278
+ nodeId: zod
279
+ .number()
280
+ .describe('The node ID to get the dominator chain for.'),
281
+ },
282
+ handler: async (request, response, context) => {
283
+ const dominators = await context.getHeapSnapshotDominators(request.params.filePath, request.params.nodeId);
284
+ response.setHeapSnapshotDominators(dominators);
285
+ },
286
+ }));
287
+ export const compareHeapSnapshots = defineTool(() => ({
288
+ name: 'compare_heapsnapshots',
289
+ description: 'Loads two memory heapsnapshots and returns the comparison. If classIndex is provided, returns detailed diff for that class, otherwise returns summary diff.',
290
+ annotations: {
291
+ category: ToolCategory.MEMORY,
292
+ readOnlyHint: true,
293
+ conditions: ['memoryDebugging'],
294
+ },
295
+ verifyFilesSchema: {
296
+ baseFilePath: true,
297
+ currentFilePath: true,
298
+ },
299
+ schema: {
300
+ baseFilePath: zod
301
+ .string()
302
+ .describe('A path to the base .heapsnapshot file (earlier snapshot).'),
303
+ currentFilePath: zod
304
+ .string()
305
+ .describe('A path to the current .heapsnapshot file (later snapshot).'),
306
+ classIndex: zod
307
+ .number()
308
+ .optional()
309
+ .describe('Optional 0-based index of the class in the summary list to filter results, showing individual objects.'),
310
+ },
311
+ blockedByDialog: false,
312
+ handler: async (request, response, context) => {
313
+ if (request.params.classIndex !== undefined) {
314
+ const classDiffResult = await context.getHeapSnapshotDetailedClassDiff(request.params.baseFilePath, request.params.currentFilePath, request.params.classIndex);
315
+ response.setHeapSnapshotDetailedClassDiff(classDiffResult);
316
+ }
317
+ else {
318
+ const diff = await context.getHeapSnapshotClassDiffs(request.params.baseFilePath, request.params.currentFilePath);
319
+ response.setHeapSnapshotClassDiffs(diff);
320
+ }
321
+ },
322
+ }));
323
+ export const getHeapSnapshotDuplicateStrings = defineTool(() => ({
324
+ name: 'get_heapsnapshot_duplicate_strings',
325
+ description: 'Loads a memory heapsnapshot and returns duplicate strings grouped by their value.',
326
+ annotations: {
327
+ category: ToolCategory.MEMORY,
328
+ readOnlyHint: true,
329
+ conditions: ['memoryDebugging'],
330
+ },
331
+ blockedByDialog: false,
332
+ verifyFilesSchema: {
333
+ filePath: true,
334
+ },
335
+ schema: {
336
+ filePath: zod.string().describe('A path to a .heapsnapshot file to read.'),
337
+ pageIdx: zod.number().optional().describe('The page index for pagination.'),
338
+ pageSize: zod.number().optional().describe('The page size for pagination.'),
339
+ },
340
+ handler: async (request, response, context) => {
341
+ const duplicateStrings = await context.getHeapSnapshotDuplicateStrings(request.params.filePath);
342
+ response.setHeapSnapshotDuplicateStrings(duplicateStrings, {
343
+ pageIdx: request.params.pageIdx,
344
+ pageSize: request.params.pageSize,
345
+ });
346
+ },
347
+ }));
348
+ export const getHeapSnapshotObjectDetails = defineTool(() => ({
349
+ name: 'get_heapsnapshot_object_details',
350
+ description: 'Loads a memory heapsnapshot and returns detailed information about a specific object by its node ID, including size, type, distance, and DOM detachedness.',
351
+ annotations: {
352
+ category: ToolCategory.MEMORY,
353
+ readOnlyHint: true,
354
+ conditions: ['memoryDebugging'],
355
+ },
356
+ blockedByDialog: false,
357
+ verifyFilesSchema: {
358
+ filePath: true,
359
+ },
360
+ schema: {
361
+ filePath: zod.string().describe('A path to a .heapsnapshot file to read.'),
362
+ nodeId: zod.number().describe('The node ID to get object details for.'),
363
+ },
364
+ handler: async (request, response, context) => {
365
+ const objectInfo = await context.getHeapSnapshotObjectDetails(request.params.filePath, request.params.nodeId);
366
+ response.setHeapSnapshotObjectDetails(objectInfo);
367
+ },
368
+ }));
369
+ export const queryHeapSnapshotObjects = defineTool(() => ({
370
+ name: 'query_heapsnapshot_objects',
371
+ description: 'Loads a memory heapsnapshot and queries objects matching specific filters (className, propertyName, nodeType, retainedSize, selfSize, isDetached, sortBy).',
372
+ annotations: {
373
+ category: ToolCategory.MEMORY,
374
+ readOnlyHint: true,
375
+ conditions: ['memoryDebugging'],
376
+ },
377
+ blockedByDialog: false,
378
+ verifyFilesSchema: { filePath: true },
379
+ schema: {
380
+ filePath: zod.string().describe('A path to a .heapsnapshot file to read.'),
381
+ className: zod
382
+ .string()
383
+ .optional()
384
+ .describe('Optional regex or text matching object class name.'),
385
+ propertyName: zod
386
+ .string()
387
+ .optional()
388
+ .describe('Optional property name filter for outgoing reference edges.'),
389
+ nodeType: zod
390
+ .string()
391
+ .optional()
392
+ .describe('Optional V8 node type filter (e.g. object, closure, string, array, code).'),
393
+ retainedSize: byteSizeRangeSchema('Inclusive retained size range (e.g. "1MB-2MB", "-1MB", or "1MB-"). A single value is treated as a minimum.').optional(),
394
+ selfSize: byteSizeRangeSchema('Inclusive self size range (e.g. "1MB-2MB", "-1MB", or "1MB-"). A single value is treated as a minimum.').optional(),
395
+ isDetached: zod
396
+ .boolean()
397
+ .optional()
398
+ .describe('Whether to filter for detached DOM nodes.'),
399
+ sortBy: zod
400
+ .enum(['retainedSize', 'selfSize', 'id'])
401
+ .optional()
402
+ .describe('Sort order for results. Default is retainedSize.'),
403
+ pageIdx: zod.number().optional().describe('The page index for pagination.'),
404
+ pageSize: zod.number().optional().describe('The page size for pagination.'),
405
+ },
406
+ handler: async (request, response, context) => {
407
+ const range = await context.queryHeapSnapshotObjects(request.params.filePath, {
408
+ className: request.params.className,
409
+ propertyName: request.params.propertyName,
410
+ nodeType: request.params.nodeType,
411
+ minRetainedSize: request.params.retainedSize?.min,
412
+ maxRetainedSize: request.params.retainedSize?.max,
413
+ minSelfSize: request.params.selfSize?.min,
414
+ maxSelfSize: request.params.selfSize?.max,
415
+ isDetached: request.params.isDetached,
416
+ sortBy: request.params.sortBy,
417
+ });
418
+ response.setHeapSnapshotNodes(range, {
419
+ pageIdx: request.params.pageIdx,
420
+ pageSize: request.params.pageSize,
421
+ });
422
+ },
423
+ }));
424
+ //# sourceMappingURL=memory.js.map