@chenpx976/chrome-devtools-mcp 0.0.0-stage → 1.13.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 +223 -2
- package/out/Default/gen/src/ArcBrowser.js +128 -0
- package/out/Default/gen/src/BrowserManager.js +562 -0
- package/out/Default/gen/src/LogpointManager.js +287 -0
- package/out/Default/gen/src/McpContext.js +1031 -0
- package/out/Default/gen/src/McpPage.js +1427 -0
- package/out/Default/gen/src/McpResponse.js +1350 -0
- package/out/Default/gen/src/McpWorker.js +66 -0
- package/out/Default/gen/src/NetworkOverrideManager.js +447 -0
- package/out/Default/gen/src/SlimMcpResponse.js +23 -0
- package/out/Default/gen/src/TextSnapshot.js +336 -0
- package/out/Default/gen/src/ToolHandler.js +531 -0
- package/out/Default/gen/src/bin/check-latest-version.js +53 -0
- package/out/Default/gen/src/bin/chrome-devtools-mcp-main.js +80 -0
- package/out/Default/gen/src/bin/chrome-devtools-mcp.js +23 -0
- package/out/Default/gen/src/bin/chrome-devtools.js +213 -0
- package/out/Default/gen/src/collectors/PageCollector.js +325 -0
- package/out/Default/gen/src/collectors/ServiceWorkerCollector.js +198 -0
- package/out/Default/gen/src/collectors/constants.js +7 -0
- package/out/Default/gen/src/config/ConfigLocator.js +70 -0
- package/out/Default/gen/src/config/ConfigParser.js +163 -0
- package/out/Default/gen/src/config/ConfigWatcher.js +94 -0
- package/out/Default/gen/src/config/ServerConfig.js +284 -0
- package/out/Default/gen/src/config/browser-options.js +135 -0
- package/out/Default/gen/src/config/category-options.js +84 -0
- package/out/Default/gen/src/config/cli-commands.js +208 -0
- package/out/Default/gen/src/config/cli-options.js +2090 -0
- package/out/Default/gen/src/config/mcp-options.js +371 -0
- package/out/Default/gen/src/config/puppeteer-options.js +69 -0
- package/out/Default/gen/src/config/tool-options.js +60 -0
- package/out/Default/gen/src/daemon/client.js +281 -0
- package/out/Default/gen/src/daemon/daemon.js +280 -0
- package/out/Default/gen/src/daemon/types.js +7 -0
- package/out/Default/gen/src/daemon/utils.js +173 -0
- package/out/Default/gen/src/devtools/DevToolsCommentBridge.js +151 -0
- package/out/Default/gen/src/devtools/DevtoolsUtils.js +413 -0
- package/out/Default/gen/src/devtools/McpHostBindingAdapter.js +164 -0
- package/out/Default/gen/src/devtools/issueDescriptions.js +42 -0
- package/out/Default/gen/src/formatters/CommentFormatter.js +73 -0
- package/out/Default/gen/src/formatters/ConsoleFormatter.js +363 -0
- package/out/Default/gen/src/formatters/CssFormatter.js +883 -0
- package/out/Default/gen/src/formatters/HeapSnapshotFormatter.js +239 -0
- package/out/Default/gen/src/formatters/IssueFormatter.js +194 -0
- package/out/Default/gen/src/formatters/LogpointFormatter.js +62 -0
- package/out/Default/gen/src/formatters/NetworkFormatter.js +295 -0
- package/out/Default/gen/src/formatters/NetworkOverridesFormatter.js +57 -0
- package/out/Default/gen/src/formatters/RemoteObjectFormatter.js +231 -0
- package/out/Default/gen/src/formatters/SnapshotFormatter.js +172 -0
- package/out/Default/gen/src/formatters/WebAuthnFormatter.js +56 -0
- package/out/Default/gen/src/formatters/constants.js +8 -0
- package/out/Default/gen/src/index.js +434 -0
- package/out/Default/gen/src/processors/ChunkedTraceParser.js +361 -0
- package/out/Default/gen/src/processors/HeapSnapshotManager.js +595 -0
- package/out/Default/gen/src/processors/PerformanceTrace.js +132 -0
- package/out/Default/gen/src/telemetry/ClearcutLogger.js +271 -0
- package/out/Default/gen/src/telemetry/WatchdogClient.js +60 -0
- package/out/Default/gen/src/telemetry/errors.js +18 -0
- package/out/Default/gen/src/telemetry/flagUtils.js +89 -0
- package/out/Default/gen/src/telemetry/metricsRegistry.js +85 -0
- package/out/Default/gen/src/telemetry/persistence.js +82 -0
- package/out/Default/gen/src/telemetry/transformation.js +229 -0
- package/out/Default/gen/src/telemetry/types.js +36 -0
- package/out/Default/gen/src/telemetry/watchdog/ClearcutSender.js +213 -0
- package/out/Default/gen/src/telemetry/watchdog/main.js +142 -0
- package/out/Default/gen/src/third_party/THIRD_PARTY_NOTICES +3774 -0
- package/out/Default/gen/src/third_party/browser.js +808 -0
- package/out/Default/gen/src/third_party/bundled-packages.json +11 -0
- package/out/Default/gen/src/third_party/cli.js +139 -0
- package/out/Default/gen/src/third_party/devtools-formatter-worker.js +125 -0
- package/out/Default/gen/src/third_party/devtools-heap-snapshot-worker.js +111 -0
- package/out/Default/gen/src/third_party/index.js +128 -0
- package/out/Default/gen/src/third_party/issue-descriptions/CoepCoopSandboxedIframeCannotNavigateToCoopPage.md +4 -0
- package/out/Default/gen/src/third_party/issue-descriptions/CoepCorpNotSameOrigin.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md +18 -0
- package/out/Default/gen/src/third_party/issue-descriptions/CoepCorpNotSameSite.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/CoepFrameResourceNeedsCoepHeader.md +10 -0
- package/out/Default/gen/src/third_party/issue-descriptions/CompatibilityModeQuirks.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/CookieAttributeValueExceedsMaxSize.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/LowTextContrast.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorRead.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorSet.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnRead.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnSet.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeRead.md +9 -0
- package/out/Default/gen/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeSet.md +9 -0
- package/out/Default/gen/src/third_party/issue-descriptions/bounceTrackingMitigations.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/clientHintMetaTagAllowListInvalidOrigin.md +4 -0
- package/out/Default/gen/src/third_party/issue-descriptions/clientHintMetaTagModifiedHTML.md +4 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistEmbeddingRequirementNotSatisfied.md +26 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistIFrameAttributeLoosensEmbeddingRequirement.md +19 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowConnectionAllowlistFrom.md +21 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowlistItemType.md +12 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistInvalidHeader.md +12 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistInvalidUrlPattern.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistItemNotInnerList.md +12 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistMoreThanOneList.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistReportingEndpointNotToken.md +10 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieCrossSiteRedirectDowngrade.md +12 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieExcludeDomainNonAscii.md +11 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieExcludePortMismatch.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieExcludeSchemeMismatch.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutRead.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutSet.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnDomainNonAscii.md +11 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnMetadataGrantRead.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnMetadataGrantReadOptOut.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnMetadataGrantSet.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnMetadataGrantSetOptOut.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutRead.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutSet.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsAllowCredentialsRequired.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsDisabledScheme.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsDisallowedByMode.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsHeaderDisallowedByPreflightResponse.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsInvalidHeaderValues.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsLocalNetworkAccessPermissionDenied.md +19 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsMethodDisallowedByPreflightResponse.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsNoCorsRedirectModeNotFollow.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsOriginMismatch.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsPreflightResponseInvalid.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsRedirectContainsCredentials.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsWildcardOriginNotAllowed.md +9 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cspEvalViolation.md +9 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cspInlineViolation.md +10 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cspTrustedTypesPolicyViolation.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cspTrustedTypesSinkViolation.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cspURLViolation.md +10 -0
- package/out/Default/gen/src/third_party/issue-descriptions/deprecation.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestAccountsEmptyList.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestAccountsHttpNotFound.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidContentType.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestAccountsNoResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestDnsFetchFailed.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestDnsInvalidRecord.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownHttpNotFound.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidContentType.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownNoResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestInvalidEmail.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestJwksHttpNotFound.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestJwksInvalidResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestKeyBindingSigningFailed.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestRpOriginIsOpaque.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenHttpNotFound.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidContentType.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidSdJwt.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenMalformedSdJwt.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenNoResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidAudience.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidIssuedAt.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidNonce.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidSdHash.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidTyp.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingAud.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingCnf.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingIat.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingNonce.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingSdHash.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbSignatureFailed.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmail.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmailVerified.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidHolderKey.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuedAt.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuer.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtJwksMissingKeys.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingCnf.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingEmail.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIat.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIss.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtSignatureFailed.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtUnsupportedHeaderAlg.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestUserLoggedOut.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownAccountsEndpointCrossOrigin.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownHttpNotFound.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidContentType.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownIssuanceEndpointCrossOrigin.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownListEmpty.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingAccountsEndpoint.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingIssuanceEndpoint.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownNoResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownUnsupportedSigningAlgorithm.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestAccountsBlockedByConnectionAllowlist.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestAccountsHttpNotFound.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestAccountsInvalidResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestAccountsNoResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestApprovalDeclined.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestCanceled.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestConfigBlockedByConnectionAllowlist.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestErrorFetchingSignin.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestErrorIdToken.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestIdTokenBlockedByConnectionAllowlist.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestIdTokenHttpNotFound.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidRequest.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestIdTokenNoResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestInvalidSigninResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestManifestHttpNotFound.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestManifestInvalidResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestManifestNoResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestTooManyRequests.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestWellKnownBlockedByConnectionAllowlist.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidAccountsResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidConfigOrWellKnown.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoAccountSharingPermission.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoApiPermission.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoReturningUserFromFetchedAccounts.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotIframe.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotPotentiallyTrustworthy.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSameOrigin.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSignedInWithIdp.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/fetchingPartitionedBlobURL.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericBackUINavigationWouldSkipAd.md +4 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormAriaLabelledByToNonExistingIdError.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormAutocompleteAttributeEmptyError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormDuplicateIdForInputError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormEmptyIdAndNameAttributesForInputError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormInputAssignedAutocompleteValueToIdOrNameAttributeError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormInputHasWrongButWellIntendedAutocompleteValueError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormInputWithNoLabelError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormLabelForMatchesNonExistingIdError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormLabelForNameError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormLabelHasNeitherForNorNestedInputError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormModelContextMissingToolDescription.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormModelContextMissingToolName.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormModelContextParameterMissingName.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormModelContextParameterMissingTitleAndDescription.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormModelContextRequiredParameterMissingName.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericGeolocationPromptWithoutUserGesture.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericNavigationEntryMarkedSkippable.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericResponseWasBlockedByORB.md +4 -0
- package/out/Default/gen/src/third_party/issue-descriptions/heavyAd.md +10 -0
- package/out/Default/gen/src/third_party/issue-descriptions/lazyLoadImageZeroSize.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/mixedContent.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/navigatingPartitionedBlobURL.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementActivationDisabled.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluder.md +9 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluderParent.md +9 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementCspFrameAncestorsMissing.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementFencedFrameDisallowed.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementFontSizeTooLarge.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementFontSizeTooSmall.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementGeolocationDeprecated.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementInsetBoxShadowUnsupported.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementInvalidDisplayStyle.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementInvalidSizeValue.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementInvalidType.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementInvalidTypeActivation.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementLowContrast.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementNonOpaqueColor.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementPaddingBottomUnsupported.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementPaddingRightUnsupported.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementPermissionsPolicyBlocked.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementRegistrationFailed.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementRequestInProgress.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementSecurityChecksFailed.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementTypeNotSupported.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementUntrustedEvent.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/placeholderDescriptionForInvisibleIssues.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/propertyRuleInvalidNameIssue.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/propertyRuleIssue.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedOptGroupChild.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedSelectChild.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentAttributesSelectDescendant.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentLegendChild.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentOptionChild.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/selectElementAccessibilityNonPhrasingContentOptionChild.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/selectivePermissionsIntervention.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedArrayBuffer.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryUseErrorCrossOriginNoCorsRequest.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryUseErrorDictionaryLoadFailure.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryUseErrorMatchingDictionaryNotUsed.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryUseErrorUnexpectedContentDictionaryHeader.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorCossOriginNoCorsRequest.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorDisallowedBySettings.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorExpiredResponse.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorFeatureDisabled.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInsufficientResources.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidMatchField.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidStructuredHeader.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidTTLField.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNavigationRequest.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNoMatchField.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonIntegerTTLField.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonListMatchDestField.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonSecureContext.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringIdField.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringInMatchDestList.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringMatchField.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonTokenTypeField.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorRequestAborted.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorShuttingDown.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorTooLongIdField.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorUnsupportedType.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriInvalidSignatureHeader.md +14 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriInvalidSignatureInputHeader.md +15 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriMissingSignatureHeader.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriMissingSignatureInputHeader.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureHeaderValueIsIncorrectLength.md +11 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureHeaderValueIsNotByteSequence.md +14 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureHeaderValueIsParameterized.md +15 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentName.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentType.md +13 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidDerivedComponentParameter.md +4 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidHeaderComponentParameter.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidParameter.md +11 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderKeyIdLength.md +12 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingLabel.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingRequiredParameters.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderValueMissingComponents.md +11 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderValueNotInnerList.md +11 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriValidationFailedIntegrityMismatch.md +12 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriValidationFailedInvalidLength.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriValidationFailedSignatureExpired.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriValidationFailedSignatureMismatch.md +11 -0
- package/out/Default/gen/src/third_party/issue-descriptions/stylesheetLateImport.md +4 -0
- package/out/Default/gen/src/third_party/issue-descriptions/stylesheetRequestFailed.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/summaryElementAccessibilityInteractiveContentSummaryDescendant.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestLength.md +12 -0
- package/out/Default/gen/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestType.md +17 -0
- package/out/Default/gen/src/third_party/issue-descriptions/unencodedDigestMalformedDictionary.md +14 -0
- package/out/Default/gen/src/third_party/issue-descriptions/unencodedDigestUnknownAlgorithm.md +15 -0
- package/out/Default/gen/src/third_party/issue-descriptions/webInstallManifestMissingId.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/webInstallManifestMissingNameOrShortName.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/webInstallManifestParsingOrNetworkError.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/webInstallNoManifest.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/webInstallStartUrlInvalid.md +3 -0
- package/out/Default/gen/src/third_party/lighthouse-devtools-mcp-bundle.js +60395 -0
- package/out/Default/gen/src/tools/ToolDefinition.js +180 -0
- package/out/Default/gen/src/tools/categories.js +37 -0
- package/out/Default/gen/src/tools/comments.js +230 -0
- package/out/Default/gen/src/tools/console.js +122 -0
- package/out/Default/gen/src/tools/css.js +54 -0
- package/out/Default/gen/src/tools/emulation.js +98 -0
- package/out/Default/gen/src/tools/extensions.js +108 -0
- package/out/Default/gen/src/tools/input.js +658 -0
- package/out/Default/gen/src/tools/lighthouse.js +279 -0
- package/out/Default/gen/src/tools/logpoints.js +51 -0
- package/out/Default/gen/src/tools/memory.js +531 -0
- package/out/Default/gen/src/tools/network.js +325 -0
- package/out/Default/gen/src/tools/pages.js +420 -0
- package/out/Default/gen/src/tools/performance.js +258 -0
- package/out/Default/gen/src/tools/pwa.js +152 -0
- package/out/Default/gen/src/tools/screencast.js +160 -0
- package/out/Default/gen/src/tools/screenshot.js +315 -0
- package/out/Default/gen/src/tools/script.js +319 -0
- package/out/Default/gen/src/tools/slim/tools.js +110 -0
- package/out/Default/gen/src/tools/snapshot.js +88 -0
- package/out/Default/gen/src/tools/thirdPartyDeveloper.js +73 -0
- package/out/Default/gen/src/tools/toolNames.js +10 -0
- package/out/Default/gen/src/tools/tools.js +72 -0
- package/out/Default/gen/src/tools/webauthn.js +51 -0
- package/out/Default/gen/src/tools/webmcp.js +55 -0
- package/out/Default/gen/src/types.js +21 -0
- package/out/Default/gen/src/utils/TaskRunner.js +151 -0
- package/out/Default/gen/src/utils/WaitForHelper.js +343 -0
- package/out/Default/gen/src/utils/bytes.js +95 -0
- package/out/Default/gen/src/utils/check-for-updates.js +81 -0
- package/out/Default/gen/src/utils/disclaimers.js +27 -0
- package/out/Default/gen/src/utils/errorHandling.js +23 -0
- package/out/Default/gen/src/utils/files.js +81 -0
- package/out/Default/gen/src/utils/id.js +16 -0
- package/out/Default/gen/src/utils/keyboard.js +307 -0
- package/out/Default/gen/src/utils/logger.js +145 -0
- package/out/Default/gen/src/utils/logpoint.js +44 -0
- package/out/Default/gen/src/utils/network.js +81 -0
- package/out/Default/gen/src/utils/pagination.js +50 -0
- package/out/Default/gen/src/utils/polyfill.js +11 -0
- package/out/Default/gen/src/utils/raceWithSignal.js +26 -0
- package/out/Default/gen/src/utils/resourceType.js +27 -0
- package/out/Default/gen/src/utils/text.js +43 -0
- package/out/Default/gen/src/utils/timeout.js +14 -0
- package/out/Default/gen/src/utils/url.js +311 -0
- package/out/Default/gen/src/version.js +11 -0
- package/package.json +125 -4
- package/skills/a11y-debugging/SKILL.md +86 -0
- package/skills/a11y-debugging/references/a11y-snippets.md +92 -0
- package/skills/arc-compatibility/SKILL.md +168 -0
- package/skills/arc-compatibility/SOURCES.md +216 -0
- package/skills/arc-compatibility/references/compatibility.md +113 -0
- package/skills/arc-compatibility/references/output-contract.md +62 -0
- package/skills/arc-compatibility/references/workflows.md +105 -0
- package/skills/chrome-devtools/SKILL.md +80 -0
- package/skills/chrome-devtools-cli/SKILL.md +208 -0
- package/skills/chrome-devtools-cli/references/installation.md +24 -0
- package/skills/cookie-debugging/SKILL.md +152 -0
- package/skills/debug-optimize-lcp/SKILL.md +121 -0
- package/skills/debug-optimize-lcp/references/elements-and-size.md +27 -0
- package/skills/debug-optimize-lcp/references/lcp-breakdown.md +23 -0
- package/skills/debug-optimize-lcp/references/lcp-snippets.md +79 -0
- package/skills/debug-optimize-lcp/references/optimization-strategies.md +38 -0
- package/skills/inspect-in-devtools/SKILL.md +82 -0
- package/skills/memory-leak-debugging/SKILL.md +58 -0
- package/skills/memory-leak-debugging/references/common-leaks.md +33 -0
- package/skills/troubleshooting/SKILL.md +107 -0
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
7
|
+
if (value !== null && value !== void 0) {
|
|
8
|
+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
9
|
+
var dispose, inner;
|
|
10
|
+
if (async) {
|
|
11
|
+
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
12
|
+
dispose = value[Symbol.asyncDispose];
|
|
13
|
+
}
|
|
14
|
+
if (dispose === void 0) {
|
|
15
|
+
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
16
|
+
dispose = value[Symbol.dispose];
|
|
17
|
+
if (async) inner = dispose;
|
|
18
|
+
}
|
|
19
|
+
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
20
|
+
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
21
|
+
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
22
|
+
}
|
|
23
|
+
else if (async) {
|
|
24
|
+
env.stack.push({ async: true });
|
|
25
|
+
}
|
|
26
|
+
return value;
|
|
27
|
+
};
|
|
28
|
+
var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
|
|
29
|
+
return function (env) {
|
|
30
|
+
function fail(e) {
|
|
31
|
+
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
32
|
+
env.hasError = true;
|
|
33
|
+
}
|
|
34
|
+
var r, s = 0;
|
|
35
|
+
function next() {
|
|
36
|
+
while (r = env.stack.pop()) {
|
|
37
|
+
try {
|
|
38
|
+
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
39
|
+
if (r.dispose) {
|
|
40
|
+
var result = r.dispose.call(r.value);
|
|
41
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
42
|
+
}
|
|
43
|
+
else s |= 1;
|
|
44
|
+
}
|
|
45
|
+
catch (e) {
|
|
46
|
+
fail(e);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
50
|
+
if (env.hasError) throw env.error;
|
|
51
|
+
}
|
|
52
|
+
return next();
|
|
53
|
+
};
|
|
54
|
+
})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
55
|
+
var e = new Error(message);
|
|
56
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
57
|
+
});
|
|
58
|
+
import { pathToFileURL } from 'node:url';
|
|
59
|
+
import { zod } from '../third_party/index.js';
|
|
60
|
+
import { ToolCategory } from './categories.js';
|
|
61
|
+
import { defineTool, pageIdSchema, } from './ToolDefinition.js';
|
|
62
|
+
export const evaluateScript = defineTool((cliArgs) => {
|
|
63
|
+
return {
|
|
64
|
+
name: 'evaluate_script',
|
|
65
|
+
description: `Evaluate JavaScript inside the target page${cliArgs.categoryExtensions ? ' or service worker' : ''}. The source can be provided inline or loaded from a local file. Returns the response as JSON, so returned values have to be JSON-serializable.`,
|
|
66
|
+
annotations: {
|
|
67
|
+
category: ToolCategory.DEBUGGING,
|
|
68
|
+
readOnlyHint: false,
|
|
69
|
+
conditions: ['javascriptEvaluation'],
|
|
70
|
+
},
|
|
71
|
+
schema: {
|
|
72
|
+
...(cliArgs.pageIdRouting
|
|
73
|
+
? cliArgs.categoryExtensions
|
|
74
|
+
? {
|
|
75
|
+
pageId: zod
|
|
76
|
+
.number()
|
|
77
|
+
.optional()
|
|
78
|
+
.describe('Targets a specific page by ID. Required when not evaluating in a service worker.'),
|
|
79
|
+
}
|
|
80
|
+
: pageIdSchema
|
|
81
|
+
: {}),
|
|
82
|
+
function: zod
|
|
83
|
+
.string()
|
|
84
|
+
.optional()
|
|
85
|
+
.describe(`JavaScript source to execute in the target page. Provide either this or sourcePath, but not both. The source is interpreted according to format.
|
|
86
|
+
Example without arguments: \`() => document.title\` or \`async () => await fetch("example.com")\`.
|
|
87
|
+
Example with arguments: \`(el) => el.innerText\`
|
|
88
|
+
`),
|
|
89
|
+
sourcePath: zod
|
|
90
|
+
.string()
|
|
91
|
+
.optional()
|
|
92
|
+
.describe("The absolute or relative path to a JavaScript file on the MCP server's local filesystem. Provide either this or function, but not both."),
|
|
93
|
+
format: zod
|
|
94
|
+
.enum(['function', 'script'])
|
|
95
|
+
.optional()
|
|
96
|
+
.describe('How to interpret the source. "function" treats it as a function declaration and supports args. "script" evaluates it as classic JavaScript and does not support args. Defaults to "function". ECMAScript modules are not supported.'),
|
|
97
|
+
args: zod
|
|
98
|
+
.array(zod
|
|
99
|
+
.string()
|
|
100
|
+
.describe('The uid of an element on the page from the page content snapshot'))
|
|
101
|
+
.optional()
|
|
102
|
+
.describe(`An optional list of arguments (element uids from the page content snapshot) to pass to the function.`),
|
|
103
|
+
filePath: zod
|
|
104
|
+
.string()
|
|
105
|
+
.optional()
|
|
106
|
+
.describe('The absolute or relative path to a file to save the script output to. If omitted, the output is returned inline.'),
|
|
107
|
+
dialogAction: zod
|
|
108
|
+
.string()
|
|
109
|
+
.optional()
|
|
110
|
+
.describe('Handle dialogs while execution. "accept", "dismiss", or string for response of window.prompt. Defaults to accept.'),
|
|
111
|
+
waitForStableDom: zod
|
|
112
|
+
.boolean()
|
|
113
|
+
.optional()
|
|
114
|
+
.describe('Whether to wait for the DOM to settle. Pass false if the script only reads data. Defaults to true.'),
|
|
115
|
+
...(cliArgs.categoryExtensions
|
|
116
|
+
? {
|
|
117
|
+
serviceWorkerId: zod
|
|
118
|
+
.string()
|
|
119
|
+
.optional()
|
|
120
|
+
.describe(`The optional service worker id to evaluate the script in. If provided, 'pageId' should be omitted. Note: 'args' (element UIDs) cannot be used when evaluating in a service worker.`),
|
|
121
|
+
}
|
|
122
|
+
: {}),
|
|
123
|
+
},
|
|
124
|
+
blockedByDialog: false,
|
|
125
|
+
concurrency: 'exclusive',
|
|
126
|
+
verifyFilesSchema: {
|
|
127
|
+
filePath: true,
|
|
128
|
+
// sourcePath may be an http(s): URL the server fetches, so allow URLs
|
|
129
|
+
// through; a file: path or plain path is still validated.
|
|
130
|
+
sourcePath: { local: true, remote: true, allowUrl: true },
|
|
131
|
+
},
|
|
132
|
+
handler: async (request, response, context) => {
|
|
133
|
+
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
134
|
+
try {
|
|
135
|
+
const { serviceWorkerId, args: uidArgs, function: fnString, sourcePath, format = 'function', pageId, dialogAction, filePath, waitForStableDom, } = request.params;
|
|
136
|
+
const source = await resolveScriptSource(fnString, sourcePath, context);
|
|
137
|
+
if (format === 'script' && uidArgs && uidArgs.length > 0) {
|
|
138
|
+
throw new Error('args cannot be used when format is "script".');
|
|
139
|
+
}
|
|
140
|
+
if (cliArgs.categoryExtensions && serviceWorkerId) {
|
|
141
|
+
if (uidArgs && uidArgs.length > 0) {
|
|
142
|
+
throw new Error('args (element uids) cannot be used when evaluating in a service worker.');
|
|
143
|
+
}
|
|
144
|
+
if (pageId) {
|
|
145
|
+
throw new Error('specify either a pageId or a serviceWorkerId.');
|
|
146
|
+
}
|
|
147
|
+
const worker = await getWebWorker(context, serviceWorkerId);
|
|
148
|
+
const result = await context
|
|
149
|
+
.getSelectedMcpPage()
|
|
150
|
+
.waitForEventsAfterAction(async () => {
|
|
151
|
+
await performEvaluation(worker, source, format, [], response, {
|
|
152
|
+
filePath,
|
|
153
|
+
context,
|
|
154
|
+
});
|
|
155
|
+
},
|
|
156
|
+
// Service workers cannot interact with the DOM, so never wait for it.
|
|
157
|
+
{ handleDialog: dialogAction ?? 'accept', waitForStableDom: false });
|
|
158
|
+
if (result.dialogHandled) {
|
|
159
|
+
context.getSelectedMcpPage().clearDialog();
|
|
160
|
+
}
|
|
161
|
+
response.attachWaitForResult(result);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
if (cliArgs.categoryExtensions && cliArgs.pageIdRouting && !pageId) {
|
|
165
|
+
throw new Error('specify either a pageId or a serviceWorkerId.');
|
|
166
|
+
}
|
|
167
|
+
const mcpPage = cliArgs.pageIdRouting && request.params.pageId
|
|
168
|
+
? context.getPageById(request.params.pageId)
|
|
169
|
+
: context.getSelectedMcpPage();
|
|
170
|
+
await mcpPage.init({ emulateFocus: true });
|
|
171
|
+
// evaluate_script is not page-scoped, so ToolHandler does not run the
|
|
172
|
+
// blockedByDialog check for it. Without this, an evaluation started
|
|
173
|
+
// while a dialog is open waits until the protocol timeout.
|
|
174
|
+
// TODO: include the "# Open dialog ... Call handle_dialog" hint once
|
|
175
|
+
// Response can attach the page for non-page-scoped tools.
|
|
176
|
+
mcpPage.throwIfDialogOpen();
|
|
177
|
+
const page = mcpPage.pptrPage;
|
|
178
|
+
const args = [];
|
|
179
|
+
const stack = __addDisposableResource(env_1, new DisposableStack(), false);
|
|
180
|
+
const frames = new Set();
|
|
181
|
+
for (const uid of uidArgs ?? []) {
|
|
182
|
+
const handle = await mcpPage.getElementByUid(uid);
|
|
183
|
+
frames.add(handle.frame);
|
|
184
|
+
stack.use(handle);
|
|
185
|
+
args.push(handle);
|
|
186
|
+
}
|
|
187
|
+
const evaluatable = await getPageOrFrame(page, frames);
|
|
188
|
+
// ToolHandler hands over the page of page-scoped tools only.
|
|
189
|
+
response.includeConsoleErrorsFrom(mcpPage);
|
|
190
|
+
const result = await mcpPage.waitForEventsAfterAction(async () => {
|
|
191
|
+
await performEvaluation(evaluatable, source, format, args, response, {
|
|
192
|
+
filePath,
|
|
193
|
+
context,
|
|
194
|
+
});
|
|
195
|
+
}, { handleDialog: dialogAction ?? 'accept', waitForStableDom });
|
|
196
|
+
response.attachWaitForResult(result);
|
|
197
|
+
}
|
|
198
|
+
catch (e_1) {
|
|
199
|
+
env_1.error = e_1;
|
|
200
|
+
env_1.hasError = true;
|
|
201
|
+
}
|
|
202
|
+
finally {
|
|
203
|
+
__disposeResources(env_1);
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
});
|
|
208
|
+
const resolveScriptSource = async (inlineSource, sourcePath, context) => {
|
|
209
|
+
if (inlineSource !== undefined) {
|
|
210
|
+
if (sourcePath !== undefined) {
|
|
211
|
+
throw new Error('Specify exactly one of function or sourcePath.');
|
|
212
|
+
}
|
|
213
|
+
return inlineSource;
|
|
214
|
+
}
|
|
215
|
+
if (sourcePath === undefined) {
|
|
216
|
+
throw new Error('Specify exactly one of function or sourcePath.');
|
|
217
|
+
}
|
|
218
|
+
const resourceUrl = sourcePath.startsWith('file:')
|
|
219
|
+
? sourcePath
|
|
220
|
+
: pathToFileURL(sourcePath).href;
|
|
221
|
+
try {
|
|
222
|
+
return await context.loadResource(resourceUrl);
|
|
223
|
+
}
|
|
224
|
+
catch (error) {
|
|
225
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
226
|
+
throw new Error(`Unable to read script source from ${sourcePath}: ${errorMessage}`, { cause: error });
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
const performEvaluation = async (evaluatable, source, format, args, response, options) => {
|
|
230
|
+
let result;
|
|
231
|
+
if (format === 'function') {
|
|
232
|
+
const env_2 = { stack: [], error: void 0, hasError: false };
|
|
233
|
+
try {
|
|
234
|
+
const functionSource = source.trimEnd().replace(/;$/, '');
|
|
235
|
+
const fn = __addDisposableResource(env_2, await evaluatable.evaluateHandle(`(\n${functionSource}\n)`), false);
|
|
236
|
+
// Normalize non-Error values inside the page callback (serialized by Puppeteer) so CDP preserves the message.
|
|
237
|
+
result = await evaluatable.evaluate(async (fn, ...args) => {
|
|
238
|
+
try {
|
|
239
|
+
return JSON.stringify(await fn(...args));
|
|
240
|
+
}
|
|
241
|
+
catch (err) {
|
|
242
|
+
if (err instanceof Error ||
|
|
243
|
+
(typeof err === 'object' &&
|
|
244
|
+
err !== null &&
|
|
245
|
+
'message' in err &&
|
|
246
|
+
typeof err.message === 'string')) {
|
|
247
|
+
throw err;
|
|
248
|
+
}
|
|
249
|
+
let message;
|
|
250
|
+
try {
|
|
251
|
+
message =
|
|
252
|
+
typeof err === 'object' && err !== null
|
|
253
|
+
? JSON.stringify(err)
|
|
254
|
+
: String(err);
|
|
255
|
+
}
|
|
256
|
+
catch {
|
|
257
|
+
message = String(err);
|
|
258
|
+
}
|
|
259
|
+
throw new Error(message);
|
|
260
|
+
}
|
|
261
|
+
}, fn, ...args);
|
|
262
|
+
}
|
|
263
|
+
catch (e_2) {
|
|
264
|
+
env_2.error = e_2;
|
|
265
|
+
env_2.hasError = true;
|
|
266
|
+
}
|
|
267
|
+
finally {
|
|
268
|
+
__disposeResources(env_2);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
const env_3 = { stack: [], error: void 0, hasError: false };
|
|
273
|
+
try {
|
|
274
|
+
const value = __addDisposableResource(env_3, await evaluatable.evaluateHandle(source), false);
|
|
275
|
+
result = await evaluatable.evaluate(value => JSON.stringify(value), value);
|
|
276
|
+
}
|
|
277
|
+
catch (e_3) {
|
|
278
|
+
env_3.error = e_3;
|
|
279
|
+
env_3.hasError = true;
|
|
280
|
+
}
|
|
281
|
+
finally {
|
|
282
|
+
__disposeResources(env_3);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
if (options.filePath) {
|
|
286
|
+
const data = new TextEncoder().encode(result ?? 'undefined');
|
|
287
|
+
const { filename } = await options.context.saveFile(data, options.filePath, '.json');
|
|
288
|
+
response.appendResponseLine(`Script ran on page. Output saved to ${filename}.`);
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
response.appendResponseLine('Script ran on page and returned:');
|
|
292
|
+
response.appendResponseLine('```json');
|
|
293
|
+
response.appendResponseLine(`${result}`);
|
|
294
|
+
response.appendResponseLine('```');
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
const getPageOrFrame = async (page, frames) => {
|
|
298
|
+
let pageOrFrame;
|
|
299
|
+
// We can't evaluate the element handle across frames
|
|
300
|
+
if (frames.size > 1) {
|
|
301
|
+
throw new Error("Elements from different frames can't be evaluated together.");
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
pageOrFrame = [...frames.values()][0] ?? page;
|
|
305
|
+
}
|
|
306
|
+
return pageOrFrame;
|
|
307
|
+
};
|
|
308
|
+
const getWebWorker = async (context, serviceWorkerId) => {
|
|
309
|
+
const serviceWorker = context.getWorkerById(serviceWorkerId);
|
|
310
|
+
if (!serviceWorker || serviceWorker.type !== 'service_worker') {
|
|
311
|
+
throw new Error('Service worker not found.');
|
|
312
|
+
}
|
|
313
|
+
const worker = await serviceWorker.worker();
|
|
314
|
+
if (!worker) {
|
|
315
|
+
throw new Error('Service worker target not found.');
|
|
316
|
+
}
|
|
317
|
+
return worker;
|
|
318
|
+
};
|
|
319
|
+
//# sourceMappingURL=script.js.map
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { zod } from '../../third_party/index.js';
|
|
7
|
+
import { ToolCategory } from '../categories.js';
|
|
8
|
+
import { definePageTool } from '../ToolDefinition.js';
|
|
9
|
+
import { validateUrl } from '../../utils/url.js';
|
|
10
|
+
export const screenshot = definePageTool(() => ({
|
|
11
|
+
name: 'screenshot',
|
|
12
|
+
description: `Takes a png screenshot`,
|
|
13
|
+
annotations: {
|
|
14
|
+
category: ToolCategory.DEBUGGING,
|
|
15
|
+
// Not read-only due to filePath param.
|
|
16
|
+
readOnlyHint: false,
|
|
17
|
+
conditions: ['slim'],
|
|
18
|
+
},
|
|
19
|
+
schema: {
|
|
20
|
+
filePath: zod
|
|
21
|
+
.string()
|
|
22
|
+
.optional()
|
|
23
|
+
.describe('The absolute path, or a path relative to the current working directory, to save the screenshot to instead of attaching it to the response.'),
|
|
24
|
+
},
|
|
25
|
+
blockedByDialog: true,
|
|
26
|
+
concurrency: 'page',
|
|
27
|
+
verifyFilesSchema: {
|
|
28
|
+
filePath: true,
|
|
29
|
+
},
|
|
30
|
+
handler: async (request, response, context) => {
|
|
31
|
+
const page = request.page;
|
|
32
|
+
const screenshot = await page.pptrPage.screenshot({
|
|
33
|
+
type: 'png',
|
|
34
|
+
optimizeForSpeed: true,
|
|
35
|
+
});
|
|
36
|
+
if (request.params.filePath) {
|
|
37
|
+
const result = await context.saveFile(screenshot, request.params.filePath, '.png');
|
|
38
|
+
response.appendResponseLine(result.filename);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
const { filepath } = await context.saveTemporaryFile(screenshot, `screenshot.png`);
|
|
42
|
+
response.appendResponseLine(filepath);
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
}));
|
|
46
|
+
export const navigate = definePageTool((args) => {
|
|
47
|
+
return {
|
|
48
|
+
name: 'navigate',
|
|
49
|
+
description: `Loads a URL`,
|
|
50
|
+
annotations: {
|
|
51
|
+
category: ToolCategory.NAVIGATION,
|
|
52
|
+
readOnlyHint: false,
|
|
53
|
+
conditions: ['slim'],
|
|
54
|
+
},
|
|
55
|
+
schema: {
|
|
56
|
+
url: zod.string().describe('URL to navigate to'),
|
|
57
|
+
},
|
|
58
|
+
blockedByDialog: false,
|
|
59
|
+
concurrency: 'page',
|
|
60
|
+
verifyFilesSchema: {},
|
|
61
|
+
handler: async (request, response) => {
|
|
62
|
+
validateUrl(request.params.url, {
|
|
63
|
+
javascriptEvaluation: args?.javascriptEvaluation,
|
|
64
|
+
categoryExtensions: args?.categoryExtensions,
|
|
65
|
+
fileNavigations: args?.fileNavigations,
|
|
66
|
+
});
|
|
67
|
+
const page = request.page;
|
|
68
|
+
const options = {
|
|
69
|
+
timeout: 30_000,
|
|
70
|
+
};
|
|
71
|
+
const dialogHandler = (dialog) => {
|
|
72
|
+
if (dialog.type() === 'beforeunload') {
|
|
73
|
+
response.appendResponseLine(`Accepted a beforeunload dialog.`);
|
|
74
|
+
void dialog.accept();
|
|
75
|
+
// We are not going to report the dialog like regular dialogs.
|
|
76
|
+
page.clearDialog();
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
page.pptrPage.on('dialog', dialogHandler);
|
|
80
|
+
try {
|
|
81
|
+
await page.pptrPage.goto(request.params.url, options);
|
|
82
|
+
response.appendResponseLine(`Navigated to ${page.pptrPage.url()}.`);
|
|
83
|
+
}
|
|
84
|
+
finally {
|
|
85
|
+
page.pptrPage.off('dialog', dialogHandler);
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
});
|
|
90
|
+
export const evaluate = definePageTool(() => ({
|
|
91
|
+
name: 'evaluate',
|
|
92
|
+
description: `Evaluates a JavaScript script`,
|
|
93
|
+
annotations: {
|
|
94
|
+
category: ToolCategory.DEBUGGING,
|
|
95
|
+
readOnlyHint: false,
|
|
96
|
+
conditions: ['slim', 'javascriptEvaluation'],
|
|
97
|
+
},
|
|
98
|
+
schema: {
|
|
99
|
+
script: zod.string().describe(`JS script to run on the page`),
|
|
100
|
+
},
|
|
101
|
+
blockedByDialog: true,
|
|
102
|
+
concurrency: 'page',
|
|
103
|
+
verifyFilesSchema: {},
|
|
104
|
+
handler: async (request, response) => {
|
|
105
|
+
const page = request.page;
|
|
106
|
+
const result = await page.pptrPage.evaluate(request.params.script);
|
|
107
|
+
response.appendResponseLine(JSON.stringify(result));
|
|
108
|
+
},
|
|
109
|
+
}));
|
|
110
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { loadBrowser, zod } from '../third_party/index.js';
|
|
7
|
+
import { ToolCategory } from './categories.js';
|
|
8
|
+
import { definePageTool, timeoutSchema, } from './ToolDefinition.js';
|
|
9
|
+
export const takeSnapshot = definePageTool(() => ({
|
|
10
|
+
name: 'take_snapshot',
|
|
11
|
+
description: `Take a text snapshot of the target page based on the a11y tree. The snapshot lists page elements along with a unique
|
|
12
|
+
identifier (uid). Always use the latest snapshot. Prefer taking a snapshot over taking a screenshot. The snapshot indicates the element selected
|
|
13
|
+
in the DevTools Elements panel (if any).`,
|
|
14
|
+
annotations: {
|
|
15
|
+
category: ToolCategory.DEBUGGING,
|
|
16
|
+
// Not read-only due to filePath param.
|
|
17
|
+
readOnlyHint: false,
|
|
18
|
+
},
|
|
19
|
+
schema: {
|
|
20
|
+
verbose: zod
|
|
21
|
+
.boolean()
|
|
22
|
+
.optional()
|
|
23
|
+
.describe('Whether to include all possible information available in the full a11y tree. Default is false.'),
|
|
24
|
+
filePath: zod
|
|
25
|
+
.string()
|
|
26
|
+
.optional()
|
|
27
|
+
.describe('The absolute path, or a path relative to the current working directory, to save the snapshot to instead of attaching it to the response.'),
|
|
28
|
+
},
|
|
29
|
+
blockedByDialog: true,
|
|
30
|
+
concurrency: 'page',
|
|
31
|
+
verifyFilesSchema: {
|
|
32
|
+
filePath: true,
|
|
33
|
+
},
|
|
34
|
+
handler: async (request, response) => {
|
|
35
|
+
response.includeSnapshot({
|
|
36
|
+
verbose: request.params.verbose ?? false,
|
|
37
|
+
filePath: request.params.filePath,
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
}));
|
|
41
|
+
export const waitFor = definePageTool(() => ({
|
|
42
|
+
name: 'wait_for',
|
|
43
|
+
description: `Wait for the specified text to appear on the selected page. By default, hidden text is also matched. Set visible to true to wait until the matched text is visible.`,
|
|
44
|
+
annotations: {
|
|
45
|
+
category: ToolCategory.NAVIGATION,
|
|
46
|
+
readOnlyHint: true,
|
|
47
|
+
},
|
|
48
|
+
schema: {
|
|
49
|
+
text: zod
|
|
50
|
+
.array(zod.string())
|
|
51
|
+
.min(1)
|
|
52
|
+
.describe('Non-empty list of texts. Resolves when any value matches an ' +
|
|
53
|
+
'accessible name exactly or is a substring of DOM text. Matching ' +
|
|
54
|
+
'is case-sensitive. DOM text preserves spaces and newlines, unlike ' +
|
|
55
|
+
'snapshot text which may normalize whitespace. Use the original ' +
|
|
56
|
+
'whitespace or a shorter distinctive substring.'),
|
|
57
|
+
...timeoutSchema,
|
|
58
|
+
visible: zod
|
|
59
|
+
.boolean()
|
|
60
|
+
.default(false)
|
|
61
|
+
.optional()
|
|
62
|
+
.describe('If true, wait until the matching text is visible. By default, hidden text also counts.'),
|
|
63
|
+
},
|
|
64
|
+
blockedByDialog: true,
|
|
65
|
+
concurrency: 'page',
|
|
66
|
+
verifyFilesSchema: {},
|
|
67
|
+
handler: async (request, response) => {
|
|
68
|
+
const page = request.page;
|
|
69
|
+
try {
|
|
70
|
+
await page.waitForTextOnPage(request.params.text, {
|
|
71
|
+
timeout: request.params.timeout,
|
|
72
|
+
visible: request.params.visible,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
const { TimeoutError } = await loadBrowser();
|
|
77
|
+
if (error instanceof TimeoutError) {
|
|
78
|
+
throw new TimeoutError(`${error.message}. Text matching is case-sensitive. DOM text must ` +
|
|
79
|
+
'preserve spaces and newlines, whereas snapshot text may ' +
|
|
80
|
+
'normalize whitespace. Try a shorter distinctive substring.', { cause: error });
|
|
81
|
+
}
|
|
82
|
+
throw error;
|
|
83
|
+
}
|
|
84
|
+
response.appendResponseLine(`Element matching one of ${JSON.stringify(request.params.text)} found.`);
|
|
85
|
+
response.includeSnapshot();
|
|
86
|
+
},
|
|
87
|
+
}));
|
|
88
|
+
//# sourceMappingURL=snapshot.js.map
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { zod, ajv } from '../third_party/index.js';
|
|
7
|
+
import { ToolCategory } from './categories.js';
|
|
8
|
+
import { definePageTool, jsonObjectTransform, zodTransform, } from './ToolDefinition.js';
|
|
9
|
+
export const listThirdPartyDeveloperTools = definePageTool(() => ({
|
|
10
|
+
name: 'list_3p_developer_tools',
|
|
11
|
+
description: `Lists all third-party developer tools the page exposes for providing runtime information (including debugging WebMCP tools and tools exposed via the 'devtoolstooldiscovery' event).
|
|
12
|
+
Third-party developer tools can be called via the 'execute_3p_developer_tool()' MCP tool.
|
|
13
|
+
Alternatively, third-party developer tools exposed via the 'devtoolstooldiscovery' event can be executed by calling 'evaluate_script' and adding the
|
|
14
|
+
following command to the script:
|
|
15
|
+
\`window.__dtmcp.executeTool(toolName, params)\`
|
|
16
|
+
This might be helpful when the third-party developer tools return non-serializable values or when composing
|
|
17
|
+
third-party developer tools with additional functionality.`,
|
|
18
|
+
annotations: {
|
|
19
|
+
category: ToolCategory.THIRD_PARTY,
|
|
20
|
+
readOnlyHint: true,
|
|
21
|
+
},
|
|
22
|
+
schema: {},
|
|
23
|
+
blockedByDialog: false,
|
|
24
|
+
concurrency: 'page',
|
|
25
|
+
verifyFilesSchema: {},
|
|
26
|
+
handler: async (_request, response) => {
|
|
27
|
+
response.setListThirdPartyDeveloperTools();
|
|
28
|
+
},
|
|
29
|
+
}));
|
|
30
|
+
export const executeThirdPartyDeveloperTool = definePageTool(() => ({
|
|
31
|
+
name: 'execute_3p_developer_tool',
|
|
32
|
+
description: `Executes a third-party developer tool exposed by the page.`,
|
|
33
|
+
annotations: {
|
|
34
|
+
category: ToolCategory.THIRD_PARTY,
|
|
35
|
+
readOnlyHint: false,
|
|
36
|
+
},
|
|
37
|
+
schema: {
|
|
38
|
+
toolName: zod.string().describe('The name of the tool to execute'),
|
|
39
|
+
params: zod
|
|
40
|
+
.string()
|
|
41
|
+
.transform(zodTransform(jsonObjectTransform))
|
|
42
|
+
.optional()
|
|
43
|
+
.describe('The JSON-stringified parameters to pass to the tool'),
|
|
44
|
+
},
|
|
45
|
+
blockedByDialog: false,
|
|
46
|
+
concurrency: 'page',
|
|
47
|
+
verifyFilesSchema: {},
|
|
48
|
+
handler: async (request, response) => {
|
|
49
|
+
const toolName = request.params.toolName;
|
|
50
|
+
const params = request.params.params ?? {};
|
|
51
|
+
const toolGroups = await request.page.discoverThirdPartyDeveloperTools();
|
|
52
|
+
let tool;
|
|
53
|
+
if (toolGroups) {
|
|
54
|
+
for (const group of toolGroups) {
|
|
55
|
+
tool = group.tools?.find(t => t.name === toolName);
|
|
56
|
+
if (tool) {
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (!tool) {
|
|
62
|
+
throw new Error(`Tool ${toolName} not found`);
|
|
63
|
+
}
|
|
64
|
+
const ajvInstance = new ajv();
|
|
65
|
+
const validate = ajvInstance.compile(tool.inputSchema);
|
|
66
|
+
const valid = validate(params);
|
|
67
|
+
if (!valid) {
|
|
68
|
+
throw new Error(`Invalid parameters for tool ${toolName}: ${ajvInstance.errorsText(validate.errors)}`);
|
|
69
|
+
}
|
|
70
|
+
await request.page.executeThirdPartyDeveloperTool(toolName, params, response);
|
|
71
|
+
},
|
|
72
|
+
}));
|
|
73
|
+
//# sourceMappingURL=thirdPartyDeveloper.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
// Tool names referenced from other tools' descriptions. Kept out of the tool
|
|
7
|
+
// modules because `createTools()` instantiates every export of those.
|
|
8
|
+
export const LIST_CONSOLE_MESSAGES_TOOL_NAME = 'list_console_messages';
|
|
9
|
+
export const GET_CONSOLE_MESSAGE_TOOL_NAME = 'get_console_message';
|
|
10
|
+
//# sourceMappingURL=toolNames.js.map
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { mcpOptions } from '../config/mcp-options.js';
|
|
7
|
+
import * as commentsTools from './comments.js';
|
|
8
|
+
import * as consoleTools from './console.js';
|
|
9
|
+
import * as cssTools from './css.js';
|
|
10
|
+
import * as emulationTools from './emulation.js';
|
|
11
|
+
import * as extensionTools from './extensions.js';
|
|
12
|
+
import * as inputTools from './input.js';
|
|
13
|
+
import * as lighthouseTools from './lighthouse.js';
|
|
14
|
+
import * as logpointTools from './logpoints.js';
|
|
15
|
+
import * as memoryTools from './memory.js';
|
|
16
|
+
import * as networkTools from './network.js';
|
|
17
|
+
import * as pagesTools from './pages.js';
|
|
18
|
+
import * as performanceTools from './performance.js';
|
|
19
|
+
import * as pwaTools from './pwa.js';
|
|
20
|
+
import * as screencastTools from './screencast.js';
|
|
21
|
+
import * as screenshotTools from './screenshot.js';
|
|
22
|
+
import * as scriptTools from './script.js';
|
|
23
|
+
import * as slimTools from './slim/tools.js';
|
|
24
|
+
import * as snapshotTools from './snapshot.js';
|
|
25
|
+
import * as thirdPartyDeveloperTools from './thirdPartyDeveloper.js';
|
|
26
|
+
import * as webauthnTools from './webauthn.js';
|
|
27
|
+
import * as webmcpTools from './webmcp.js';
|
|
28
|
+
export const createTools = (args) => {
|
|
29
|
+
const rawTools = [
|
|
30
|
+
...Object.values(commentsTools),
|
|
31
|
+
...Object.values(consoleTools),
|
|
32
|
+
...Object.values(cssTools),
|
|
33
|
+
...Object.values(emulationTools),
|
|
34
|
+
...Object.values(extensionTools),
|
|
35
|
+
...Object.values(inputTools),
|
|
36
|
+
...Object.values(lighthouseTools),
|
|
37
|
+
...Object.values(logpointTools),
|
|
38
|
+
...Object.values(memoryTools),
|
|
39
|
+
...Object.values(networkTools),
|
|
40
|
+
...Object.values(pagesTools),
|
|
41
|
+
...Object.values(performanceTools),
|
|
42
|
+
...Object.values(pwaTools),
|
|
43
|
+
...Object.values(screencastTools),
|
|
44
|
+
...Object.values(screenshotTools),
|
|
45
|
+
...Object.values(scriptTools),
|
|
46
|
+
...Object.values(slimTools),
|
|
47
|
+
...Object.values(snapshotTools),
|
|
48
|
+
...Object.values(thirdPartyDeveloperTools),
|
|
49
|
+
...Object.values(webauthnTools),
|
|
50
|
+
...Object.values(webmcpTools),
|
|
51
|
+
];
|
|
52
|
+
const tools = [];
|
|
53
|
+
for (const tool of rawTools) {
|
|
54
|
+
tools.push(tool(args));
|
|
55
|
+
}
|
|
56
|
+
tools.sort((a, b) => a.name.localeCompare(b.name));
|
|
57
|
+
return tools;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Returns true if the tool is gated behind a hidden (internal) flag. Such
|
|
61
|
+
* tools are excluded from the generated documentation and CLI.
|
|
62
|
+
*/
|
|
63
|
+
export function requiresHiddenFlag(tool) {
|
|
64
|
+
for (const condition of tool.annotations.conditions ?? []) {
|
|
65
|
+
const option = mcpOptions[condition];
|
|
66
|
+
if (option.hidden) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=tools.js.map
|