@gabrielbryk/arc-devtools-mcp 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +977 -0
- package/build/src/HeapSnapshotManager.js +148 -0
- package/build/src/McpContext.js +737 -0
- package/build/src/McpPage.js +315 -0
- package/build/src/McpResponse.js +990 -0
- package/build/src/Mutex.js +38 -0
- package/build/src/PageCollector.js +297 -0
- package/build/src/ServiceWorkerCollector.js +171 -0
- package/build/src/SlimMcpResponse.js +19 -0
- package/build/src/TextSnapshot.js +236 -0
- package/build/src/ToolHandler.js +223 -0
- package/build/src/WaitForHelper.js +190 -0
- package/build/src/bin/check-latest-version.js +50 -0
- package/build/src/bin/chrome-devtools-cli-options.js +978 -0
- package/build/src/bin/chrome-devtools-mcp-cli-options.js +412 -0
- package/build/src/bin/chrome-devtools-mcp-main.js +72 -0
- package/build/src/bin/chrome-devtools-mcp.js +23 -0
- package/build/src/bin/chrome-devtools.js +189 -0
- package/build/src/browser.js +253 -0
- package/build/src/daemon/client.js +160 -0
- package/build/src/daemon/daemon.js +261 -0
- package/build/src/daemon/types.js +7 -0
- package/build/src/daemon/utils.js +115 -0
- package/build/src/devtools/DevToolsConnectionAdapter.js +70 -0
- package/build/src/devtools/DevtoolsUtils.js +369 -0
- package/build/src/devtools/McpHostBindingAdapter.js +165 -0
- package/build/src/formatters/ConsoleFormatter.js +288 -0
- package/build/src/formatters/HeapSnapshotFormatter.js +97 -0
- package/build/src/formatters/IssueFormatter.js +193 -0
- package/build/src/formatters/NetworkFormatter.js +238 -0
- package/build/src/formatters/SnapshotFormatter.js +135 -0
- package/build/src/index.js +153 -0
- package/build/src/issue-descriptions.js +40 -0
- package/build/src/logger.js +37 -0
- package/build/src/polyfill.js +8 -0
- package/build/src/telemetry/ClearcutLogger.js +169 -0
- package/build/src/telemetry/WatchdogClient.js +61 -0
- package/build/src/telemetry/errors.js +18 -0
- package/build/src/telemetry/flagUtils.js +89 -0
- package/build/src/telemetry/metricsRegistry.js +89 -0
- package/build/src/telemetry/persistence.js +72 -0
- package/build/src/telemetry/transformation.js +134 -0
- package/build/src/telemetry/types.js +31 -0
- package/build/src/telemetry/watchdog/ClearcutSender.js +205 -0
- package/build/src/telemetry/watchdog/main.js +128 -0
- package/build/src/third_party/THIRD_PARTY_NOTICES +3637 -0
- package/build/src/third_party/bundled-packages.json +12 -0
- package/build/src/third_party/devtools-formatter-worker.js +15301 -0
- package/build/src/third_party/devtools-heap-snapshot-worker.js +9870 -0
- package/build/src/third_party/index.js +159597 -0
- package/build/src/third_party/issue-descriptions/CoepCoopSandboxedIframeCannotNavigateToCoopPage.md +4 -0
- package/build/src/third_party/issue-descriptions/CoepCorpNotSameOrigin.md +8 -0
- package/build/src/third_party/issue-descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md +18 -0
- package/build/src/third_party/issue-descriptions/CoepCorpNotSameSite.md +7 -0
- package/build/src/third_party/issue-descriptions/CoepFrameResourceNeedsCoepHeader.md +10 -0
- package/build/src/third_party/issue-descriptions/CompatibilityModeQuirks.md +5 -0
- package/build/src/third_party/issue-descriptions/CookieAttributeValueExceedsMaxSize.md +5 -0
- package/build/src/third_party/issue-descriptions/LowTextContrast.md +5 -0
- package/build/src/third_party/issue-descriptions/SameSiteExcludeContextDowngradeRead.md +8 -0
- package/build/src/third_party/issue-descriptions/SameSiteExcludeContextDowngradeSet.md +8 -0
- package/build/src/third_party/issue-descriptions/SameSiteExcludeNavigationContextDowngrade.md +8 -0
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorRead.md +8 -0
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorSet.md +8 -0
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnRead.md +8 -0
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnSet.md +8 -0
- package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeRead.md +9 -0
- package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeSet.md +9 -0
- package/build/src/third_party/issue-descriptions/SameSiteWarnCrossDowngradeRead.md +8 -0
- package/build/src/third_party/issue-descriptions/SameSiteWarnCrossDowngradeSet.md +8 -0
- package/build/src/third_party/issue-descriptions/SameSiteWarnStrictLaxDowngradeStrict.md +8 -0
- package/build/src/third_party/issue-descriptions/arInsecureContext.md +7 -0
- package/build/src/third_party/issue-descriptions/arInvalidInfoHeader.md +5 -0
- package/build/src/third_party/issue-descriptions/arInvalidRegisterOsSourceHeader.md +5 -0
- package/build/src/third_party/issue-descriptions/arInvalidRegisterOsTriggerHeader.md +5 -0
- package/build/src/third_party/issue-descriptions/arInvalidRegisterSourceHeader.md +5 -0
- package/build/src/third_party/issue-descriptions/arInvalidRegisterTriggerHeader.md +5 -0
- package/build/src/third_party/issue-descriptions/arNavigationRegistrationUniqueScopeAlreadySet.md +5 -0
- package/build/src/third_party/issue-descriptions/arNavigationRegistrationWithoutTransientUserActivation.md +6 -0
- package/build/src/third_party/issue-descriptions/arNoRegisterOsSourceHeader.md +5 -0
- package/build/src/third_party/issue-descriptions/arNoRegisterOsTriggerHeader.md +5 -0
- package/build/src/third_party/issue-descriptions/arNoRegisterSourceHeader.md +5 -0
- package/build/src/third_party/issue-descriptions/arNoRegisterTriggerHeader.md +5 -0
- package/build/src/third_party/issue-descriptions/arNoWebOrOsSupport.md +4 -0
- package/build/src/third_party/issue-descriptions/arOsSourceIgnored.md +18 -0
- package/build/src/third_party/issue-descriptions/arOsTriggerIgnored.md +19 -0
- package/build/src/third_party/issue-descriptions/arPermissionPolicyDisabled.md +8 -0
- package/build/src/third_party/issue-descriptions/arSourceAndTriggerHeaders.md +9 -0
- package/build/src/third_party/issue-descriptions/arSourceIgnored.md +13 -0
- package/build/src/third_party/issue-descriptions/arTriggerIgnored.md +12 -0
- package/build/src/third_party/issue-descriptions/arUntrustworthyReportingOrigin.md +10 -0
- package/build/src/third_party/issue-descriptions/arWebAndOsHeaders.md +11 -0
- package/build/src/third_party/issue-descriptions/bounceTrackingMitigations.md +3 -0
- package/build/src/third_party/issue-descriptions/clientHintMetaTagAllowListInvalidOrigin.md +4 -0
- package/build/src/third_party/issue-descriptions/clientHintMetaTagModifiedHTML.md +4 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowlistItemType.md +12 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidHeader.md +12 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidUrlPattern.md +8 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistItemNotInnerList.md +12 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistMoreThanOneList.md +7 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistReportingEndpointNotToken.md +10 -0
- package/build/src/third_party/issue-descriptions/cookieCrossSiteRedirectDowngrade.md +12 -0
- package/build/src/third_party/issue-descriptions/cookieExcludeBlockedWithinRelatedWebsiteSet.md +4 -0
- package/build/src/third_party/issue-descriptions/cookieExcludeDomainNonAscii.md +11 -0
- package/build/src/third_party/issue-descriptions/cookieExcludePortMismatch.md +8 -0
- package/build/src/third_party/issue-descriptions/cookieExcludeSchemeMismatch.md +7 -0
- package/build/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutRead.md +6 -0
- package/build/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutSet.md +6 -0
- package/build/src/third_party/issue-descriptions/cookieWarnDomainNonAscii.md +11 -0
- package/build/src/third_party/issue-descriptions/cookieWarnMetadataGrantRead.md +4 -0
- package/build/src/third_party/issue-descriptions/cookieWarnMetadataGrantSet.md +4 -0
- package/build/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutRead.md +6 -0
- package/build/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutSet.md +6 -0
- package/build/src/third_party/issue-descriptions/corsAllowCredentialsRequired.md +6 -0
- package/build/src/third_party/issue-descriptions/corsDisabledScheme.md +7 -0
- package/build/src/third_party/issue-descriptions/corsDisallowedByMode.md +7 -0
- package/build/src/third_party/issue-descriptions/corsHeaderDisallowedByPreflightResponse.md +5 -0
- package/build/src/third_party/issue-descriptions/corsInvalidHeaderValues.md +7 -0
- package/build/src/third_party/issue-descriptions/corsLocalNetworkAccessPermissionDenied.md +19 -0
- package/build/src/third_party/issue-descriptions/corsMethodDisallowedByPreflightResponse.md +5 -0
- package/build/src/third_party/issue-descriptions/corsNoCorsRedirectModeNotFollow.md +5 -0
- package/build/src/third_party/issue-descriptions/corsOriginMismatch.md +6 -0
- package/build/src/third_party/issue-descriptions/corsPreflightResponseInvalid.md +5 -0
- package/build/src/third_party/issue-descriptions/corsRedirectContainsCredentials.md +5 -0
- package/build/src/third_party/issue-descriptions/corsWildcardOriginNotAllowed.md +8 -0
- package/build/src/third_party/issue-descriptions/cspEvalViolation.md +9 -0
- package/build/src/third_party/issue-descriptions/cspInlineViolation.md +10 -0
- package/build/src/third_party/issue-descriptions/cspTrustedTypesPolicyViolation.md +5 -0
- package/build/src/third_party/issue-descriptions/cspTrustedTypesSinkViolation.md +8 -0
- package/build/src/third_party/issue-descriptions/cspURLViolation.md +10 -0
- package/build/src/third_party/issue-descriptions/deprecation.md +3 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsEmptyList.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsHttpNotFound.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidContentType.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsNoResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestDnsFetchFailed.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestDnsInvalidRecord.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownHttpNotFound.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidContentType.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownNoResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestInvalidEmail.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestJwksHttpNotFound.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestJwksInvalidResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestKeyBindingSigningFailed.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestRpOriginIsOpaque.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenHttpNotFound.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidContentType.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidSdJwt.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenMalformedSdJwt.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenNoResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidAudience.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidIssuedAt.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidNonce.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidSdHash.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidTyp.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingAud.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingCnf.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingIat.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingNonce.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingSdHash.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbSignatureFailed.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmail.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmailVerified.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidHolderKey.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuedAt.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuer.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtJwksMissingKeys.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingCnf.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingEmail.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIat.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIss.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtSignatureFailed.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtUnsupportedHeaderAlg.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestUserLoggedOut.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownAccountsEndpointCrossOrigin.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownHttpNotFound.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidContentType.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownIssuanceEndpointCrossOrigin.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownListEmpty.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingAccountsEndpoint.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingIssuanceEndpoint.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownNoResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownUnsupportedSigningAlgorithm.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsHttpNotFound.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsInvalidResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsNoResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestApprovalDeclined.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestCanceled.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorFetchingSignin.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorIdToken.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenHttpNotFound.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidRequest.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenNoResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestInvalidSigninResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestHttpNotFound.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestInvalidResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestNoResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestTooManyRequests.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidAccountsResponse.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidConfigOrWellKnown.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoAccountSharingPermission.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoApiPermission.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoReturningUserFromFetchedAccounts.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotIframe.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotPotentiallyTrustworthy.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSameOrigin.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSignedInWithIdp.md +1 -0
- package/build/src/third_party/issue-descriptions/fetchingPartitionedBlobURL.md +7 -0
- package/build/src/third_party/issue-descriptions/genericBackUINavigationWouldSkipAd.md +4 -0
- package/build/src/third_party/issue-descriptions/genericFormAriaLabelledByToNonExistingIdError.md +8 -0
- package/build/src/third_party/issue-descriptions/genericFormAutocompleteAttributeEmptyError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormDuplicateIdForInputError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormEmptyIdAndNameAttributesForInputError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormInputAssignedAutocompleteValueToIdOrNameAttributeError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormInputHasWrongButWellIntendedAutocompleteValueError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormInputWithNoLabelError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormLabelForMatchesNonExistingIdError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormLabelForNameError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormLabelHasNeitherForNorNestedInputError.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormModelContextMissingToolDescription.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormModelContextMissingToolName.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormModelContextParameterMissingName.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormModelContextParameterMissingTitleAndDescription.md +5 -0
- package/build/src/third_party/issue-descriptions/genericFormModelContextRequiredParameterMissingName.md +5 -0
- package/build/src/third_party/issue-descriptions/genericNavigationEntryMarkedSkippable.md +7 -0
- package/build/src/third_party/issue-descriptions/genericResponseWasBlockedByORB.md +4 -0
- package/build/src/third_party/issue-descriptions/heavyAd.md +10 -0
- package/build/src/third_party/issue-descriptions/mixedContent.md +5 -0
- package/build/src/third_party/issue-descriptions/navigatingPartitionedBlobURL.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementActivationDisabled.md +7 -0
- package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluder.md +9 -0
- package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluderParent.md +9 -0
- package/build/src/third_party/issue-descriptions/permissionElementCspFrameAncestorsMissing.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementFencedFrameDisallowed.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooLarge.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooSmall.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementGeolocationDeprecated.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementInsetBoxShadowUnsupported.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementInvalidDisplayStyle.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementInvalidSizeValue.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementInvalidType.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementInvalidTypeActivation.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementLowContrast.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementNonOpaqueColor.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementPaddingBottomUnsupported.md +6 -0
- package/build/src/third_party/issue-descriptions/permissionElementPaddingRightUnsupported.md +6 -0
- package/build/src/third_party/issue-descriptions/permissionElementPermissionsPolicyBlocked.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementRegistrationFailed.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementRequestInProgress.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementSecurityChecksFailed.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementTypeNotSupported.md +5 -0
- package/build/src/third_party/issue-descriptions/permissionElementUntrustedEvent.md +7 -0
- package/build/src/third_party/issue-descriptions/placeholderDescriptionForInvisibleIssues.md +3 -0
- package/build/src/third_party/issue-descriptions/propertyRuleInvalidNameIssue.md +3 -0
- package/build/src/third_party/issue-descriptions/propertyRuleIssue.md +7 -0
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedOptGroupChild.md +7 -0
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedSelectChild.md +7 -0
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentAttributesSelectDescendant.md +3 -0
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentLegendChild.md +3 -0
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentOptionChild.md +3 -0
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityNonPhrasingContentOptionChild.md +3 -0
- package/build/src/third_party/issue-descriptions/selectivePermissionsIntervention.md +7 -0
- package/build/src/third_party/issue-descriptions/sharedArrayBuffer.md +7 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorCrossOriginNoCorsRequest.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorDictionaryLoadFailure.md +3 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorMatchingDictionaryNotUsed.md +3 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorUnexpectedContentDictionaryHeader.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorCossOriginNoCorsRequest.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorDisallowedBySettings.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorExpiredResponse.md +3 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorFeatureDisabled.md +3 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInsufficientResources.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidMatchField.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidStructuredHeader.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidTTLField.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNavigationRequest.md +3 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNoMatchField.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonIntegerTTLField.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonListMatchDestField.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonSecureContext.md +3 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringIdField.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringInMatchDestList.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringMatchField.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonTokenTypeField.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorRequestAborted.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorShuttingDown.md +1 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorTooLongIdField.md +3 -0
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorUnsupportedType.md +3 -0
- package/build/src/third_party/issue-descriptions/sriInvalidSignatureHeader.md +14 -0
- package/build/src/third_party/issue-descriptions/sriInvalidSignatureInputHeader.md +15 -0
- package/build/src/third_party/issue-descriptions/sriMissingSignatureHeader.md +8 -0
- package/build/src/third_party/issue-descriptions/sriMissingSignatureInputHeader.md +7 -0
- package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsIncorrectLength.md +11 -0
- package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsNotByteSequence.md +14 -0
- package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsParameterized.md +15 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentName.md +8 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentType.md +13 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidDerivedComponentParameter.md +4 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidHeaderComponentParameter.md +5 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidParameter.md +11 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderKeyIdLength.md +12 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingLabel.md +6 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingRequiredParameters.md +8 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueMissingComponents.md +11 -0
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueNotInnerList.md +11 -0
- package/build/src/third_party/issue-descriptions/sriValidationFailedIntegrityMismatch.md +10 -0
- package/build/src/third_party/issue-descriptions/sriValidationFailedInvalidLength.md +5 -0
- package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureExpired.md +6 -0
- package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureMismatch.md +11 -0
- package/build/src/third_party/issue-descriptions/stylesheetLateImport.md +4 -0
- package/build/src/third_party/issue-descriptions/stylesheetRequestFailed.md +3 -0
- package/build/src/third_party/issue-descriptions/summaryElementAccessibilityInteractiveContentSummaryDescendant.md +3 -0
- package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestLength.md +12 -0
- package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestType.md +17 -0
- package/build/src/third_party/issue-descriptions/unencodedDigestMalformedDictionary.md +14 -0
- package/build/src/third_party/issue-descriptions/unencodedDigestUnknownAlgorithm.md +15 -0
- package/build/src/third_party/lighthouse-devtools-mcp-bundle.js +61598 -0
- package/build/src/tools/ToolDefinition.js +73 -0
- package/build/src/tools/categories.js +36 -0
- package/build/src/tools/console.js +98 -0
- package/build/src/tools/emulation.js +84 -0
- package/build/src/tools/extensions.js +101 -0
- package/build/src/tools/input.js +469 -0
- package/build/src/tools/lighthouse.js +136 -0
- package/build/src/tools/memory.js +227 -0
- package/build/src/tools/network.js +125 -0
- package/build/src/tools/pages.js +419 -0
- package/build/src/tools/performance.js +200 -0
- package/build/src/tools/screencast.js +117 -0
- package/build/src/tools/screenshot.js +169 -0
- package/build/src/tools/script.js +151 -0
- package/build/src/tools/slim/tools.js +88 -0
- package/build/src/tools/snapshot.js +61 -0
- package/build/src/tools/thirdPartyDeveloper.js +85 -0
- package/build/src/tools/tools.js +56 -0
- package/build/src/tools/webmcp.js +66 -0
- package/build/src/trace-processing/parse.js +85 -0
- package/build/src/types.js +7 -0
- package/build/src/utils/check-for-updates.js +74 -0
- package/build/src/utils/files.js +61 -0
- package/build/src/utils/id.js +16 -0
- package/build/src/utils/keyboard.js +297 -0
- package/build/src/utils/pagination.js +50 -0
- package/build/src/utils/string.js +37 -0
- package/build/src/utils/types.js +7 -0
- package/build/src/version.js +10 -0
- package/package.json +100 -0
- package/skills/a11y-debugging/SKILL.md +89 -0
- package/skills/a11y-debugging/references/a11y-snippets.md +92 -0
- package/skills/chrome-devtools/SKILL.md +72 -0
- package/skills/chrome-devtools-cli/SKILL.md +153 -0
- package/skills/chrome-devtools-cli/references/installation.md +14 -0
- package/skills/debug-optimize-lcp/SKILL.md +121 -0
- package/skills/debug-optimize-lcp/references/elements-and-size.md +27 -0
- package/skills/debug-optimize-lcp/references/lcp-breakdown.md +23 -0
- package/skills/debug-optimize-lcp/references/lcp-snippets.md +79 -0
- package/skills/debug-optimize-lcp/references/optimization-strategies.md +38 -0
- package/skills/memory-leak-debugging/SKILL.md +50 -0
- package/skills/memory-leak-debugging/references/common-leaks.md +33 -0
- package/skills/memory-leak-debugging/references/compare_snapshots.js +109 -0
- package/skills/memory-leak-debugging/references/memlab.md +29 -0
- package/skills/troubleshooting/SKILL.md +98 -0
|
@@ -0,0 +1,117 @@
|
|
|
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 { ensureExtension } from '../utils/files.js';
|
|
11
|
+
import { ToolCategory } from './categories.js';
|
|
12
|
+
import { definePageTool } from './ToolDefinition.js';
|
|
13
|
+
async function generateTempFilePath() {
|
|
14
|
+
const dir = await fs.mkdtemp(path.join(os.tmpdir(), 'chrome-devtools-mcp-'));
|
|
15
|
+
return path.join(dir, `screencast.mp4`);
|
|
16
|
+
}
|
|
17
|
+
const supportedExtensions = ['.webm', '.mp4'];
|
|
18
|
+
export const startScreencast = definePageTool(args => ({
|
|
19
|
+
name: 'screencast_start',
|
|
20
|
+
description: `Starts recording a screencast (video) of the selected page in specified format.`,
|
|
21
|
+
annotations: {
|
|
22
|
+
category: ToolCategory.DEBUGGING,
|
|
23
|
+
readOnlyHint: false,
|
|
24
|
+
conditions: ['experimentalScreencast'],
|
|
25
|
+
},
|
|
26
|
+
schema: {
|
|
27
|
+
filePath: zod
|
|
28
|
+
.string()
|
|
29
|
+
.optional()
|
|
30
|
+
.describe(`Output file path (${supportedExtensions.join(',')} are supported). Uses mkdtemp to generate a unique path if not provided.`),
|
|
31
|
+
},
|
|
32
|
+
blockedByDialog: false,
|
|
33
|
+
verifyFilesSchema: ['filePath'],
|
|
34
|
+
handler: async (request, response, context) => {
|
|
35
|
+
if (context.getScreenRecorder() !== null) {
|
|
36
|
+
response.appendResponseLine('Error: a screencast recording is already in progress. Use screencast_stop to stop it before starting a new one.');
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const requestedFilePath = request.params.filePath;
|
|
40
|
+
const filePath = requestedFilePath ?? (await generateTempFilePath());
|
|
41
|
+
// Match the extension case-insensitively so e.g. `.WEBM` is recognized as
|
|
42
|
+
// WebM. An explicitly requested but unsupported extension is rejected
|
|
43
|
+
// rather than being silently rewritten to `.mp4` (which would change both
|
|
44
|
+
// the format and the output path from what was requested). A missing
|
|
45
|
+
// extension falls back to `.mp4`. The matched extension is normalized to
|
|
46
|
+
// lower case.
|
|
47
|
+
const requestedExtension = path.extname(filePath);
|
|
48
|
+
const matchedExtension = supportedExtensions.find(supportedExtension => supportedExtension === requestedExtension.toLowerCase());
|
|
49
|
+
if (!matchedExtension && requestedExtension !== '') {
|
|
50
|
+
throw new Error(`Unsupported screencast file extension "${requestedExtension}". ` +
|
|
51
|
+
`Supported formats: ${supportedExtensions.join(', ')} (case-insensitive).`);
|
|
52
|
+
}
|
|
53
|
+
const enforcedExtension = matchedExtension ?? '.mp4';
|
|
54
|
+
const format = (matchedExtension?.substring(1) ??
|
|
55
|
+
'mp4');
|
|
56
|
+
const resolvedPath = ensureExtension(path.resolve(filePath), enforcedExtension);
|
|
57
|
+
const page = request.page;
|
|
58
|
+
let recorder;
|
|
59
|
+
try {
|
|
60
|
+
recorder = await page.pptrPage.screencast({
|
|
61
|
+
path: resolvedPath,
|
|
62
|
+
format: format,
|
|
63
|
+
ffmpegPath: args?.experimentalFfmpegPath,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
// If we generated a temporary directory for this recording, remove it so
|
|
68
|
+
// a failed start (e.g. ffmpeg missing) does not leak an empty directory.
|
|
69
|
+
if (requestedFilePath === undefined) {
|
|
70
|
+
try {
|
|
71
|
+
await fs.rm(path.dirname(resolvedPath), {
|
|
72
|
+
recursive: true,
|
|
73
|
+
force: true,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
// no-op
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
81
|
+
if (message.includes('ENOENT') && message.includes('ffmpeg')) {
|
|
82
|
+
throw new Error('ffmpeg is required for screencast recording but was not found. ' +
|
|
83
|
+
'Install ffmpeg (https://ffmpeg.org/) and ensure it is available in your PATH.');
|
|
84
|
+
}
|
|
85
|
+
throw err;
|
|
86
|
+
}
|
|
87
|
+
context.setScreenRecorder({ recorder, filePath: resolvedPath });
|
|
88
|
+
response.appendResponseLine(`Screencast recording started. The recording will be saved to ${resolvedPath}. Use ${stopScreencast.name} to stop recording.`);
|
|
89
|
+
},
|
|
90
|
+
}));
|
|
91
|
+
export const stopScreencast = definePageTool({
|
|
92
|
+
name: 'screencast_stop',
|
|
93
|
+
description: 'Stops the active screencast recording on the selected page.',
|
|
94
|
+
annotations: {
|
|
95
|
+
category: ToolCategory.DEBUGGING,
|
|
96
|
+
readOnlyHint: false,
|
|
97
|
+
conditions: ['experimentalScreencast'],
|
|
98
|
+
},
|
|
99
|
+
schema: {},
|
|
100
|
+
blockedByDialog: false,
|
|
101
|
+
verifyFilesSchema: [],
|
|
102
|
+
handler: async (_request, response, context) => {
|
|
103
|
+
const data = context.getScreenRecorder();
|
|
104
|
+
if (!data) {
|
|
105
|
+
response.appendResponseLine('Error: no active screencast recording to stop.');
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
try {
|
|
109
|
+
await data.recorder.stop();
|
|
110
|
+
response.appendResponseLine(`The screencast recording has been stopped and saved to ${data.filePath}.`);
|
|
111
|
+
}
|
|
112
|
+
finally {
|
|
113
|
+
context.setScreenRecorder(null);
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
//# sourceMappingURL=screencast.js.map
|
|
@@ -0,0 +1,169 @@
|
|
|
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 { ToolCategory } from './categories.js';
|
|
8
|
+
import { definePageTool } from './ToolDefinition.js';
|
|
9
|
+
async function getSourceBox(page, element, fullPage) {
|
|
10
|
+
if (element) {
|
|
11
|
+
const box = await element.boundingBox();
|
|
12
|
+
return box ?? undefined;
|
|
13
|
+
}
|
|
14
|
+
if (fullPage) {
|
|
15
|
+
const dims = await page.evaluate(() => ({
|
|
16
|
+
width: Math.max(document.documentElement.scrollWidth, document.body?.scrollWidth ?? 0),
|
|
17
|
+
height: Math.max(document.documentElement.scrollHeight, document.body?.scrollHeight ?? 0),
|
|
18
|
+
}));
|
|
19
|
+
if (dims.width <= 0 || dims.height <= 0) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
return { x: 0, y: 0, width: dims.width, height: dims.height };
|
|
23
|
+
}
|
|
24
|
+
const viewport = page.viewport();
|
|
25
|
+
if (!viewport) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
return { x: 0, y: 0, width: viewport.width, height: viewport.height };
|
|
29
|
+
}
|
|
30
|
+
function computeDownscaleClip(box, maxWidth, maxHeight) {
|
|
31
|
+
const widthScale = maxWidth !== undefined ? Math.min(1, maxWidth / box.width) : 1;
|
|
32
|
+
const heightScale = maxHeight !== undefined ? Math.min(1, maxHeight / box.height) : 1;
|
|
33
|
+
const scale = Math.min(widthScale, heightScale);
|
|
34
|
+
if (scale >= 1) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
// Skip degenerate sub-pixel results.
|
|
38
|
+
if (Math.round(box.width * scale) < 1 || Math.round(box.height * scale) < 1) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
x: box.x,
|
|
43
|
+
y: box.y,
|
|
44
|
+
width: box.width,
|
|
45
|
+
height: box.height,
|
|
46
|
+
scale,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export const screenshot = definePageTool(args => {
|
|
50
|
+
const { screenshotFormat, screenshotQuality, screenshotMaxWidth, screenshotMaxHeight, } = args ?? {};
|
|
51
|
+
const defaultFormat = screenshotFormat ?? 'png';
|
|
52
|
+
return {
|
|
53
|
+
name: 'take_screenshot',
|
|
54
|
+
description: `Take a screenshot of the page or element.`,
|
|
55
|
+
annotations: {
|
|
56
|
+
category: ToolCategory.DEBUGGING,
|
|
57
|
+
// Not read-only due to filePath param.
|
|
58
|
+
readOnlyHint: false,
|
|
59
|
+
},
|
|
60
|
+
schema: {
|
|
61
|
+
format: zod
|
|
62
|
+
.enum(['png', 'jpeg', 'webp'])
|
|
63
|
+
.default(defaultFormat)
|
|
64
|
+
.describe(`Type of format to save the screenshot as. Default is "${defaultFormat}"`),
|
|
65
|
+
quality: zod
|
|
66
|
+
.number()
|
|
67
|
+
.min(0)
|
|
68
|
+
.max(100)
|
|
69
|
+
.optional()
|
|
70
|
+
.describe('Compression quality for JPEG and WebP formats (0-100). Higher values mean better quality but larger file sizes. Ignored for PNG format.'),
|
|
71
|
+
uid: zod
|
|
72
|
+
.string()
|
|
73
|
+
.optional()
|
|
74
|
+
.describe('The uid of an element on the page from the page content snapshot. If omitted, takes a page screenshot.'),
|
|
75
|
+
fullPage: zod
|
|
76
|
+
.boolean()
|
|
77
|
+
.optional()
|
|
78
|
+
.describe('If set to true takes a screenshot of the full page instead of the currently visible viewport. Incompatible with uid.'),
|
|
79
|
+
filePath: zod
|
|
80
|
+
.string()
|
|
81
|
+
.optional()
|
|
82
|
+
.describe('The absolute path, or a path relative to the current working directory, to save the screenshot to instead of attaching it to the response.'),
|
|
83
|
+
},
|
|
84
|
+
blockedByDialog: true,
|
|
85
|
+
verifyFilesSchema: ['filePath'],
|
|
86
|
+
handler: async (request, response, context) => {
|
|
87
|
+
if (request.params.uid && request.params.fullPage) {
|
|
88
|
+
throw new Error('Providing both "uid" and "fullPage" is not allowed.');
|
|
89
|
+
}
|
|
90
|
+
const page = request.page.pptrPage;
|
|
91
|
+
const element = request.params.uid
|
|
92
|
+
? await request.page.getElementByUid(request.params.uid)
|
|
93
|
+
: undefined;
|
|
94
|
+
const format = request.params.format;
|
|
95
|
+
const quality = format === 'png'
|
|
96
|
+
? undefined
|
|
97
|
+
: (request.params.quality ?? screenshotQuality);
|
|
98
|
+
const fullPage = request.params.fullPage ?? false;
|
|
99
|
+
// Compute a downscale clip when --screenshot-max-width or
|
|
100
|
+
// --screenshot-max-height is set and the source exceeds either bound.
|
|
101
|
+
// The smaller scale factor wins so both bounds are respected while
|
|
102
|
+
// preserving aspect ratio.
|
|
103
|
+
let clip;
|
|
104
|
+
if (screenshotMaxWidth !== undefined ||
|
|
105
|
+
screenshotMaxHeight !== undefined) {
|
|
106
|
+
const box = await getSourceBox(page, element, fullPage);
|
|
107
|
+
if (box) {
|
|
108
|
+
clip = computeDownscaleClip(box, screenshotMaxWidth, screenshotMaxHeight);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
let screenshot;
|
|
112
|
+
if (clip) {
|
|
113
|
+
// page.screenshot with clip lets the CDP scale param downscale the
|
|
114
|
+
// capture for viewport, full-page and element shots alike. We rely on
|
|
115
|
+
// Puppeteer's default of captureBeyondViewport=true when a clip is
|
|
116
|
+
// present so element/full-page captures below the fold still work.
|
|
117
|
+
screenshot = await page.screenshot({
|
|
118
|
+
type: format,
|
|
119
|
+
quality,
|
|
120
|
+
optimizeForSpeed: true,
|
|
121
|
+
clip,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
else if (element) {
|
|
125
|
+
screenshot = await element.screenshot({
|
|
126
|
+
type: format,
|
|
127
|
+
quality,
|
|
128
|
+
optimizeForSpeed: true,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
screenshot = await page.screenshot({
|
|
133
|
+
type: format,
|
|
134
|
+
fullPage,
|
|
135
|
+
quality,
|
|
136
|
+
optimizeForSpeed: true,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
if (request.params.uid) {
|
|
140
|
+
response.appendResponseLine(`Took a screenshot of node with uid "${request.params.uid}".`);
|
|
141
|
+
}
|
|
142
|
+
else if (fullPage) {
|
|
143
|
+
response.appendResponseLine('Took a screenshot of the full current page.');
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
response.appendResponseLine("Took a screenshot of the current page's viewport.");
|
|
147
|
+
}
|
|
148
|
+
// Narrow `format` at the point of use: in the factory form of
|
|
149
|
+
// definePageTool TS widens the Schema generic, which loses the literal
|
|
150
|
+
// union from zod.enum on request.params.format.
|
|
151
|
+
const extension = format === 'jpeg' ? '.jpeg' : format === 'webp' ? '.webp' : '.png';
|
|
152
|
+
if (request.params.filePath) {
|
|
153
|
+
const result = await context.saveFile(screenshot, request.params.filePath, extension);
|
|
154
|
+
response.appendResponseLine(`Saved screenshot to ${result.filename}.`);
|
|
155
|
+
}
|
|
156
|
+
else if (screenshot.length >= 2_000_000) {
|
|
157
|
+
const { filepath } = await context.saveTemporaryFile(screenshot, `screenshot${extension}`);
|
|
158
|
+
response.appendResponseLine(`Saved screenshot to ${filepath}.`);
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
response.attachImage({
|
|
162
|
+
mimeType: `image/${format}`,
|
|
163
|
+
data: Buffer.from(screenshot).toString('base64'),
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
});
|
|
169
|
+
//# sourceMappingURL=screenshot.js.map
|
|
@@ -0,0 +1,151 @@
|
|
|
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 { ToolCategory } from './categories.js';
|
|
8
|
+
import { defineTool, pageIdSchema } from './ToolDefinition.js';
|
|
9
|
+
export const evaluateScript = defineTool(cliArgs => {
|
|
10
|
+
return {
|
|
11
|
+
name: 'evaluate_script',
|
|
12
|
+
description: `Evaluate a JavaScript function inside the currently selected page${cliArgs?.categoryExtensions ? ' or service worker' : ''}. Returns the response as JSON,
|
|
13
|
+
so returned values have to be JSON-serializable.`,
|
|
14
|
+
annotations: {
|
|
15
|
+
category: ToolCategory.DEBUGGING,
|
|
16
|
+
readOnlyHint: false,
|
|
17
|
+
},
|
|
18
|
+
schema: {
|
|
19
|
+
...(cliArgs?.experimentalPageIdRouting ? pageIdSchema : {}),
|
|
20
|
+
function: zod.string().describe(`A JavaScript function declaration to be executed by the tool in the currently selected page.
|
|
21
|
+
Example without arguments: \`() => {
|
|
22
|
+
return document.title
|
|
23
|
+
}\` or \`async () => {
|
|
24
|
+
return await fetch("example.com")
|
|
25
|
+
}\`.
|
|
26
|
+
Example with arguments: \`(el) => {
|
|
27
|
+
return el.innerText;
|
|
28
|
+
}\`
|
|
29
|
+
`),
|
|
30
|
+
args: zod
|
|
31
|
+
.array(zod
|
|
32
|
+
.string()
|
|
33
|
+
.describe('The uid of an element on the page from the page content snapshot'))
|
|
34
|
+
.optional()
|
|
35
|
+
.describe(`An optional list of arguments to pass to the function.`),
|
|
36
|
+
filePath: zod
|
|
37
|
+
.string()
|
|
38
|
+
.optional()
|
|
39
|
+
.describe('The absolute or relative path to a file to save the script output to. If omitted, the output is returned inline.'),
|
|
40
|
+
dialogAction: zod
|
|
41
|
+
.string()
|
|
42
|
+
.optional()
|
|
43
|
+
.describe('Handle dialogs while execution. "accept", "dismiss", or string for response of window.prompt. Defaults to accept.'),
|
|
44
|
+
...(cliArgs?.categoryExtensions
|
|
45
|
+
? {
|
|
46
|
+
serviceWorkerId: zod
|
|
47
|
+
.string()
|
|
48
|
+
.optional()
|
|
49
|
+
.describe(`The optional service worker id to evaluate the script in. If provided, 'pageId' should be omitted. Note: 'args' (element UIDs) cannot be used when evaluating in a service worker.`),
|
|
50
|
+
}
|
|
51
|
+
: {}),
|
|
52
|
+
},
|
|
53
|
+
blockedByDialog: true,
|
|
54
|
+
verifyFilesSchema: ['filePath'],
|
|
55
|
+
handler: async (request, response, context) => {
|
|
56
|
+
const { serviceWorkerId, args: uidArgs, function: fnString, pageId, dialogAction, filePath, } = request.params;
|
|
57
|
+
if (cliArgs?.categoryExtensions && serviceWorkerId) {
|
|
58
|
+
if (uidArgs && uidArgs.length > 0) {
|
|
59
|
+
throw new Error('args (element uids) cannot be used when evaluating in a service worker.');
|
|
60
|
+
}
|
|
61
|
+
if (pageId) {
|
|
62
|
+
throw new Error('specify either a pageId or a serviceWorkerId.');
|
|
63
|
+
}
|
|
64
|
+
const worker = await getWebWorker(context, serviceWorkerId);
|
|
65
|
+
const result = await context
|
|
66
|
+
.getSelectedMcpPage()
|
|
67
|
+
.waitForEventsAfterAction(async () => {
|
|
68
|
+
await performEvaluation(worker, fnString, [], response, {
|
|
69
|
+
filePath,
|
|
70
|
+
context,
|
|
71
|
+
});
|
|
72
|
+
}, { handleDialog: dialogAction ?? 'accept' });
|
|
73
|
+
response.attachWaitForResult(result);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const mcpPage = cliArgs?.experimentalPageIdRouting
|
|
77
|
+
? context.getPageById(request.params.pageId)
|
|
78
|
+
: context.getSelectedMcpPage();
|
|
79
|
+
const page = mcpPage.pptrPage;
|
|
80
|
+
const args = [];
|
|
81
|
+
try {
|
|
82
|
+
const frames = new Set();
|
|
83
|
+
for (const uid of uidArgs ?? []) {
|
|
84
|
+
const handle = await mcpPage.getElementByUid(uid);
|
|
85
|
+
frames.add(handle.frame);
|
|
86
|
+
args.push(handle);
|
|
87
|
+
}
|
|
88
|
+
const evaluatable = await getPageOrFrame(page, frames);
|
|
89
|
+
const result = await mcpPage.waitForEventsAfterAction(async () => {
|
|
90
|
+
await performEvaluation(evaluatable, fnString, args, response, {
|
|
91
|
+
filePath,
|
|
92
|
+
context,
|
|
93
|
+
});
|
|
94
|
+
}, { handleDialog: dialogAction ?? 'accept' });
|
|
95
|
+
response.attachWaitForResult(result);
|
|
96
|
+
}
|
|
97
|
+
finally {
|
|
98
|
+
void Promise.allSettled(args.map(arg => arg.dispose()));
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
});
|
|
103
|
+
const performEvaluation = async (evaluatable, fnString, args, response, options) => {
|
|
104
|
+
const fn = await evaluatable.evaluateHandle(`(${fnString})`);
|
|
105
|
+
try {
|
|
106
|
+
const result = await evaluatable.evaluate(async (fn, ...args) => {
|
|
107
|
+
// @ts-expect-error no types for function fn
|
|
108
|
+
return JSON.stringify(await fn(...args));
|
|
109
|
+
}, fn, ...args);
|
|
110
|
+
if (options?.filePath) {
|
|
111
|
+
const data = new TextEncoder().encode(result ?? 'undefined');
|
|
112
|
+
const { filename } = await options.context.saveFile(data, options.filePath, '.json');
|
|
113
|
+
response.appendResponseLine(`Script ran on page. Output saved to ${filename}.`);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
response.appendResponseLine('Script ran on page and returned:');
|
|
117
|
+
response.appendResponseLine('```json');
|
|
118
|
+
response.appendResponseLine(`${result}`);
|
|
119
|
+
response.appendResponseLine('```');
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
finally {
|
|
123
|
+
void fn.dispose();
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
const getPageOrFrame = async (page, frames) => {
|
|
127
|
+
let pageOrFrame;
|
|
128
|
+
// We can't evaluate the element handle across frames
|
|
129
|
+
if (frames.size > 1) {
|
|
130
|
+
throw new Error("Elements from different frames can't be evaluated together.");
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
pageOrFrame = [...frames.values()][0] ?? page;
|
|
134
|
+
}
|
|
135
|
+
return pageOrFrame;
|
|
136
|
+
};
|
|
137
|
+
const getWebWorker = async (context, serviceWorkerId) => {
|
|
138
|
+
const serviceWorkers = context.getExtensionServiceWorkers();
|
|
139
|
+
const serviceWorker = serviceWorkers.find((sw) => context.getExtensionServiceWorkerId(sw) === serviceWorkerId);
|
|
140
|
+
if (serviceWorker && serviceWorker.target) {
|
|
141
|
+
const worker = await serviceWorker.target.worker();
|
|
142
|
+
if (!worker) {
|
|
143
|
+
throw new Error('Service worker target not found.');
|
|
144
|
+
}
|
|
145
|
+
return worker;
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
throw new Error('Service worker not found.');
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
//# sourceMappingURL=script.js.map
|
|
@@ -0,0 +1,88 @@
|
|
|
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 { definePageTool } from '../ToolDefinition.js';
|
|
9
|
+
export const screenshot = definePageTool({
|
|
10
|
+
name: 'screenshot',
|
|
11
|
+
description: `Takes a screenshot`,
|
|
12
|
+
annotations: {
|
|
13
|
+
category: ToolCategory.DEBUGGING,
|
|
14
|
+
// Not read-only due to filePath param.
|
|
15
|
+
readOnlyHint: false,
|
|
16
|
+
},
|
|
17
|
+
schema: {},
|
|
18
|
+
blockedByDialog: true,
|
|
19
|
+
verifyFilesSchema: [],
|
|
20
|
+
handler: async (request, response, context) => {
|
|
21
|
+
const page = request.page;
|
|
22
|
+
const screenshot = await page.pptrPage.screenshot({
|
|
23
|
+
type: 'png',
|
|
24
|
+
optimizeForSpeed: true,
|
|
25
|
+
});
|
|
26
|
+
const { filepath } = await context.saveTemporaryFile(screenshot, `screenshot.png`);
|
|
27
|
+
response.appendResponseLine(filepath);
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
export const navigate = definePageTool({
|
|
31
|
+
name: 'navigate',
|
|
32
|
+
description: `Loads a URL`,
|
|
33
|
+
annotations: {
|
|
34
|
+
category: ToolCategory.NAVIGATION,
|
|
35
|
+
readOnlyHint: false,
|
|
36
|
+
},
|
|
37
|
+
schema: {
|
|
38
|
+
url: zod.string().describe('URL to navigate to'),
|
|
39
|
+
},
|
|
40
|
+
blockedByDialog: false,
|
|
41
|
+
verifyFilesSchema: [],
|
|
42
|
+
handler: async (request, response) => {
|
|
43
|
+
const page = request.page;
|
|
44
|
+
const options = {
|
|
45
|
+
timeout: 30_000,
|
|
46
|
+
};
|
|
47
|
+
const dialogHandler = (dialog) => {
|
|
48
|
+
if (dialog.type() === 'beforeunload') {
|
|
49
|
+
response.appendResponseLine(`Accepted a beforeunload dialog.`);
|
|
50
|
+
void dialog.accept();
|
|
51
|
+
// We are not going to report the dialog like regular dialogs.
|
|
52
|
+
page.clearDialog();
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
page.pptrPage.on('dialog', dialogHandler);
|
|
56
|
+
try {
|
|
57
|
+
await page.pptrPage.goto(request.params.url, options);
|
|
58
|
+
response.appendResponseLine(`Navigated to ${page.pptrPage.url()}.`);
|
|
59
|
+
}
|
|
60
|
+
finally {
|
|
61
|
+
page.pptrPage.off('dialog', dialogHandler);
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
export const evaluate = definePageTool({
|
|
66
|
+
name: 'evaluate',
|
|
67
|
+
description: `Evaluates a JavaScript script`,
|
|
68
|
+
annotations: {
|
|
69
|
+
category: ToolCategory.DEBUGGING,
|
|
70
|
+
readOnlyHint: false,
|
|
71
|
+
},
|
|
72
|
+
schema: {
|
|
73
|
+
script: zod.string().describe(`JS script to run on the page`),
|
|
74
|
+
},
|
|
75
|
+
blockedByDialog: true,
|
|
76
|
+
verifyFilesSchema: [],
|
|
77
|
+
handler: async (request, response) => {
|
|
78
|
+
const page = request.page;
|
|
79
|
+
try {
|
|
80
|
+
const result = await page.pptrPage.evaluate(request.params.script);
|
|
81
|
+
response.appendResponseLine(JSON.stringify(result));
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
response.appendResponseLine(String(err.message));
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1,61 @@
|
|
|
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 { ToolCategory } from './categories.js';
|
|
8
|
+
import { definePageTool, timeoutSchema } from './ToolDefinition.js';
|
|
9
|
+
export const takeSnapshot = definePageTool({
|
|
10
|
+
name: 'take_snapshot',
|
|
11
|
+
description: `Take a text snapshot of the currently selected page based on the a11y tree. The snapshot lists page elements along with a unique
|
|
12
|
+
identifier (uid). Always use the latest snapshot. Prefer taking a snapshot over taking a screenshot. The snapshot indicates the element selected
|
|
13
|
+
in the DevTools Elements panel (if any).`,
|
|
14
|
+
annotations: {
|
|
15
|
+
category: ToolCategory.DEBUGGING,
|
|
16
|
+
// Not read-only due to filePath param.
|
|
17
|
+
readOnlyHint: false,
|
|
18
|
+
},
|
|
19
|
+
schema: {
|
|
20
|
+
verbose: zod
|
|
21
|
+
.boolean()
|
|
22
|
+
.optional()
|
|
23
|
+
.describe('Whether to include all possible information available in the full a11y tree. Default is false.'),
|
|
24
|
+
filePath: zod
|
|
25
|
+
.string()
|
|
26
|
+
.optional()
|
|
27
|
+
.describe('The absolute path, or a path relative to the current working directory, to save the snapshot to instead of attaching it to the response.'),
|
|
28
|
+
},
|
|
29
|
+
blockedByDialog: true,
|
|
30
|
+
verifyFilesSchema: ['filePath'],
|
|
31
|
+
handler: async (request, response) => {
|
|
32
|
+
response.includeSnapshot({
|
|
33
|
+
verbose: request.params.verbose ?? false,
|
|
34
|
+
filePath: request.params.filePath,
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
export const waitFor = definePageTool({
|
|
39
|
+
name: 'wait_for',
|
|
40
|
+
description: `Wait for the specified text to appear on the selected page.`,
|
|
41
|
+
annotations: {
|
|
42
|
+
category: ToolCategory.NAVIGATION,
|
|
43
|
+
readOnlyHint: true,
|
|
44
|
+
},
|
|
45
|
+
schema: {
|
|
46
|
+
text: zod
|
|
47
|
+
.array(zod.string())
|
|
48
|
+
.min(1)
|
|
49
|
+
.describe('Non-empty list of texts. Resolves when any value appears on the page.'),
|
|
50
|
+
...timeoutSchema,
|
|
51
|
+
},
|
|
52
|
+
blockedByDialog: true,
|
|
53
|
+
verifyFilesSchema: [],
|
|
54
|
+
handler: async (request, response, context) => {
|
|
55
|
+
const page = request.page;
|
|
56
|
+
await context.waitForTextOnPage(request.params.text, request.params.timeout, page.pptrPage);
|
|
57
|
+
response.appendResponseLine(`Element matching one of ${JSON.stringify(request.params.text)} found.`);
|
|
58
|
+
response.includeSnapshot();
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
//# sourceMappingURL=snapshot.js.map
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { zod, ajv } from '../third_party/index.js';
|
|
7
|
+
import { ToolCategory } from './categories.js';
|
|
8
|
+
import { definePageTool } from './ToolDefinition.js';
|
|
9
|
+
export const listThirdPartyDeveloperTools = definePageTool({
|
|
10
|
+
name: 'list_3p_developer_tools',
|
|
11
|
+
description: `Lists all third-party developer tools the page exposes for providing runtime information.
|
|
12
|
+
Third-party developer tools can be called via the 'execute_3p_developer_tool()' MCP tool.
|
|
13
|
+
Alternatively, third-party developer tools can be executed by calling 'evaluate_script' and adding the
|
|
14
|
+
following command to the script:
|
|
15
|
+
'window.__dtmcp.executeTool(toolName, params)'
|
|
16
|
+
This might be helpful when the third-party developer tools return non-serializable values or when composing
|
|
17
|
+
third-party developer tools with additional functionality.`,
|
|
18
|
+
annotations: {
|
|
19
|
+
category: ToolCategory.THIRD_PARTY,
|
|
20
|
+
readOnlyHint: true,
|
|
21
|
+
},
|
|
22
|
+
schema: {},
|
|
23
|
+
blockedByDialog: false,
|
|
24
|
+
verifyFilesSchema: [],
|
|
25
|
+
handler: async (_request, response, _context) => {
|
|
26
|
+
response.setListThirdPartyDeveloperTools();
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
export const executeThirdPartyDeveloperTool = definePageTool({
|
|
30
|
+
name: 'execute_3p_developer_tool',
|
|
31
|
+
description: `Executes a tool exposed by the page.`,
|
|
32
|
+
annotations: {
|
|
33
|
+
category: ToolCategory.THIRD_PARTY,
|
|
34
|
+
readOnlyHint: false,
|
|
35
|
+
},
|
|
36
|
+
schema: {
|
|
37
|
+
toolName: zod.string().describe('The name of the tool to execute'),
|
|
38
|
+
params: zod
|
|
39
|
+
.string()
|
|
40
|
+
.optional()
|
|
41
|
+
.describe('The JSON-stringified parameters to pass to the tool'),
|
|
42
|
+
},
|
|
43
|
+
blockedByDialog: false,
|
|
44
|
+
verifyFilesSchema: [],
|
|
45
|
+
handler: async (request, response) => {
|
|
46
|
+
const toolName = request.params.toolName;
|
|
47
|
+
let params = {};
|
|
48
|
+
if (request.params.params) {
|
|
49
|
+
try {
|
|
50
|
+
const parsed = JSON.parse(request.params.params);
|
|
51
|
+
if (typeof parsed === 'object' && parsed !== null) {
|
|
52
|
+
params = parsed;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
throw new Error('Parsed params is not an object');
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
catch (e) {
|
|
59
|
+
const errorMessage = e instanceof Error ? e.message : String(e);
|
|
60
|
+
throw new Error(`Failed to parse params as JSON: ${errorMessage}`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const toolGroups = request.page.getThirdPartyDeveloperTools();
|
|
64
|
+
let tool;
|
|
65
|
+
if (toolGroups) {
|
|
66
|
+
for (const group of toolGroups) {
|
|
67
|
+
tool = group.tools?.find(t => t.name === toolName);
|
|
68
|
+
if (tool) {
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (!tool) {
|
|
74
|
+
throw new Error(`Tool ${toolName} not found`);
|
|
75
|
+
}
|
|
76
|
+
const ajvInstance = new ajv();
|
|
77
|
+
const validate = ajvInstance.compile(tool.inputSchema);
|
|
78
|
+
const valid = validate(params);
|
|
79
|
+
if (!valid) {
|
|
80
|
+
throw new Error(`Invalid parameters for tool ${toolName}: ${ajvInstance.errorsText(validate.errors)}`);
|
|
81
|
+
}
|
|
82
|
+
await request.page.executeThirdPartyDeveloperTool(toolName, params, response);
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
//# sourceMappingURL=thirdPartyDeveloper.js.map
|