@vibebrowser/chrome-devtools-mcp 0.26.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 +873 -0
- package/build/src/DevToolsConnectionAdapter.js +70 -0
- package/build/src/DevtoolsUtils.js +295 -0
- package/build/src/HeapSnapshotManager.js +110 -0
- package/build/src/McpContext.js +605 -0
- package/build/src/McpPage.js +315 -0
- package/build/src/McpResponse.js +858 -0
- package/build/src/Mutex.js +38 -0
- package/build/src/PageCollector.js +297 -0
- package/build/src/SlimMcpResponse.js +19 -0
- package/build/src/TextSnapshot.js +236 -0
- package/build/src/ToolHandler.js +217 -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 +840 -0
- package/build/src/bin/chrome-devtools-mcp-cli-options.js +350 -0
- package/build/src/bin/chrome-devtools-mcp-main.js +94 -0
- package/build/src/bin/chrome-devtools-mcp.js +31 -0
- package/build/src/bin/chrome-devtools.js +189 -0
- package/build/src/bin/install-service.js +246 -0
- package/build/src/bin/service/chrome-devtools-mcp.service.template +17 -0
- package/build/src/bin/service/com.vibebrowser.chrome-devtools-mcp.plist.template +37 -0
- package/build/src/browser.js +204 -0
- package/build/src/daemon/client.js +154 -0
- package/build/src/daemon/daemon.js +204 -0
- package/build/src/daemon/types.js +7 -0
- package/build/src/daemon/utils.js +115 -0
- package/build/src/formatters/ConsoleFormatter.js +288 -0
- package/build/src/formatters/HeapSnapshotFormatter.js +54 -0
- package/build/src/formatters/IssueFormatter.js +193 -0
- package/build/src/formatters/NetworkFormatter.js +236 -0
- package/build/src/formatters/SnapshotFormatter.js +135 -0
- package/build/src/index.js +140 -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/devtools-formatter-worker.js +8 -0
- package/build/src/third_party/devtools-heap-snapshot-worker.js +8 -0
- package/build/src/third_party/index.js +32 -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/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/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 +91 -0
- package/build/src/tools/emulation.js +57 -0
- package/build/src/tools/extensions.js +96 -0
- package/build/src/tools/input.js +461 -0
- package/build/src/tools/lighthouse.js +131 -0
- package/build/src/tools/memory.js +106 -0
- package/build/src/tools/network.js +125 -0
- package/build/src/tools/pages.js +411 -0
- package/build/src/tools/performance.js +196 -0
- package/build/src/tools/screencast.js +95 -0
- package/build/src/tools/screenshot.js +87 -0
- package/build/src/tools/script.js +151 -0
- package/build/src/tools/slim/tools.js +85 -0
- package/build/src/tools/snapshot.js +60 -0
- package/build/src/tools/thirdPartyDeveloper.js +75 -0
- package/build/src/tools/tools.js +56 -0
- package/build/src/tools/webmcp.js +64 -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 +18 -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 +93 -0
|
@@ -0,0 +1,125 @@
|
|
|
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
|
+
const FILTERABLE_RESOURCE_TYPES = [
|
|
10
|
+
'document',
|
|
11
|
+
'stylesheet',
|
|
12
|
+
'image',
|
|
13
|
+
'media',
|
|
14
|
+
'font',
|
|
15
|
+
'script',
|
|
16
|
+
'texttrack',
|
|
17
|
+
'xhr',
|
|
18
|
+
'fetch',
|
|
19
|
+
'prefetch',
|
|
20
|
+
'eventsource',
|
|
21
|
+
'websocket',
|
|
22
|
+
'manifest',
|
|
23
|
+
'signedexchange',
|
|
24
|
+
'ping',
|
|
25
|
+
'cspviolationreport',
|
|
26
|
+
'preflight',
|
|
27
|
+
'fedcm',
|
|
28
|
+
'other',
|
|
29
|
+
];
|
|
30
|
+
export const listNetworkRequests = definePageTool({
|
|
31
|
+
name: 'list_network_requests',
|
|
32
|
+
description: `List all requests for the currently selected page since the last navigation.`,
|
|
33
|
+
annotations: {
|
|
34
|
+
category: ToolCategory.NETWORK,
|
|
35
|
+
readOnlyHint: true,
|
|
36
|
+
},
|
|
37
|
+
schema: {
|
|
38
|
+
pageSize: zod
|
|
39
|
+
.number()
|
|
40
|
+
.int()
|
|
41
|
+
.positive()
|
|
42
|
+
.optional()
|
|
43
|
+
.describe('Maximum number of requests to return. When omitted, returns all requests.'),
|
|
44
|
+
pageIdx: zod
|
|
45
|
+
.number()
|
|
46
|
+
.int()
|
|
47
|
+
.min(0)
|
|
48
|
+
.optional()
|
|
49
|
+
.describe('Page number to return (0-based). When omitted, returns the first page.'),
|
|
50
|
+
resourceTypes: zod
|
|
51
|
+
.array(zod.enum(FILTERABLE_RESOURCE_TYPES))
|
|
52
|
+
.optional()
|
|
53
|
+
.describe('Filter requests to only return requests of the specified resource types. When omitted or empty, returns all requests.'),
|
|
54
|
+
includePreservedRequests: zod
|
|
55
|
+
.boolean()
|
|
56
|
+
.default(false)
|
|
57
|
+
.optional()
|
|
58
|
+
.describe('Set to true to return the preserved requests over the last 3 navigations.'),
|
|
59
|
+
},
|
|
60
|
+
blockedByDialog: false,
|
|
61
|
+
handler: async (request, response, context) => {
|
|
62
|
+
const data = await request.page.getDevToolsData();
|
|
63
|
+
response.attachDevToolsData(data);
|
|
64
|
+
const reqid = data?.cdpRequestId
|
|
65
|
+
? context.resolveCdpRequestId(request.page, data.cdpRequestId)
|
|
66
|
+
: undefined;
|
|
67
|
+
response.setIncludeNetworkRequests(true, {
|
|
68
|
+
pageSize: request.params.pageSize,
|
|
69
|
+
pageIdx: request.params.pageIdx,
|
|
70
|
+
resourceTypes: request.params.resourceTypes,
|
|
71
|
+
includePreservedRequests: request.params.includePreservedRequests,
|
|
72
|
+
networkRequestIdInDevToolsUI: reqid,
|
|
73
|
+
});
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
export const getNetworkRequest = definePageTool({
|
|
77
|
+
name: 'get_network_request',
|
|
78
|
+
description: `Gets a network request by an optional reqid, if omitted returns the currently selected request in the DevTools Network panel.`,
|
|
79
|
+
annotations: {
|
|
80
|
+
category: ToolCategory.NETWORK,
|
|
81
|
+
readOnlyHint: false,
|
|
82
|
+
},
|
|
83
|
+
schema: {
|
|
84
|
+
reqid: zod
|
|
85
|
+
.number()
|
|
86
|
+
.optional()
|
|
87
|
+
.describe('The reqid of the network request. If omitted returns the currently selected request in the DevTools Network panel.'),
|
|
88
|
+
requestFilePath: zod
|
|
89
|
+
.string()
|
|
90
|
+
.optional()
|
|
91
|
+
.describe('The absolute or relative path to a .network-request file to save the request body to. If omitted, the body is returned inline.'),
|
|
92
|
+
responseFilePath: zod
|
|
93
|
+
.string()
|
|
94
|
+
.optional()
|
|
95
|
+
.describe('The absolute or relative path to a .network-response file to save the response body to. If omitted, the body is returned inline.'),
|
|
96
|
+
},
|
|
97
|
+
blockedByDialog: true,
|
|
98
|
+
handler: async (request, response, context) => {
|
|
99
|
+
context.validatePath(request.params.requestFilePath);
|
|
100
|
+
context.validatePath(request.params.responseFilePath);
|
|
101
|
+
if (request.params.reqid) {
|
|
102
|
+
response.attachNetworkRequest(request.params.reqid, {
|
|
103
|
+
requestFilePath: request.params.requestFilePath,
|
|
104
|
+
responseFilePath: request.params.responseFilePath,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
const data = await request.page.getDevToolsData();
|
|
109
|
+
response.attachDevToolsData(data);
|
|
110
|
+
const reqid = data?.cdpRequestId
|
|
111
|
+
? context.resolveCdpRequestId(request.page, data.cdpRequestId)
|
|
112
|
+
: undefined;
|
|
113
|
+
if (reqid) {
|
|
114
|
+
response.attachNetworkRequest(reqid, {
|
|
115
|
+
requestFilePath: request.params.requestFilePath,
|
|
116
|
+
responseFilePath: request.params.responseFilePath,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
response.appendResponseLine(`Nothing is currently selected in the DevTools Network panel.`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
//# sourceMappingURL=network.js.map
|
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { logger } from '../logger.js';
|
|
7
|
+
import { zod } from '../third_party/index.js';
|
|
8
|
+
import { ToolCategory } from './categories.js';
|
|
9
|
+
import { CLOSE_PAGE_ERROR, definePageTool, defineTool, timeoutSchema, } from './ToolDefinition.js';
|
|
10
|
+
async function navigateWithInterception(page, action, allowListString, timeout) {
|
|
11
|
+
const allowList = allowListString
|
|
12
|
+
? allowListString.split(',').map((p) => new URLPattern(p.trim()))
|
|
13
|
+
: undefined;
|
|
14
|
+
const requestHandler = (interceptedRequest) => {
|
|
15
|
+
if (!interceptedRequest.isNavigationRequest()) {
|
|
16
|
+
void interceptedRequest.continue();
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const requestUrl = interceptedRequest.url();
|
|
20
|
+
const isAllowed = allowList.some((pattern) => pattern.test(requestUrl));
|
|
21
|
+
if (isAllowed) {
|
|
22
|
+
void interceptedRequest.continue();
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
logger(`Blocking request to: ${requestUrl}`);
|
|
26
|
+
void interceptedRequest.abort('blockedbyclient');
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const cleanupInterception = async () => {
|
|
30
|
+
if (allowList) {
|
|
31
|
+
page.pptrPage.off('request', requestHandler);
|
|
32
|
+
await page.pptrPage.setRequestInterception(false).catch(error => {
|
|
33
|
+
logger(`Failed to disable request interception`, error);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
if (allowList) {
|
|
38
|
+
await page.pptrPage.setRequestInterception(true);
|
|
39
|
+
page.pptrPage.on('request', requestHandler);
|
|
40
|
+
}
|
|
41
|
+
try {
|
|
42
|
+
await page.waitForEventsAfterAction(async () => {
|
|
43
|
+
try {
|
|
44
|
+
await action();
|
|
45
|
+
}
|
|
46
|
+
finally {
|
|
47
|
+
await cleanupInterception();
|
|
48
|
+
}
|
|
49
|
+
}, { timeout });
|
|
50
|
+
}
|
|
51
|
+
finally {
|
|
52
|
+
await cleanupInterception();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export const listPages = defineTool(args => {
|
|
56
|
+
return {
|
|
57
|
+
name: 'list_pages',
|
|
58
|
+
description: `Get a list of pages${args?.categoryExtensions ? ' including extension service workers' : ''} open in the browser.`,
|
|
59
|
+
annotations: {
|
|
60
|
+
category: ToolCategory.NAVIGATION,
|
|
61
|
+
readOnlyHint: true,
|
|
62
|
+
},
|
|
63
|
+
schema: {},
|
|
64
|
+
blockedByDialog: false,
|
|
65
|
+
handler: async (_request, response) => {
|
|
66
|
+
response.setIncludePages(true);
|
|
67
|
+
response.setListThirdPartyDeveloperTools();
|
|
68
|
+
response.setListWebMcpTools();
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
export const selectPage = defineTool({
|
|
73
|
+
name: 'select_page',
|
|
74
|
+
description: `Select a page as a context for future tool calls.`,
|
|
75
|
+
annotations: {
|
|
76
|
+
category: ToolCategory.NAVIGATION,
|
|
77
|
+
readOnlyHint: true,
|
|
78
|
+
},
|
|
79
|
+
schema: {
|
|
80
|
+
pageId: zod
|
|
81
|
+
.number()
|
|
82
|
+
.describe(`The ID of the page to select. Call ${listPages().name} to get available pages.`),
|
|
83
|
+
bringToFront: zod
|
|
84
|
+
.boolean()
|
|
85
|
+
.optional()
|
|
86
|
+
.describe('Whether to focus the page and bring it to the top.'),
|
|
87
|
+
},
|
|
88
|
+
blockedByDialog: false,
|
|
89
|
+
handler: async (request, response, context) => {
|
|
90
|
+
const page = context.getPageById(request.params.pageId);
|
|
91
|
+
context.selectPage(page);
|
|
92
|
+
response.setIncludePages(true);
|
|
93
|
+
response.setListThirdPartyDeveloperTools();
|
|
94
|
+
response.setListWebMcpTools();
|
|
95
|
+
if (request.params.bringToFront) {
|
|
96
|
+
await page.pptrPage.bringToFront();
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
export const closePage = defineTool({
|
|
101
|
+
name: 'close_page',
|
|
102
|
+
description: `Closes the page by its index. The last open page cannot be closed.`,
|
|
103
|
+
annotations: {
|
|
104
|
+
category: ToolCategory.NAVIGATION,
|
|
105
|
+
readOnlyHint: false,
|
|
106
|
+
},
|
|
107
|
+
schema: {
|
|
108
|
+
pageId: zod
|
|
109
|
+
.number()
|
|
110
|
+
.describe('The ID of the page to close. Call list_pages to list pages.'),
|
|
111
|
+
},
|
|
112
|
+
blockedByDialog: false,
|
|
113
|
+
handler: async (request, response, context) => {
|
|
114
|
+
try {
|
|
115
|
+
await context.closePage(request.params.pageId);
|
|
116
|
+
}
|
|
117
|
+
catch (err) {
|
|
118
|
+
if (err.message === CLOSE_PAGE_ERROR) {
|
|
119
|
+
response.appendResponseLine(err.message);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
throw err;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
response.setIncludePages(true);
|
|
126
|
+
response.setListThirdPartyDeveloperTools();
|
|
127
|
+
},
|
|
128
|
+
});
|
|
129
|
+
export const newPage = defineTool(args => {
|
|
130
|
+
return {
|
|
131
|
+
name: 'new_page',
|
|
132
|
+
description: `Open a new tab and load a URL. Use project URL if not specified otherwise.`,
|
|
133
|
+
annotations: {
|
|
134
|
+
category: ToolCategory.NAVIGATION,
|
|
135
|
+
readOnlyHint: false,
|
|
136
|
+
},
|
|
137
|
+
schema: {
|
|
138
|
+
url: zod.string().describe('URL to load in a new page.'),
|
|
139
|
+
background: zod
|
|
140
|
+
.boolean()
|
|
141
|
+
.optional()
|
|
142
|
+
.describe('Whether to open the page in the background without bringing it to the front. Default is false (foreground).'),
|
|
143
|
+
isolatedContext: zod
|
|
144
|
+
.string()
|
|
145
|
+
.optional()
|
|
146
|
+
.describe('If specified, the page is created in an isolated browser context with the given name. ' +
|
|
147
|
+
'Pages in the same browser context share cookies and storage. ' +
|
|
148
|
+
'Pages in different browser contexts are fully isolated.'),
|
|
149
|
+
...(args?.experimentalNavigationAllowlist
|
|
150
|
+
? {
|
|
151
|
+
allowList: zod
|
|
152
|
+
.string()
|
|
153
|
+
.optional()
|
|
154
|
+
.describe('Optional comma-separated list of URL patterns to allow. If provided, all other navigations will be blocked.'),
|
|
155
|
+
}
|
|
156
|
+
: {}),
|
|
157
|
+
...timeoutSchema,
|
|
158
|
+
},
|
|
159
|
+
blockedByDialog: false,
|
|
160
|
+
handler: async (request, response, context) => {
|
|
161
|
+
const page = await context.newPage(request.params.background, request.params.isolatedContext);
|
|
162
|
+
await navigateWithInterception(page, () => page.pptrPage.goto(request.params.url, {
|
|
163
|
+
timeout: request.params.timeout,
|
|
164
|
+
}), request.params.allowList, request.params.timeout);
|
|
165
|
+
response.setIncludePages(true);
|
|
166
|
+
response.setListThirdPartyDeveloperTools();
|
|
167
|
+
},
|
|
168
|
+
};
|
|
169
|
+
});
|
|
170
|
+
export const navigatePage = definePageTool(args => {
|
|
171
|
+
return {
|
|
172
|
+
name: 'navigate_page',
|
|
173
|
+
description: `Go to a URL, or back, forward, or reload. Use project URL if not specified otherwise.`,
|
|
174
|
+
annotations: {
|
|
175
|
+
category: ToolCategory.NAVIGATION,
|
|
176
|
+
readOnlyHint: false,
|
|
177
|
+
},
|
|
178
|
+
schema: {
|
|
179
|
+
type: zod
|
|
180
|
+
.enum(['url', 'back', 'forward', 'reload'])
|
|
181
|
+
.optional()
|
|
182
|
+
.describe('Navigate the page by URL, back or forward in history, or reload.'),
|
|
183
|
+
url: zod.string().optional().describe('Target URL (only type=url)'),
|
|
184
|
+
ignoreCache: zod
|
|
185
|
+
.boolean()
|
|
186
|
+
.optional()
|
|
187
|
+
.describe('Whether to ignore cache on reload.'),
|
|
188
|
+
handleBeforeUnload: zod
|
|
189
|
+
.enum(['accept', 'decline'])
|
|
190
|
+
.optional()
|
|
191
|
+
.describe('Whether to auto accept or beforeunload dialogs triggered by this navigation. Default is accept.'),
|
|
192
|
+
initScript: zod
|
|
193
|
+
.string()
|
|
194
|
+
.optional()
|
|
195
|
+
.describe('A JavaScript script to be executed on each new document before any other scripts for the next navigation.'),
|
|
196
|
+
...(args?.experimentalNavigationAllowlist
|
|
197
|
+
? {
|
|
198
|
+
allowList: zod
|
|
199
|
+
.string()
|
|
200
|
+
.optional()
|
|
201
|
+
.describe('Optional comma-separated list of URL patterns to allow. If provided, all other navigations will be blocked.'),
|
|
202
|
+
}
|
|
203
|
+
: {}),
|
|
204
|
+
...timeoutSchema,
|
|
205
|
+
},
|
|
206
|
+
blockedByDialog: false,
|
|
207
|
+
handler: async (request, response) => {
|
|
208
|
+
const page = request.page;
|
|
209
|
+
const options = {
|
|
210
|
+
timeout: request.params.timeout,
|
|
211
|
+
};
|
|
212
|
+
if (!request.params.type && !request.params.url) {
|
|
213
|
+
throw new Error('Either URL or a type is required.');
|
|
214
|
+
}
|
|
215
|
+
if (!request.params.type) {
|
|
216
|
+
request.params.type = 'url';
|
|
217
|
+
}
|
|
218
|
+
const handleBeforeUnload = request.params.handleBeforeUnload ?? 'accept';
|
|
219
|
+
const dialogHandler = (dialog) => {
|
|
220
|
+
if (dialog.type() === 'beforeunload') {
|
|
221
|
+
if (handleBeforeUnload === 'accept') {
|
|
222
|
+
response.appendResponseLine(`Accepted a beforeunload dialog.`);
|
|
223
|
+
void dialog.accept();
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
response.appendResponseLine(`Declined a beforeunload dialog.`);
|
|
227
|
+
void dialog.dismiss();
|
|
228
|
+
}
|
|
229
|
+
// We are not going to report the dialog like regular dialogs.
|
|
230
|
+
page.clearDialog();
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
let initScriptId;
|
|
234
|
+
if (request.params.initScript) {
|
|
235
|
+
const { identifier } = await page.pptrPage.evaluateOnNewDocument(request.params.initScript);
|
|
236
|
+
initScriptId = identifier;
|
|
237
|
+
}
|
|
238
|
+
page.pptrPage.on('dialog', dialogHandler);
|
|
239
|
+
try {
|
|
240
|
+
await navigateWithInterception(page, async () => {
|
|
241
|
+
switch (request.params.type) {
|
|
242
|
+
case 'url':
|
|
243
|
+
if (!request.params.url) {
|
|
244
|
+
throw new Error('A URL is required for navigation of type=url.');
|
|
245
|
+
}
|
|
246
|
+
try {
|
|
247
|
+
await page.pptrPage.goto(request.params.url, options);
|
|
248
|
+
response.appendResponseLine(`Successfully navigated to ${request.params.url}.`);
|
|
249
|
+
}
|
|
250
|
+
catch (error) {
|
|
251
|
+
response.appendResponseLine(`Unable to navigate in the selected page: ${error.message}.`);
|
|
252
|
+
}
|
|
253
|
+
break;
|
|
254
|
+
case 'back':
|
|
255
|
+
try {
|
|
256
|
+
await page.pptrPage.goBack(options);
|
|
257
|
+
response.appendResponseLine(`Successfully navigated back to ${page.pptrPage.url()}.`);
|
|
258
|
+
}
|
|
259
|
+
catch (error) {
|
|
260
|
+
response.appendResponseLine(`Unable to navigate back in the selected page: ${error.message}.`);
|
|
261
|
+
}
|
|
262
|
+
break;
|
|
263
|
+
case 'forward':
|
|
264
|
+
try {
|
|
265
|
+
await page.pptrPage.goForward(options);
|
|
266
|
+
response.appendResponseLine(`Successfully navigated forward to ${page.pptrPage.url()}.`);
|
|
267
|
+
}
|
|
268
|
+
catch (error) {
|
|
269
|
+
response.appendResponseLine(`Unable to navigate forward in the selected page: ${error.message}.`);
|
|
270
|
+
}
|
|
271
|
+
break;
|
|
272
|
+
case 'reload':
|
|
273
|
+
try {
|
|
274
|
+
await page.pptrPage.reload({
|
|
275
|
+
...options,
|
|
276
|
+
ignoreCache: request.params.ignoreCache,
|
|
277
|
+
});
|
|
278
|
+
response.appendResponseLine(`Successfully reloaded the page.`);
|
|
279
|
+
}
|
|
280
|
+
catch (error) {
|
|
281
|
+
response.appendResponseLine(`Unable to reload the selected page: ${error.message}.`);
|
|
282
|
+
}
|
|
283
|
+
break;
|
|
284
|
+
}
|
|
285
|
+
}, request.params.allowList, request.params.timeout);
|
|
286
|
+
}
|
|
287
|
+
finally {
|
|
288
|
+
page.pptrPage.off('dialog', dialogHandler);
|
|
289
|
+
if (initScriptId) {
|
|
290
|
+
await page.pptrPage
|
|
291
|
+
.removeScriptToEvaluateOnNewDocument(initScriptId)
|
|
292
|
+
.catch(error => {
|
|
293
|
+
logger(`Failed to remove init script`, error);
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
response.setIncludePages(true);
|
|
298
|
+
response.setListThirdPartyDeveloperTools();
|
|
299
|
+
response.setListWebMcpTools();
|
|
300
|
+
},
|
|
301
|
+
};
|
|
302
|
+
});
|
|
303
|
+
export const resizePage = definePageTool({
|
|
304
|
+
name: 'resize_page',
|
|
305
|
+
description: `Resizes the selected page's window so that the page has specified dimension`,
|
|
306
|
+
annotations: {
|
|
307
|
+
category: ToolCategory.EMULATION,
|
|
308
|
+
readOnlyHint: false,
|
|
309
|
+
},
|
|
310
|
+
schema: {
|
|
311
|
+
width: zod.number().describe('Page width'),
|
|
312
|
+
height: zod.number().describe('Page height'),
|
|
313
|
+
},
|
|
314
|
+
blockedByDialog: false,
|
|
315
|
+
handler: async (request, response, _context) => {
|
|
316
|
+
const page = request.page;
|
|
317
|
+
try {
|
|
318
|
+
const browser = page.pptrPage.browser();
|
|
319
|
+
const windowId = await page.pptrPage.windowId();
|
|
320
|
+
const bounds = await browser.getWindowBounds(windowId);
|
|
321
|
+
if (bounds.windowState === 'fullscreen') {
|
|
322
|
+
// Have to call this twice on Ubuntu when the window is in fullscreen mode.
|
|
323
|
+
await browser.setWindowBounds(windowId, { windowState: 'normal' });
|
|
324
|
+
await browser.setWindowBounds(windowId, { windowState: 'normal' });
|
|
325
|
+
}
|
|
326
|
+
else if (bounds.windowState !== 'normal') {
|
|
327
|
+
await browser.setWindowBounds(windowId, { windowState: 'normal' });
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
catch {
|
|
331
|
+
// Window APIs are not supported on all platforms
|
|
332
|
+
}
|
|
333
|
+
await page.pptrPage.resize({
|
|
334
|
+
contentWidth: request.params.width,
|
|
335
|
+
contentHeight: request.params.height,
|
|
336
|
+
});
|
|
337
|
+
response.setIncludePages(true);
|
|
338
|
+
},
|
|
339
|
+
});
|
|
340
|
+
export const handleDialog = definePageTool({
|
|
341
|
+
name: 'handle_dialog',
|
|
342
|
+
description: `If a browser dialog was opened, use this command to handle it`,
|
|
343
|
+
annotations: {
|
|
344
|
+
category: ToolCategory.INPUT,
|
|
345
|
+
readOnlyHint: false,
|
|
346
|
+
},
|
|
347
|
+
schema: {
|
|
348
|
+
action: zod
|
|
349
|
+
.enum(['accept', 'dismiss'])
|
|
350
|
+
.describe('Whether to dismiss or accept the dialog'),
|
|
351
|
+
promptText: zod
|
|
352
|
+
.string()
|
|
353
|
+
.optional()
|
|
354
|
+
.describe('Optional prompt text to enter into the dialog.'),
|
|
355
|
+
},
|
|
356
|
+
blockedByDialog: false,
|
|
357
|
+
handler: async (request, response, _context) => {
|
|
358
|
+
const page = request.page;
|
|
359
|
+
const dialog = page.getDialog();
|
|
360
|
+
if (!dialog) {
|
|
361
|
+
throw new Error('No open dialog found');
|
|
362
|
+
}
|
|
363
|
+
switch (request.params.action) {
|
|
364
|
+
case 'accept': {
|
|
365
|
+
try {
|
|
366
|
+
await dialog.accept(request.params.promptText);
|
|
367
|
+
}
|
|
368
|
+
catch (err) {
|
|
369
|
+
// Likely already handled by the user outside of MCP.
|
|
370
|
+
logger(err);
|
|
371
|
+
}
|
|
372
|
+
response.appendResponseLine('Successfully accepted the dialog');
|
|
373
|
+
break;
|
|
374
|
+
}
|
|
375
|
+
case 'dismiss': {
|
|
376
|
+
try {
|
|
377
|
+
await dialog.dismiss();
|
|
378
|
+
}
|
|
379
|
+
catch (err) {
|
|
380
|
+
// Likely already handled.
|
|
381
|
+
logger(err);
|
|
382
|
+
}
|
|
383
|
+
response.appendResponseLine('Successfully dismissed the dialog');
|
|
384
|
+
break;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
page.clearDialog();
|
|
388
|
+
response.setIncludePages(true);
|
|
389
|
+
},
|
|
390
|
+
});
|
|
391
|
+
export const getTabId = definePageTool({
|
|
392
|
+
name: 'get_tab_id',
|
|
393
|
+
description: `Get the tab ID of the page`,
|
|
394
|
+
annotations: {
|
|
395
|
+
category: ToolCategory.NAVIGATION,
|
|
396
|
+
readOnlyHint: true,
|
|
397
|
+
conditions: ['experimentalInteropTools'],
|
|
398
|
+
},
|
|
399
|
+
schema: {
|
|
400
|
+
pageId: zod
|
|
401
|
+
.number()
|
|
402
|
+
.describe(`The ID of the page to get the tab ID for. Call ${listPages().name} to get available pages.`),
|
|
403
|
+
},
|
|
404
|
+
blockedByDialog: false,
|
|
405
|
+
handler: async (request, response, context) => {
|
|
406
|
+
const page = context.getPageById(request.params.pageId);
|
|
407
|
+
const tabId = page.pptrPage._tabId;
|
|
408
|
+
response.setTabId(tabId);
|
|
409
|
+
},
|
|
410
|
+
});
|
|
411
|
+
//# sourceMappingURL=pages.js.map
|