@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,858 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { ConsoleFormatter } from './formatters/ConsoleFormatter.js';
|
|
7
|
+
import { HeapSnapshotFormatter } from './formatters/HeapSnapshotFormatter.js';
|
|
8
|
+
import { isNodeLike } from './formatters/HeapSnapshotFormatter.js';
|
|
9
|
+
import { IssueFormatter } from './formatters/IssueFormatter.js';
|
|
10
|
+
import { NetworkFormatter } from './formatters/NetworkFormatter.js';
|
|
11
|
+
import { SnapshotFormatter } from './formatters/SnapshotFormatter.js';
|
|
12
|
+
import { UncaughtError } from './PageCollector.js';
|
|
13
|
+
import { TextSnapshot } from './TextSnapshot.js';
|
|
14
|
+
import { DevTools } from './third_party/index.js';
|
|
15
|
+
import { handleDialog } from './tools/pages.js';
|
|
16
|
+
import { getInsightOutput, getTraceSummary } from './trace-processing/parse.js';
|
|
17
|
+
import { paginate } from './utils/pagination.js';
|
|
18
|
+
export function replaceHtmlElementsWithUids(schema) {
|
|
19
|
+
if (typeof schema === 'boolean') {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
let isHtmlElement = false;
|
|
23
|
+
for (const [key, value] of Object.entries(schema)) {
|
|
24
|
+
if (key === 'x-mcp-type' && value === 'HTMLElement') {
|
|
25
|
+
isHtmlElement = true;
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (isHtmlElement) {
|
|
30
|
+
schema.properties = { uid: { type: 'string' } };
|
|
31
|
+
schema.required = ['uid'];
|
|
32
|
+
}
|
|
33
|
+
if (schema.properties) {
|
|
34
|
+
for (const key of Object.keys(schema.properties)) {
|
|
35
|
+
replaceHtmlElementsWithUids(schema.properties[key]);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (schema.items) {
|
|
39
|
+
if (Array.isArray(schema.items)) {
|
|
40
|
+
for (const item of schema.items) {
|
|
41
|
+
replaceHtmlElementsWithUids(item);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
replaceHtmlElementsWithUids(schema.items);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (schema.anyOf) {
|
|
49
|
+
for (const s of schema.anyOf) {
|
|
50
|
+
replaceHtmlElementsWithUids(s);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (schema.allOf) {
|
|
54
|
+
for (const s of schema.allOf) {
|
|
55
|
+
replaceHtmlElementsWithUids(s);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (schema.oneOf) {
|
|
59
|
+
for (const s of schema.oneOf) {
|
|
60
|
+
replaceHtmlElementsWithUids(s);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
async function getToolGroup(page) {
|
|
65
|
+
// Check if there is a `devtoolstooldiscovery` event listener
|
|
66
|
+
const windowHandle = await page.pptrPage.evaluateHandle(() => window);
|
|
67
|
+
// @ts-expect-error internal API
|
|
68
|
+
const client = page.pptrPage._client();
|
|
69
|
+
const { listeners } = await client.send('DOMDebugger.getEventListeners', {
|
|
70
|
+
objectId: windowHandle.remoteObject().objectId,
|
|
71
|
+
});
|
|
72
|
+
if (listeners.find(l => l.type === 'devtoolstooldiscovery') === undefined) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const toolGroup = await page.pptrPage.evaluate(() => {
|
|
76
|
+
return new Promise(resolve => {
|
|
77
|
+
const event = new CustomEvent('devtoolstooldiscovery');
|
|
78
|
+
// @ts-expect-error Adding custom property
|
|
79
|
+
event.respondWith = (toolGroup) => {
|
|
80
|
+
if (!window.__dtmcp) {
|
|
81
|
+
window.__dtmcp = {};
|
|
82
|
+
}
|
|
83
|
+
window.__dtmcp.toolGroup = toolGroup;
|
|
84
|
+
// When receiving a toolGroup for the first time, expose a simple execution helper
|
|
85
|
+
if (!window.__dtmcp.executeTool) {
|
|
86
|
+
window.__dtmcp.executeTool = async (toolName, args) => {
|
|
87
|
+
if (!window.__dtmcp?.toolGroup) {
|
|
88
|
+
throw new Error('No tools found on the page');
|
|
89
|
+
}
|
|
90
|
+
const tool = window.__dtmcp.toolGroup.tools.find(t => t.name === toolName);
|
|
91
|
+
if (!tool) {
|
|
92
|
+
throw new Error(`Tool ${toolName} not found`);
|
|
93
|
+
}
|
|
94
|
+
return await tool.execute(args);
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
resolve(toolGroup);
|
|
98
|
+
};
|
|
99
|
+
window.dispatchEvent(event);
|
|
100
|
+
// If the page does not synchronously call `event.respondWith`, return instead of timing out
|
|
101
|
+
setTimeout(() => {
|
|
102
|
+
resolve(null);
|
|
103
|
+
}, 0);
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
for (const tool of toolGroup?.tools ?? []) {
|
|
107
|
+
replaceHtmlElementsWithUids(tool.inputSchema);
|
|
108
|
+
}
|
|
109
|
+
return toolGroup;
|
|
110
|
+
}
|
|
111
|
+
export class McpResponse {
|
|
112
|
+
#includePages = false;
|
|
113
|
+
#includeExtensionServiceWorkers = false;
|
|
114
|
+
#includeExtensionPages = false;
|
|
115
|
+
#snapshotParams;
|
|
116
|
+
#attachedNetworkRequestId;
|
|
117
|
+
#attachedNetworkRequestOptions;
|
|
118
|
+
#attachedConsoleMessageId;
|
|
119
|
+
#attachedTraceSummary;
|
|
120
|
+
#attachedTraceInsight;
|
|
121
|
+
#attachedLighthouseResult;
|
|
122
|
+
#textResponseLines = [];
|
|
123
|
+
#images = [];
|
|
124
|
+
#heapSnapshotOptions;
|
|
125
|
+
#networkRequestsOptions;
|
|
126
|
+
#consoleDataOptions;
|
|
127
|
+
#listExtensions;
|
|
128
|
+
#listThirdPartyDeveloperTools;
|
|
129
|
+
#listWebMcpTools;
|
|
130
|
+
#devToolsData;
|
|
131
|
+
#tabId;
|
|
132
|
+
#args;
|
|
133
|
+
#page;
|
|
134
|
+
#redactNetworkHeaders = true;
|
|
135
|
+
#error;
|
|
136
|
+
#attachedWaitForResult;
|
|
137
|
+
constructor(args) {
|
|
138
|
+
this.#args = args;
|
|
139
|
+
}
|
|
140
|
+
setPage(page) {
|
|
141
|
+
this.#page = page;
|
|
142
|
+
}
|
|
143
|
+
setRedactNetworkHeaders(value) {
|
|
144
|
+
this.#redactNetworkHeaders = value;
|
|
145
|
+
}
|
|
146
|
+
attachDevToolsData(data) {
|
|
147
|
+
this.#devToolsData = data;
|
|
148
|
+
}
|
|
149
|
+
setTabId(tabId) {
|
|
150
|
+
this.#tabId = tabId;
|
|
151
|
+
}
|
|
152
|
+
setIncludePages(value) {
|
|
153
|
+
this.#includePages = value;
|
|
154
|
+
if (this.#args.categoryExtensions) {
|
|
155
|
+
this.#includeExtensionServiceWorkers = value;
|
|
156
|
+
this.#includeExtensionPages = value;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
includeSnapshot(params) {
|
|
160
|
+
this.#snapshotParams = params ?? {
|
|
161
|
+
verbose: false,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
setListExtensions() {
|
|
165
|
+
this.#listExtensions = true;
|
|
166
|
+
}
|
|
167
|
+
setListThirdPartyDeveloperTools() {
|
|
168
|
+
this.#listThirdPartyDeveloperTools = true;
|
|
169
|
+
}
|
|
170
|
+
setListWebMcpTools() {
|
|
171
|
+
this.#listWebMcpTools = true;
|
|
172
|
+
}
|
|
173
|
+
setIncludeNetworkRequests(value, options) {
|
|
174
|
+
if (!value) {
|
|
175
|
+
this.#networkRequestsOptions = undefined;
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
this.#networkRequestsOptions = {
|
|
179
|
+
include: value,
|
|
180
|
+
pagination: options?.pageSize || options?.pageIdx
|
|
181
|
+
? {
|
|
182
|
+
pageSize: options.pageSize,
|
|
183
|
+
pageIdx: options.pageIdx,
|
|
184
|
+
}
|
|
185
|
+
: undefined,
|
|
186
|
+
resourceTypes: options?.resourceTypes,
|
|
187
|
+
includePreservedRequests: options?.includePreservedRequests,
|
|
188
|
+
networkRequestIdInDevToolsUI: options?.networkRequestIdInDevToolsUI,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
setIncludeConsoleData(value, options) {
|
|
192
|
+
if (!value) {
|
|
193
|
+
this.#consoleDataOptions = undefined;
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
this.#consoleDataOptions = {
|
|
197
|
+
include: value,
|
|
198
|
+
pagination: options?.pageSize || options?.pageIdx
|
|
199
|
+
? {
|
|
200
|
+
pageSize: options.pageSize,
|
|
201
|
+
pageIdx: options.pageIdx,
|
|
202
|
+
}
|
|
203
|
+
: undefined,
|
|
204
|
+
types: options?.types,
|
|
205
|
+
includePreservedMessages: options?.includePreservedMessages,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
setError(error) {
|
|
209
|
+
this.#error = error;
|
|
210
|
+
}
|
|
211
|
+
attachNetworkRequest(reqId, options) {
|
|
212
|
+
this.#attachedNetworkRequestId = reqId;
|
|
213
|
+
this.#attachedNetworkRequestOptions = options;
|
|
214
|
+
}
|
|
215
|
+
attachConsoleMessage(msgid) {
|
|
216
|
+
this.#attachedConsoleMessageId = msgid;
|
|
217
|
+
}
|
|
218
|
+
attachTraceSummary(result) {
|
|
219
|
+
this.#attachedTraceSummary = result;
|
|
220
|
+
}
|
|
221
|
+
attachTraceInsight(trace, insightSetId, insightName) {
|
|
222
|
+
this.#attachedTraceInsight = {
|
|
223
|
+
trace,
|
|
224
|
+
insightSetId,
|
|
225
|
+
insightName,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
attachLighthouseResult(result) {
|
|
229
|
+
this.#attachedLighthouseResult = result;
|
|
230
|
+
}
|
|
231
|
+
get includePages() {
|
|
232
|
+
return this.#includePages;
|
|
233
|
+
}
|
|
234
|
+
get attachedTraceSummary() {
|
|
235
|
+
return this.#attachedTraceSummary;
|
|
236
|
+
}
|
|
237
|
+
get attachedTracedInsight() {
|
|
238
|
+
return this.#attachedTraceInsight;
|
|
239
|
+
}
|
|
240
|
+
get attachedLighthouseResult() {
|
|
241
|
+
return this.#attachedLighthouseResult;
|
|
242
|
+
}
|
|
243
|
+
get includeNetworkRequests() {
|
|
244
|
+
return this.#networkRequestsOptions?.include ?? false;
|
|
245
|
+
}
|
|
246
|
+
get includeConsoleData() {
|
|
247
|
+
return this.#consoleDataOptions?.include ?? false;
|
|
248
|
+
}
|
|
249
|
+
get attachedNetworkRequestId() {
|
|
250
|
+
return this.#attachedNetworkRequestId;
|
|
251
|
+
}
|
|
252
|
+
get networkRequestsPageIdx() {
|
|
253
|
+
return this.#networkRequestsOptions?.pagination?.pageIdx;
|
|
254
|
+
}
|
|
255
|
+
get consoleMessagesPageIdx() {
|
|
256
|
+
return this.#consoleDataOptions?.pagination?.pageIdx;
|
|
257
|
+
}
|
|
258
|
+
get consoleMessagesTypes() {
|
|
259
|
+
return this.#consoleDataOptions?.types;
|
|
260
|
+
}
|
|
261
|
+
get error() {
|
|
262
|
+
return this.#error;
|
|
263
|
+
}
|
|
264
|
+
appendResponseLine(value) {
|
|
265
|
+
this.#textResponseLines.push(value);
|
|
266
|
+
}
|
|
267
|
+
attachWaitForResult(result) {
|
|
268
|
+
this.#attachedWaitForResult = result;
|
|
269
|
+
}
|
|
270
|
+
setHeapSnapshotAggregates(aggregates, options) {
|
|
271
|
+
this.#heapSnapshotOptions = {
|
|
272
|
+
...this.#heapSnapshotOptions,
|
|
273
|
+
include: true,
|
|
274
|
+
aggregates,
|
|
275
|
+
pagination: options,
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
setHeapSnapshotStats(stats, staticData) {
|
|
279
|
+
this.#heapSnapshotOptions = {
|
|
280
|
+
...this.#heapSnapshotOptions,
|
|
281
|
+
include: true,
|
|
282
|
+
stats,
|
|
283
|
+
staticData,
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
setHeapSnapshotNodes(nodes, options) {
|
|
287
|
+
this.#heapSnapshotOptions = {
|
|
288
|
+
...this.#heapSnapshotOptions,
|
|
289
|
+
include: true,
|
|
290
|
+
nodes,
|
|
291
|
+
pagination: options,
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
attachImage(value) {
|
|
295
|
+
this.#images.push(value);
|
|
296
|
+
}
|
|
297
|
+
get responseLines() {
|
|
298
|
+
return this.#textResponseLines;
|
|
299
|
+
}
|
|
300
|
+
get images() {
|
|
301
|
+
return this.#images;
|
|
302
|
+
}
|
|
303
|
+
get snapshotParams() {
|
|
304
|
+
return this.#snapshotParams;
|
|
305
|
+
}
|
|
306
|
+
get listWebMcpTools() {
|
|
307
|
+
return this.#listWebMcpTools;
|
|
308
|
+
}
|
|
309
|
+
async handle(toolName, context) {
|
|
310
|
+
if (this.#includePages) {
|
|
311
|
+
await context.createPagesSnapshot();
|
|
312
|
+
}
|
|
313
|
+
if (this.#includeExtensionServiceWorkers) {
|
|
314
|
+
await context.createExtensionServiceWorkersSnapshot();
|
|
315
|
+
}
|
|
316
|
+
let snapshot;
|
|
317
|
+
if (this.#snapshotParams) {
|
|
318
|
+
if (!this.#page) {
|
|
319
|
+
throw new Error('Response must have a page');
|
|
320
|
+
}
|
|
321
|
+
this.#page.textSnapshot = await TextSnapshot.create(this.#page, {
|
|
322
|
+
verbose: this.#snapshotParams.verbose,
|
|
323
|
+
devtoolsData: this.#devToolsData,
|
|
324
|
+
});
|
|
325
|
+
const textSnapshot = this.#page.textSnapshot;
|
|
326
|
+
if (textSnapshot) {
|
|
327
|
+
const formatter = new SnapshotFormatter(textSnapshot);
|
|
328
|
+
if (this.#snapshotParams.filePath) {
|
|
329
|
+
const result = await context.saveFile(new TextEncoder().encode(formatter.toString()), this.#snapshotParams.filePath, '.txt');
|
|
330
|
+
snapshot = result.filename;
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
333
|
+
snapshot = formatter;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
let detailedNetworkRequest;
|
|
338
|
+
if (this.#attachedNetworkRequestId) {
|
|
339
|
+
if (!this.#page) {
|
|
340
|
+
throw new Error(`Response must have an McpPage`);
|
|
341
|
+
}
|
|
342
|
+
const request = context.getNetworkRequestById(this.#page, this.#attachedNetworkRequestId);
|
|
343
|
+
const formatter = await NetworkFormatter.from(request, {
|
|
344
|
+
requestId: this.#attachedNetworkRequestId,
|
|
345
|
+
requestIdResolver: req => context.getNetworkRequestStableId(req),
|
|
346
|
+
fetchData: true,
|
|
347
|
+
requestFilePath: this.#attachedNetworkRequestOptions?.requestFilePath,
|
|
348
|
+
responseFilePath: this.#attachedNetworkRequestOptions?.responseFilePath,
|
|
349
|
+
saveFile: (data, filename, extension) => context.saveFile(data, filename, extension),
|
|
350
|
+
redactNetworkHeaders: this.#redactNetworkHeaders,
|
|
351
|
+
});
|
|
352
|
+
detailedNetworkRequest = formatter;
|
|
353
|
+
}
|
|
354
|
+
let detailedConsoleMessage;
|
|
355
|
+
if (this.#attachedConsoleMessageId) {
|
|
356
|
+
if (!this.#page) {
|
|
357
|
+
throw new Error(`Response must have an McpPage`);
|
|
358
|
+
}
|
|
359
|
+
const message = context.getConsoleMessageById(this.#page, this.#attachedConsoleMessageId);
|
|
360
|
+
const consoleMessageStableId = this.#attachedConsoleMessageId;
|
|
361
|
+
if ('args' in message || message instanceof UncaughtError) {
|
|
362
|
+
const consoleMessage = message;
|
|
363
|
+
const devTools = context.getDevToolsUniverse(this.#page);
|
|
364
|
+
detailedConsoleMessage = await ConsoleFormatter.from(consoleMessage, {
|
|
365
|
+
id: consoleMessageStableId,
|
|
366
|
+
fetchDetailedData: true,
|
|
367
|
+
devTools: devTools ?? undefined,
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
else if (message instanceof DevTools.AggregatedIssue) {
|
|
371
|
+
const formatter = new IssueFormatter(message, {
|
|
372
|
+
id: consoleMessageStableId,
|
|
373
|
+
requestIdResolver: context.resolveCdpRequestId.bind(context, this.#page),
|
|
374
|
+
elementIdResolver: this.#page.resolveCdpElementId.bind(this.#page),
|
|
375
|
+
});
|
|
376
|
+
if (!formatter.isValid()) {
|
|
377
|
+
throw new Error("Can't provide details for the msgid " + consoleMessageStableId);
|
|
378
|
+
}
|
|
379
|
+
detailedConsoleMessage = formatter;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
let extensions;
|
|
383
|
+
if (this.#listExtensions) {
|
|
384
|
+
extensions = await context.listExtensions();
|
|
385
|
+
}
|
|
386
|
+
// Null indicates no tools.
|
|
387
|
+
let thirdPartyDeveloperTools;
|
|
388
|
+
if (this.#args.categoryExperimentalThirdParty &&
|
|
389
|
+
this.#listThirdPartyDeveloperTools &&
|
|
390
|
+
this.#page) {
|
|
391
|
+
thirdPartyDeveloperTools = await getToolGroup(this.#page);
|
|
392
|
+
if (thirdPartyDeveloperTools) {
|
|
393
|
+
this.#page.thirdPartyDeveloperTools = thirdPartyDeveloperTools;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
let webmcpTools;
|
|
397
|
+
if (this.#args.categoryExperimentalWebmcp &&
|
|
398
|
+
this.#listWebMcpTools &&
|
|
399
|
+
this.#page) {
|
|
400
|
+
webmcpTools = this.#page.getWebMcpTools();
|
|
401
|
+
}
|
|
402
|
+
let consoleMessages;
|
|
403
|
+
if (this.#consoleDataOptions?.include) {
|
|
404
|
+
if (!this.#page) {
|
|
405
|
+
throw new Error(`Response must have an McpPage`);
|
|
406
|
+
}
|
|
407
|
+
const page = this.#page;
|
|
408
|
+
let messages = context.getConsoleData(this.#page, this.#consoleDataOptions.includePreservedMessages);
|
|
409
|
+
if (this.#consoleDataOptions.types?.length) {
|
|
410
|
+
const normalizedTypes = new Set(this.#consoleDataOptions.types);
|
|
411
|
+
messages = messages.filter(message => {
|
|
412
|
+
if ('type' in message) {
|
|
413
|
+
return normalizedTypes.has(message.type());
|
|
414
|
+
}
|
|
415
|
+
if (message instanceof DevTools.AggregatedIssue) {
|
|
416
|
+
return normalizedTypes.has('issue');
|
|
417
|
+
}
|
|
418
|
+
return normalizedTypes.has('error');
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
consoleMessages = (await Promise.all(messages.map(async (item) => {
|
|
422
|
+
const consoleMessageStableId = context.getConsoleMessageStableId(item);
|
|
423
|
+
if ('args' in item || item instanceof UncaughtError) {
|
|
424
|
+
const consoleMessage = item;
|
|
425
|
+
const devTools = context.getDevToolsUniverse(page);
|
|
426
|
+
return await ConsoleFormatter.from(consoleMessage, {
|
|
427
|
+
id: consoleMessageStableId,
|
|
428
|
+
fetchDetailedData: false,
|
|
429
|
+
devTools: devTools ?? undefined,
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
if (item instanceof DevTools.AggregatedIssue) {
|
|
433
|
+
const formatter = new IssueFormatter(item, {
|
|
434
|
+
id: consoleMessageStableId,
|
|
435
|
+
});
|
|
436
|
+
if (!formatter.isValid()) {
|
|
437
|
+
return null;
|
|
438
|
+
}
|
|
439
|
+
return formatter;
|
|
440
|
+
}
|
|
441
|
+
return null;
|
|
442
|
+
}))).filter(item => item !== null);
|
|
443
|
+
}
|
|
444
|
+
let networkRequests;
|
|
445
|
+
if (this.#networkRequestsOptions?.include) {
|
|
446
|
+
if (!this.#page) {
|
|
447
|
+
throw new Error(`Response must have an McpPage`);
|
|
448
|
+
}
|
|
449
|
+
let requests = context.getNetworkRequests(this.#page, this.#networkRequestsOptions?.includePreservedRequests);
|
|
450
|
+
// Apply resource type filtering if specified
|
|
451
|
+
if (this.#networkRequestsOptions.resourceTypes?.length) {
|
|
452
|
+
const normalizedTypes = new Set(this.#networkRequestsOptions.resourceTypes);
|
|
453
|
+
requests = requests.filter(request => {
|
|
454
|
+
const type = request.resourceType();
|
|
455
|
+
return normalizedTypes.has(type);
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
if (requests.length) {
|
|
459
|
+
networkRequests = await Promise.all(requests.map(request => NetworkFormatter.from(request, {
|
|
460
|
+
requestId: context.getNetworkRequestStableId(request),
|
|
461
|
+
selectedInDevToolsUI: context.getNetworkRequestStableId(request) ===
|
|
462
|
+
this.#networkRequestsOptions?.networkRequestIdInDevToolsUI,
|
|
463
|
+
fetchData: false,
|
|
464
|
+
saveFile: (data, filename, extension) => context.saveFile(data, filename, extension),
|
|
465
|
+
redactNetworkHeaders: this.#redactNetworkHeaders,
|
|
466
|
+
})));
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
return this.format(toolName, context, {
|
|
470
|
+
detailedConsoleMessage,
|
|
471
|
+
consoleMessages,
|
|
472
|
+
snapshot,
|
|
473
|
+
detailedNetworkRequest,
|
|
474
|
+
networkRequests,
|
|
475
|
+
traceInsight: this.#attachedTraceInsight,
|
|
476
|
+
traceSummary: this.#attachedTraceSummary,
|
|
477
|
+
extensions,
|
|
478
|
+
lighthouseResult: this.#attachedLighthouseResult,
|
|
479
|
+
thirdPartyDeveloperTools,
|
|
480
|
+
webmcpTools,
|
|
481
|
+
errorMessage: this.#error?.message,
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
format(toolName, context, data) {
|
|
485
|
+
const structuredContent = {};
|
|
486
|
+
const response = [];
|
|
487
|
+
if (this.#textResponseLines.length) {
|
|
488
|
+
structuredContent.message = this.#textResponseLines.join('\n');
|
|
489
|
+
response.push(...this.#textResponseLines);
|
|
490
|
+
}
|
|
491
|
+
if (this.#attachedWaitForResult) {
|
|
492
|
+
if (this.#attachedWaitForResult.navigatedToUrl) {
|
|
493
|
+
response.push(`Page navigated to ${this.#attachedWaitForResult.navigatedToUrl}.`);
|
|
494
|
+
structuredContent.navigatedToUrl =
|
|
495
|
+
this.#attachedWaitForResult.navigatedToUrl;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
const networkConditions = this.#page?.networkConditions;
|
|
499
|
+
if (networkConditions) {
|
|
500
|
+
const timeout = this.#page.pptrPage.getDefaultNavigationTimeout();
|
|
501
|
+
response.push(`Emulating network conditions: ${networkConditions}`);
|
|
502
|
+
response.push(`Default navigation timeout set to ${timeout} ms`);
|
|
503
|
+
structuredContent.networkConditions = networkConditions;
|
|
504
|
+
structuredContent.navigationTimeout = timeout;
|
|
505
|
+
}
|
|
506
|
+
const viewport = this.#page?.viewport;
|
|
507
|
+
if (viewport) {
|
|
508
|
+
response.push(`Emulating viewport: ${JSON.stringify(viewport)}`);
|
|
509
|
+
structuredContent.viewport = viewport;
|
|
510
|
+
}
|
|
511
|
+
const userAgent = this.#page?.userAgent;
|
|
512
|
+
if (userAgent) {
|
|
513
|
+
response.push(`Emulating user agent: ${userAgent}`);
|
|
514
|
+
structuredContent.userAgent = userAgent;
|
|
515
|
+
}
|
|
516
|
+
const cpuThrottlingRate = this.#page?.cpuThrottlingRate ?? 1;
|
|
517
|
+
if (cpuThrottlingRate > 1) {
|
|
518
|
+
response.push(`Emulating CPU throttling: ${cpuThrottlingRate}x slowdown`);
|
|
519
|
+
structuredContent.cpuThrottlingRate = cpuThrottlingRate;
|
|
520
|
+
}
|
|
521
|
+
const colorScheme = this.#page?.colorScheme;
|
|
522
|
+
if (colorScheme) {
|
|
523
|
+
response.push(`Emulating color scheme: ${colorScheme}`);
|
|
524
|
+
structuredContent.colorScheme = colorScheme;
|
|
525
|
+
}
|
|
526
|
+
const dialog = this.#page?.getDialog();
|
|
527
|
+
if (dialog) {
|
|
528
|
+
const defaultValueIfNeeded = dialog.type() === 'prompt'
|
|
529
|
+
? ` (default value: "${dialog.defaultValue()}")`
|
|
530
|
+
: '';
|
|
531
|
+
response.push(`# Open dialog
|
|
532
|
+
${dialog.type()}: ${dialog.message()}${defaultValueIfNeeded}.
|
|
533
|
+
Call ${handleDialog.name} to handle it before continuing.`);
|
|
534
|
+
structuredContent.dialog = {
|
|
535
|
+
type: dialog.type(),
|
|
536
|
+
message: dialog.message(),
|
|
537
|
+
defaultValue: dialog.defaultValue(),
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
if (this.#includePages) {
|
|
541
|
+
const allPages = context.getPages();
|
|
542
|
+
const { regularPages, extensionPages } = allPages.reduce((acc, page) => {
|
|
543
|
+
if (page.url().startsWith('chrome-extension://')) {
|
|
544
|
+
acc.extensionPages.push(page);
|
|
545
|
+
}
|
|
546
|
+
else {
|
|
547
|
+
acc.regularPages.push(page);
|
|
548
|
+
}
|
|
549
|
+
return acc;
|
|
550
|
+
}, { regularPages: [], extensionPages: [] });
|
|
551
|
+
if (regularPages.length) {
|
|
552
|
+
const parts = [`## Pages`];
|
|
553
|
+
const structuredPages = [];
|
|
554
|
+
for (const page of regularPages) {
|
|
555
|
+
const isolatedContextName = context.getIsolatedContextName(page);
|
|
556
|
+
const contextLabel = isolatedContextName
|
|
557
|
+
? ` isolatedContext=${isolatedContextName}`
|
|
558
|
+
: '';
|
|
559
|
+
parts.push(`${context.getPageId(page)}: ${page.url()}${context.isPageSelected(page) ? ' [selected]' : ''}${contextLabel}`);
|
|
560
|
+
structuredPages.push(createStructuredPage(page, context));
|
|
561
|
+
}
|
|
562
|
+
response.push(...parts);
|
|
563
|
+
structuredContent.pages = structuredPages;
|
|
564
|
+
}
|
|
565
|
+
if (this.#includeExtensionPages) {
|
|
566
|
+
if (extensionPages.length) {
|
|
567
|
+
response.push(`## Extension Pages`);
|
|
568
|
+
const structuredExtensionPages = [];
|
|
569
|
+
for (const page of extensionPages) {
|
|
570
|
+
const isolatedContextName = context.getIsolatedContextName(page);
|
|
571
|
+
const contextLabel = isolatedContextName
|
|
572
|
+
? ` isolatedContext=${isolatedContextName}`
|
|
573
|
+
: '';
|
|
574
|
+
response.push(`${context.getPageId(page)}: ${page.url()}${context.isPageSelected(page) ? ' [selected]' : ''}${contextLabel}`);
|
|
575
|
+
structuredExtensionPages.push(createStructuredPage(page, context));
|
|
576
|
+
}
|
|
577
|
+
structuredContent.extensionPages = structuredExtensionPages;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
if (this.#includeExtensionServiceWorkers) {
|
|
582
|
+
if (context.getExtensionServiceWorkers().length) {
|
|
583
|
+
response.push(`## Extension Service Workers`);
|
|
584
|
+
}
|
|
585
|
+
for (const extensionServiceWorker of context.getExtensionServiceWorkers()) {
|
|
586
|
+
response.push(`${extensionServiceWorker.id}: ${extensionServiceWorker.url}`);
|
|
587
|
+
}
|
|
588
|
+
structuredContent.extensionServiceWorkers = context
|
|
589
|
+
.getExtensionServiceWorkers()
|
|
590
|
+
.map(extensionServiceWorker => {
|
|
591
|
+
return {
|
|
592
|
+
id: extensionServiceWorker.id,
|
|
593
|
+
url: extensionServiceWorker.url,
|
|
594
|
+
};
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
if (this.#tabId) {
|
|
598
|
+
structuredContent.tabId = this.#tabId;
|
|
599
|
+
}
|
|
600
|
+
if (data.traceSummary) {
|
|
601
|
+
const summary = getTraceSummary(data.traceSummary);
|
|
602
|
+
response.push(summary);
|
|
603
|
+
structuredContent.traceSummary = summary;
|
|
604
|
+
structuredContent.traceInsights = [];
|
|
605
|
+
for (const insightSet of data.traceSummary.insights?.values() ?? []) {
|
|
606
|
+
for (const [insightName, model] of Object.entries(insightSet.model)) {
|
|
607
|
+
structuredContent.traceInsights.push({
|
|
608
|
+
insightName,
|
|
609
|
+
insightKey: model.insightKey,
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
if (data.traceInsight) {
|
|
615
|
+
const insightOutput = getInsightOutput(data.traceInsight.trace, data.traceInsight.insightSetId, data.traceInsight.insightName);
|
|
616
|
+
if ('error' in insightOutput) {
|
|
617
|
+
response.push(insightOutput.error);
|
|
618
|
+
}
|
|
619
|
+
else {
|
|
620
|
+
response.push(insightOutput.output);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
if (data.lighthouseResult) {
|
|
624
|
+
structuredContent.lighthouseResult = data.lighthouseResult;
|
|
625
|
+
const { summary, reports } = data.lighthouseResult;
|
|
626
|
+
response.push('## Lighthouse Audit Results');
|
|
627
|
+
response.push(`Mode: ${summary.mode}`);
|
|
628
|
+
response.push(`Device: ${summary.device}`);
|
|
629
|
+
response.push(`URL: ${summary.url}`);
|
|
630
|
+
response.push('### Category Scores');
|
|
631
|
+
for (const score of summary.scores) {
|
|
632
|
+
response.push(`- ${score.title}: ${(score.score ?? 0) * 100} (${score.id})`);
|
|
633
|
+
}
|
|
634
|
+
response.push('### Audit Summary');
|
|
635
|
+
response.push(`Passed: ${summary.audits.passed}`);
|
|
636
|
+
response.push(`Failed: ${summary.audits.failed}`);
|
|
637
|
+
response.push(`Total Timing: ${summary.timing.total}ms`);
|
|
638
|
+
response.push('### Reports');
|
|
639
|
+
for (const report of reports) {
|
|
640
|
+
response.push(`- ${report}`);
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
if (data.snapshot) {
|
|
644
|
+
if (typeof data.snapshot === 'string') {
|
|
645
|
+
response.push(`Saved snapshot to ${data.snapshot}.`);
|
|
646
|
+
structuredContent.snapshotFilePath = data.snapshot;
|
|
647
|
+
}
|
|
648
|
+
else {
|
|
649
|
+
response.push('## Latest page snapshot');
|
|
650
|
+
response.push(data.snapshot.toString());
|
|
651
|
+
structuredContent.snapshot = data.snapshot.toJSON();
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
if (this.#heapSnapshotOptions?.include) {
|
|
655
|
+
response.push('## Heap Snapshot Data');
|
|
656
|
+
const stats = this.#heapSnapshotOptions.stats;
|
|
657
|
+
const staticData = this.#heapSnapshotOptions.staticData;
|
|
658
|
+
if (stats) {
|
|
659
|
+
response.push(`Statistics: ${JSON.stringify(stats, null, 2)}`);
|
|
660
|
+
structuredContent.heapSnapshot = structuredContent.heapSnapshot || {};
|
|
661
|
+
structuredContent.heapSnapshot.stats = stats;
|
|
662
|
+
}
|
|
663
|
+
if (staticData) {
|
|
664
|
+
response.push(`Static Data: ${JSON.stringify(staticData, null, 2)}`);
|
|
665
|
+
structuredContent.heapSnapshot = structuredContent.heapSnapshot || {};
|
|
666
|
+
structuredContent.heapSnapshot.staticData = staticData;
|
|
667
|
+
}
|
|
668
|
+
const aggregates = this.#heapSnapshotOptions.aggregates;
|
|
669
|
+
if (aggregates) {
|
|
670
|
+
const sortedEntries = HeapSnapshotFormatter.sort(aggregates);
|
|
671
|
+
const paginationData = this.#dataWithPagination(sortedEntries, this.#heapSnapshotOptions.pagination);
|
|
672
|
+
structuredContent.pagination = paginationData.pagination;
|
|
673
|
+
response.push(...paginationData.info);
|
|
674
|
+
const paginatedRecord = Object.fromEntries(paginationData.items);
|
|
675
|
+
const formatter = new HeapSnapshotFormatter(paginatedRecord);
|
|
676
|
+
response.push(formatter.toString());
|
|
677
|
+
structuredContent.heapSnapshotData = formatter.toJSON();
|
|
678
|
+
}
|
|
679
|
+
const nodes = this.#heapSnapshotOptions.nodes;
|
|
680
|
+
if (nodes) {
|
|
681
|
+
const sortedItems = nodes.items
|
|
682
|
+
.filter(isNodeLike)
|
|
683
|
+
.sort((a, b) => b.retainedSize - a.retainedSize);
|
|
684
|
+
const paginationData = this.#dataWithPagination(sortedItems, this.#heapSnapshotOptions.pagination);
|
|
685
|
+
response.push(HeapSnapshotFormatter.formatNodes(paginationData.items));
|
|
686
|
+
structuredContent.pagination = paginationData.pagination;
|
|
687
|
+
response.push(...paginationData.info);
|
|
688
|
+
structuredContent.heapSnapshotNodes = paginationData.items;
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
if (data.detailedNetworkRequest) {
|
|
692
|
+
response.push(data.detailedNetworkRequest.toStringDetailed());
|
|
693
|
+
structuredContent.networkRequest =
|
|
694
|
+
data.detailedNetworkRequest.toJSONDetailed();
|
|
695
|
+
}
|
|
696
|
+
if (data.detailedConsoleMessage) {
|
|
697
|
+
response.push(data.detailedConsoleMessage.toStringDetailed());
|
|
698
|
+
structuredContent.consoleMessage =
|
|
699
|
+
data.detailedConsoleMessage.toJSONDetailed();
|
|
700
|
+
}
|
|
701
|
+
if (data.extensions) {
|
|
702
|
+
const extensionArray = Array.from(data.extensions.values());
|
|
703
|
+
structuredContent.extensions = extensionArray;
|
|
704
|
+
response.push('## Extensions');
|
|
705
|
+
if (extensionArray.length === 0) {
|
|
706
|
+
response.push('No extensions installed.');
|
|
707
|
+
}
|
|
708
|
+
else {
|
|
709
|
+
const extensionsMessage = extensionArray
|
|
710
|
+
.map(extension => {
|
|
711
|
+
return `id=${extension.id} "${extension.name}" v${extension.version} ${extension.enabled ? 'Enabled' : 'Disabled'}`;
|
|
712
|
+
})
|
|
713
|
+
.join('\n');
|
|
714
|
+
response.push(extensionsMessage);
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
if (data.thirdPartyDeveloperTools !== undefined) {
|
|
718
|
+
if (data.thirdPartyDeveloperTools) {
|
|
719
|
+
structuredContent.thirdPartyDeveloperTools =
|
|
720
|
+
data.thirdPartyDeveloperTools;
|
|
721
|
+
}
|
|
722
|
+
response.push('## Third-party developer tools');
|
|
723
|
+
if (data.thirdPartyDeveloperTools === null ||
|
|
724
|
+
!data.thirdPartyDeveloperTools?.tools) {
|
|
725
|
+
response.push('No third-party developer tools available.');
|
|
726
|
+
}
|
|
727
|
+
else {
|
|
728
|
+
const toolGroup = data.thirdPartyDeveloperTools;
|
|
729
|
+
response.push(`${toolGroup.name}: ${toolGroup.description}`);
|
|
730
|
+
response.push('Available tools:');
|
|
731
|
+
const toolDefinitionsMessage = toolGroup.tools
|
|
732
|
+
.map(tool => {
|
|
733
|
+
return `name="${tool.name}", description="${tool.description}", inputSchema=${JSON.stringify(tool.inputSchema)}`;
|
|
734
|
+
})
|
|
735
|
+
.join('\n');
|
|
736
|
+
response.push(toolDefinitionsMessage);
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
if (this.#listWebMcpTools && data.webmcpTools) {
|
|
740
|
+
structuredContent.webmcpTools = data.webmcpTools.map(({ name, description, inputSchema, annotations }) => ({
|
|
741
|
+
name,
|
|
742
|
+
description,
|
|
743
|
+
inputSchema,
|
|
744
|
+
annotations,
|
|
745
|
+
}));
|
|
746
|
+
response.push('## WebMCP tools');
|
|
747
|
+
if (data.webmcpTools.length === 0) {
|
|
748
|
+
response.push('No WebMCP tools available.');
|
|
749
|
+
}
|
|
750
|
+
else {
|
|
751
|
+
const webmcpToolsMessage = data.webmcpTools
|
|
752
|
+
.map(tool => {
|
|
753
|
+
return `name="${tool.name}", description="${tool.description}", inputSchema=${JSON.stringify(tool.inputSchema)}, annotations=${JSON.stringify(tool.annotations)}`;
|
|
754
|
+
})
|
|
755
|
+
.join('\n');
|
|
756
|
+
response.push(webmcpToolsMessage);
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
if (this.#networkRequestsOptions?.include && data.networkRequests) {
|
|
760
|
+
const requests = data.networkRequests;
|
|
761
|
+
response.push('## Network requests');
|
|
762
|
+
if (requests.length) {
|
|
763
|
+
const paginationData = this.#dataWithPagination(requests, this.#networkRequestsOptions.pagination);
|
|
764
|
+
structuredContent.pagination = paginationData.pagination;
|
|
765
|
+
response.push(...paginationData.info);
|
|
766
|
+
if (data.networkRequests) {
|
|
767
|
+
structuredContent.networkRequests = [];
|
|
768
|
+
for (const formatter of paginationData.items) {
|
|
769
|
+
response.push(formatter.toString());
|
|
770
|
+
structuredContent.networkRequests.push(formatter.toJSON());
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
else {
|
|
775
|
+
response.push('No requests found.');
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
if (this.#consoleDataOptions?.include) {
|
|
779
|
+
const messages = data.consoleMessages ?? [];
|
|
780
|
+
response.push('## Console messages');
|
|
781
|
+
if (messages.length) {
|
|
782
|
+
const grouped = ConsoleFormatter.groupConsecutive(messages);
|
|
783
|
+
const paginationData = this.#dataWithPagination(grouped, this.#consoleDataOptions.pagination);
|
|
784
|
+
structuredContent.pagination = paginationData.pagination;
|
|
785
|
+
response.push(...paginationData.info);
|
|
786
|
+
response.push(...paginationData.items.map(item => item.toString()));
|
|
787
|
+
structuredContent.consoleMessages = paginationData.items.map(item => item.toJSON());
|
|
788
|
+
}
|
|
789
|
+
else {
|
|
790
|
+
response.push('<no console messages found>');
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
if (data.errorMessage) {
|
|
794
|
+
response.push(`Error: ${data.errorMessage}`);
|
|
795
|
+
structuredContent.errorMessage = data.errorMessage;
|
|
796
|
+
}
|
|
797
|
+
const text = {
|
|
798
|
+
type: 'text',
|
|
799
|
+
text: response.join('\n'),
|
|
800
|
+
};
|
|
801
|
+
const images = this.#images.map(imageData => {
|
|
802
|
+
return {
|
|
803
|
+
type: 'image',
|
|
804
|
+
...imageData,
|
|
805
|
+
};
|
|
806
|
+
});
|
|
807
|
+
return {
|
|
808
|
+
content: [text, ...images],
|
|
809
|
+
structuredContent,
|
|
810
|
+
};
|
|
811
|
+
}
|
|
812
|
+
#dataWithPagination(data, pagination) {
|
|
813
|
+
const response = [];
|
|
814
|
+
const paginationResult = paginate(data, pagination);
|
|
815
|
+
if (paginationResult.invalidPage) {
|
|
816
|
+
response.push('Invalid page number provided. Showing first page.');
|
|
817
|
+
}
|
|
818
|
+
const { startIndex, endIndex, currentPage, totalPages } = paginationResult;
|
|
819
|
+
response.push(`Showing ${startIndex + 1}-${endIndex} of ${data.length} (Page ${currentPage + 1} of ${totalPages}).`);
|
|
820
|
+
if (pagination) {
|
|
821
|
+
if (paginationResult.hasNextPage) {
|
|
822
|
+
response.push(`Next page: ${currentPage + 1}`);
|
|
823
|
+
}
|
|
824
|
+
if (paginationResult.hasPreviousPage) {
|
|
825
|
+
response.push(`Previous page: ${currentPage - 1}`);
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
return {
|
|
829
|
+
info: response,
|
|
830
|
+
items: paginationResult.items,
|
|
831
|
+
pagination: {
|
|
832
|
+
currentPage: paginationResult.currentPage,
|
|
833
|
+
totalPages: paginationResult.totalPages,
|
|
834
|
+
hasNextPage: paginationResult.hasNextPage,
|
|
835
|
+
hasPreviousPage: paginationResult.hasPreviousPage,
|
|
836
|
+
startIndex: paginationResult.startIndex,
|
|
837
|
+
endIndex: paginationResult.endIndex,
|
|
838
|
+
invalidPage: paginationResult.invalidPage,
|
|
839
|
+
},
|
|
840
|
+
};
|
|
841
|
+
}
|
|
842
|
+
resetResponseLineForTesting() {
|
|
843
|
+
this.#textResponseLines = [];
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
function createStructuredPage(page, context) {
|
|
847
|
+
const isolatedContextName = context.getIsolatedContextName(page);
|
|
848
|
+
const entry = {
|
|
849
|
+
id: context.getPageId(page),
|
|
850
|
+
url: page.url(),
|
|
851
|
+
selected: context.isPageSelected(page),
|
|
852
|
+
};
|
|
853
|
+
if (isolatedContextName) {
|
|
854
|
+
entry.isolatedContext = isolatedContextName;
|
|
855
|
+
}
|
|
856
|
+
return entry;
|
|
857
|
+
}
|
|
858
|
+
//# sourceMappingURL=McpResponse.js.map
|