firebase-tools-with-isolate 13.29.1 → 14.10.1-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/README.md +53 -4
- package/lib/api.js +10 -2
- package/lib/appdistribution/client.js +2 -2
- package/lib/apphosting/backend.js +157 -55
- package/lib/apphosting/config.js +121 -101
- package/lib/apphosting/githubConnections.js +65 -100
- package/lib/apphosting/repo.js +22 -36
- package/lib/apphosting/rollout.js +5 -11
- package/lib/apphosting/secrets/dialogs.js +13 -11
- package/lib/apphosting/secrets/index.js +47 -5
- package/lib/apphosting/utils.js +1 -3
- package/lib/apphosting/yaml.js +35 -49
- package/lib/auth.js +23 -6
- package/lib/bin/cli.js +99 -0
- package/lib/bin/firebase.js +7 -123
- package/lib/bin/mcp.js +49 -0
- package/lib/checkValidTargetFilters.js +1 -0
- package/lib/command.js +3 -2
- package/lib/commands/appdistribution-distribute.js +1 -1
- package/lib/commands/appdistribution-groups-create.js +1 -1
- package/lib/commands/appdistribution-groups-delete.js +1 -1
- package/lib/commands/appdistribution-groups-list.js +2 -2
- package/lib/commands/appdistribution-testers-add.js +1 -1
- package/lib/commands/appdistribution-testers-list.js +3 -3
- package/lib/commands/appdistribution-testers-remove.js +1 -1
- package/lib/commands/apphosting-backends-create.js +3 -3
- package/lib/commands/apphosting-backends-delete.js +23 -27
- package/lib/commands/apphosting-backends-get.js +12 -12
- package/lib/commands/apphosting-backends-list.js +5 -5
- package/lib/commands/apphosting-builds-create.js +8 -2
- package/lib/commands/apphosting-builds-get.js +8 -1
- package/lib/commands/apphosting-rollouts-create.js +3 -3
- package/lib/commands/apphosting-rollouts-list.js +8 -2
- package/lib/commands/apphosting-secrets-access.js +1 -1
- package/lib/commands/apphosting-secrets-describe.js +2 -2
- package/lib/commands/apphosting-secrets-grantaccess.js +20 -10
- package/lib/commands/apphosting-secrets-set.js +27 -1
- package/lib/commands/apps-android-sha-create.js +1 -1
- package/lib/commands/apps-android-sha-delete.js +1 -1
- package/lib/commands/apps-android-sha-list.js +2 -2
- package/lib/commands/apps-create.js +4 -108
- package/lib/commands/apps-init.js +94 -0
- package/lib/commands/apps-list.js +1 -1
- package/lib/commands/apps-sdkconfig.js +5 -10
- package/lib/commands/auth-export.js +1 -1
- package/lib/commands/auth-import.js +1 -1
- package/lib/commands/database-import.js +4 -6
- package/lib/commands/database-instances-create.js +1 -1
- package/lib/commands/database-instances-list.js +1 -1
- package/lib/commands/database-profile.js +1 -2
- package/lib/commands/database-remove.js +4 -6
- package/lib/commands/database-set.js +6 -6
- package/lib/commands/database-settings-set.js +1 -1
- package/lib/commands/database-update.js +6 -6
- package/lib/commands/dataconnect-sdk-generate.js +5 -2
- package/lib/commands/dataconnect-services-list.js +2 -2
- package/lib/commands/dataconnect-sql-diff.js +2 -2
- package/lib/commands/dataconnect-sql-grant.js +3 -3
- package/lib/commands/dataconnect-sql-migrate.js +2 -2
- package/lib/commands/dataconnect-sql-setup.js +39 -0
- package/lib/commands/dataconnect-sql-shell.js +5 -7
- package/lib/commands/deploy.js +4 -3
- package/lib/commands/emulators-exec.js +1 -1
- package/lib/commands/emulators-start.js +4 -3
- package/lib/commands/experiments-list.js +1 -1
- package/lib/commands/ext-dev-deprecate.js +1 -0
- package/lib/commands/ext-dev-init.js +3 -12
- package/lib/commands/ext-dev-list.js +1 -1
- package/lib/commands/ext-dev-register.js +3 -5
- package/lib/commands/ext-dev-undeprecate.js +1 -2
- package/lib/commands/ext-dev-usage.js +4 -6
- package/lib/commands/ext-export.js +1 -2
- package/lib/commands/ext-install.js +3 -3
- package/lib/commands/ext-sdk-install.js +1 -0
- package/lib/commands/ext-update.js +1 -0
- package/lib/commands/firestore-backups-delete.js +3 -4
- package/lib/commands/firestore-backups-get.js +1 -1
- package/lib/commands/firestore-backups-list.js +2 -2
- package/lib/commands/firestore-backups-schedules-create.js +4 -4
- package/lib/commands/firestore-backups-schedules-delete.js +3 -4
- package/lib/commands/firestore-backups-schedules-list.js +2 -2
- package/lib/commands/firestore-backups-schedules-update.js +1 -1
- package/lib/commands/firestore-databases-create.js +6 -6
- package/lib/commands/firestore-databases-delete.js +3 -7
- package/lib/commands/firestore-databases-get.js +1 -1
- package/lib/commands/firestore-databases-list.js +1 -1
- package/lib/commands/firestore-databases-restore.js +5 -5
- package/lib/commands/firestore-databases-update.js +4 -4
- package/lib/commands/firestore-delete.js +13 -14
- package/lib/commands/firestore-indexes-list.js +4 -4
- package/lib/commands/firestore-locations.js +1 -1
- package/lib/commands/functions-artifacts-setpolicy.js +132 -0
- package/lib/commands/functions-config-export.js +6 -10
- package/lib/commands/functions-delete.js +5 -7
- package/lib/commands/functions-deletegcfartifacts.js +5 -5
- package/lib/commands/functions-list.js +24 -33
- package/lib/commands/functions-secrets-access.js +1 -1
- package/lib/commands/functions-secrets-describe.js +1 -1
- package/lib/commands/functions-secrets-destroy.js +10 -12
- package/lib/commands/functions-secrets-get.js +1 -1
- package/lib/commands/functions-secrets-prune.js +14 -15
- package/lib/commands/functions-secrets-set.js +14 -18
- package/lib/commands/hosting-channel-create.js +1 -2
- package/lib/commands/hosting-channel-delete.js +4 -4
- package/lib/commands/hosting-channel-list.js +1 -1
- package/lib/commands/hosting-channel-open.js +2 -3
- package/lib/commands/hosting-disable.js +5 -5
- package/lib/commands/hosting-sites-delete.js +4 -4
- package/lib/commands/hosting-sites-get.js +1 -1
- package/lib/commands/hosting-sites-list.js +1 -1
- package/lib/commands/index.js +7 -4
- package/lib/commands/init.js +54 -60
- package/lib/commands/internaltesting-frameworks-compose.js +1 -1
- package/lib/commands/login-use.js +2 -11
- package/lib/commands/login.js +10 -8
- package/lib/commands/logout.js +2 -3
- package/lib/commands/mcp.js +11 -0
- package/lib/commands/open.js +4 -2
- package/lib/commands/projects-create.js +1 -2
- package/lib/commands/projects-list.js +1 -1
- package/lib/commands/remoteconfig-get.js +1 -1
- package/lib/commands/remoteconfig-rollback.js +5 -5
- package/lib/commands/remoteconfig-versions-list.js +2 -2
- package/lib/commands/setup-emulators-database.js +1 -1
- package/lib/commands/setup-emulators-dataconnect.js +1 -1
- package/lib/commands/setup-emulators-firestore.js +1 -1
- package/lib/commands/setup-emulators-pubsub.js +1 -1
- package/lib/commands/setup-emulators-storage.js +1 -1
- package/lib/commands/setup-emulators-ui.js +1 -1
- package/lib/commands/use.js +115 -111
- package/lib/config.js +49 -33
- package/lib/crashlytics/buildToolsJarHelper.js +1 -1
- package/lib/crashlytics/listTopIssues.js +45 -0
- package/lib/dataconnect/build.js +61 -4
- package/lib/dataconnect/client.js +26 -17
- package/lib/dataconnect/cloudAICompanionClient.js +72 -0
- package/lib/dataconnect/dataplaneClient.js +19 -2
- package/lib/dataconnect/ensureApis.js +6 -3
- package/lib/dataconnect/fileUtils.js +39 -6
- package/lib/dataconnect/freeTrial.js +21 -9
- package/lib/dataconnect/graphqlError.js +56 -2
- package/lib/dataconnect/provisionCloudSql.js +23 -12
- package/lib/dataconnect/schemaMigration.js +46 -26
- package/lib/dataconnect/types.js +5 -1
- package/lib/defaultCredentials.js +12 -1
- package/lib/deploy/apphosting/args.js +2 -0
- package/lib/deploy/apphosting/deploy.js +77 -0
- package/lib/deploy/apphosting/index.js +9 -0
- package/lib/deploy/apphosting/prepare.js +138 -0
- package/lib/deploy/apphosting/release.js +56 -0
- package/lib/deploy/apphosting/util.js +65 -0
- package/lib/deploy/dataconnect/deploy.js +14 -7
- package/lib/deploy/dataconnect/prepare.js +3 -5
- package/lib/deploy/extensions/v2FunctionHelper.js +2 -1
- package/lib/deploy/firestore/deploy.js +50 -4
- package/lib/deploy/functions/build.js +1 -0
- package/lib/deploy/functions/checkIam.js +41 -6
- package/lib/deploy/functions/containerCleaner.js +17 -2
- package/lib/deploy/functions/ensure.js +2 -1
- package/lib/deploy/functions/params.js +10 -17
- package/lib/deploy/functions/prepare.js +51 -18
- package/lib/deploy/functions/prepareFunctionsUpload.js +9 -5
- package/lib/deploy/functions/prompts.js +24 -17
- package/lib/deploy/functions/release/fabricator.js +4 -4
- package/lib/deploy/functions/release/index.js +27 -9
- package/lib/deploy/functions/release/planner.js +1 -0
- package/lib/deploy/functions/runtimes/discovery/index.js +13 -5
- package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +4 -4
- package/lib/deploy/functions/runtimes/python/index.js +4 -1
- package/lib/deploy/functions/runtimes/supported/types.js +17 -11
- package/lib/deploy/functions/services/firestore.js +23 -4
- package/lib/deploy/index.js +29 -10
- package/lib/deploy/lifecycleHooks.js +6 -12
- package/lib/emulator/ExpressBasedEmulator.js +1 -1
- package/lib/emulator/apphosting/config.js +15 -14
- package/lib/emulator/apphosting/index.js +2 -0
- package/lib/emulator/apphosting/serve.js +147 -10
- package/lib/emulator/auth/cloudFunctions.js +13 -1
- package/lib/emulator/auth/operations.js +2 -1
- package/lib/emulator/auth/widget_ui.js +2 -1
- package/lib/emulator/commandUtils.js +14 -20
- package/lib/emulator/constants.js +2 -0
- package/lib/emulator/controller.js +24 -9
- package/lib/emulator/dataconnect/pgliteServer.js +136 -45
- package/lib/emulator/dataconnectEmulator.js +34 -6
- package/lib/emulator/dataconnectToolkitController.js +5 -0
- package/lib/emulator/downloadableEmulatorInfo.json +81 -0
- package/lib/emulator/downloadableEmulators.js +28 -80
- package/lib/emulator/env.js +47 -1
- package/lib/emulator/extensionsEmulator.js +5 -3
- package/lib/emulator/functionsEmulator.js +6 -26
- package/lib/emulator/hub.js +5 -4
- package/lib/emulator/hubClient.js +5 -0
- package/lib/emulator/initEmulators.js +29 -15
- package/lib/emulator/ui.js +4 -8
- package/lib/ensureApiEnabled.js +32 -1
- package/lib/experiments.js +11 -12
- package/lib/extensions/askUserForEventsConfig.js +6 -15
- package/lib/extensions/askUserForParam.js +23 -52
- package/lib/extensions/change-log.js +1 -25
- package/lib/extensions/checkProjectBilling.js +3 -9
- package/lib/extensions/diagnose.js +3 -6
- package/lib/extensions/emulator/triggerHelper.js +4 -0
- package/lib/extensions/extensionsHelper.js +25 -31
- package/lib/extensions/listExtensions.js +1 -1
- package/lib/extensions/manifest.js +3 -7
- package/lib/extensions/paramHelper.js +11 -2
- package/lib/extensions/provisioningHelper.js +1 -1
- package/lib/extensions/tos.js +4 -2
- package/lib/extensions/utils.js +1 -10
- package/lib/firebaseConfigValidate.js +7 -5
- package/lib/firestore/delete.js +5 -4
- package/lib/firestore/pretty-print.js +1 -1
- package/lib/frameworks/angular/index.js +11 -6
- package/lib/frameworks/angular/utils.js +76 -47
- package/lib/frameworks/constants.js +1 -1
- package/lib/frameworks/index.js +6 -4
- package/lib/frameworks/next/index.js +7 -4
- package/lib/frameworks/utils.js +11 -3
- package/lib/frameworks/vite/index.js +2 -3
- package/lib/fsAsync.js +9 -2
- package/lib/fsutils.js +16 -1
- package/lib/functions/artifacts.js +196 -0
- package/lib/functions/secrets.js +15 -16
- package/lib/gcp/apphosting.js +13 -1
- package/lib/gcp/artifactregistry.js +27 -2
- package/lib/gcp/auth.js +113 -1
- package/lib/gcp/cloudbilling.js +12 -1
- package/lib/gcp/cloudfunctions.js +32 -4
- package/lib/gcp/cloudfunctionsv2.js +15 -9
- package/lib/gcp/cloudscheduler.js +2 -2
- package/lib/gcp/cloudsql/cloudsqladmin.js +32 -11
- package/lib/gcp/cloudsql/connect.js +21 -14
- package/lib/gcp/cloudsql/interactive.js +1 -1
- package/lib/gcp/cloudsql/permissions.js +46 -99
- package/lib/gcp/cloudsql/permissionsSetup.js +224 -0
- package/lib/gcp/computeEngine.js +19 -2
- package/lib/gcp/devConnect.js +6 -1
- package/lib/gcp/firestore.js +55 -16
- package/lib/gcp/iam.js +1 -5
- package/lib/gcp/proto.js +4 -3
- package/lib/gcp/run.js +18 -1
- package/lib/gcp/serviceusage.js +2 -1
- package/lib/gcp/storage.js +47 -1
- package/lib/gemini/fdcExperience.js +56 -0
- package/lib/gemini/types.js +2 -0
- package/lib/hosting/api.js +4 -0
- package/lib/hosting/implicitInit.js +7 -3
- package/lib/hosting/interactive.js +2 -3
- package/lib/index.js +1 -2
- package/lib/init/features/account.js +2 -4
- package/lib/init/features/apphosting.js +75 -6
- package/lib/init/features/database.js +63 -62
- package/lib/init/features/dataconnect/index.js +131 -85
- package/lib/init/features/dataconnect/sdk.js +73 -18
- package/lib/init/features/emulators.js +29 -46
- package/lib/init/features/firestore/index.js +79 -43
- package/lib/init/features/firestore/indexes.js +30 -45
- package/lib/init/features/firestore/rules.js +36 -62
- package/lib/init/features/functions/index.js +11 -16
- package/lib/init/features/functions/javascript.js +17 -30
- package/lib/init/features/functions/npm-dependencies.js +4 -8
- package/lib/init/features/functions/python.js +1 -3
- package/lib/init/features/functions/typescript.js +25 -43
- package/lib/init/features/genkit/index.js +111 -106
- package/lib/init/features/hosting/github.js +22 -52
- package/lib/init/features/hosting/index.js +37 -57
- package/lib/init/features/index.js +10 -5
- package/lib/init/features/project.js +18 -21
- package/lib/init/features/remoteconfig.js +5 -10
- package/lib/init/features/storage.js +30 -10
- package/lib/init/index.js +79 -24
- package/lib/logger.js +76 -3
- package/lib/management/apps.js +292 -7
- package/lib/management/projects.js +100 -52
- package/lib/mcp/errors.js +20 -0
- package/lib/mcp/index.js +227 -0
- package/lib/mcp/tool.js +12 -0
- package/lib/mcp/tools/apphosting/fetch_logs.js +68 -0
- package/lib/mcp/tools/apphosting/index.js +6 -0
- package/lib/mcp/tools/apphosting/list_backends.js +51 -0
- package/lib/mcp/tools/auth/disable_user.js +30 -0
- package/lib/mcp/tools/auth/get_user.js +38 -0
- package/lib/mcp/tools/auth/index.js +15 -0
- package/lib/mcp/tools/auth/list_users.js +36 -0
- package/lib/mcp/tools/auth/set_claims.js +43 -0
- package/lib/mcp/tools/auth/set_sms_region_policy.js +36 -0
- package/lib/mcp/tools/core/consult_assistant.js +28 -0
- package/lib/mcp/tools/core/create_android_sha.js +43 -0
- package/lib/mcp/tools/core/create_app.js +90 -0
- package/lib/mcp/tools/core/create_project.js +68 -0
- package/lib/mcp/tools/core/get_admin_sdk_config.js +26 -0
- package/lib/mcp/tools/core/get_environment.js +51 -0
- package/lib/mcp/tools/core/get_project.js +22 -0
- package/lib/mcp/tools/core/get_sdk_config.js +40 -0
- package/lib/mcp/tools/core/index.js +29 -0
- package/lib/mcp/tools/core/init.js +153 -0
- package/lib/mcp/tools/core/list_apps.js +34 -0
- package/lib/mcp/tools/core/list_projects.js +45 -0
- package/lib/mcp/tools/core/update_environment.js +55 -0
- package/lib/mcp/tools/crashlytics/index.js +5 -0
- package/lib/mcp/tools/crashlytics/list_top_issues.js +39 -0
- package/lib/mcp/tools/dataconnect/converter.js +60 -0
- package/lib/mcp/tools/dataconnect/emulator.js +16 -0
- package/lib/mcp/tools/dataconnect/execute_graphql.js +48 -0
- package/lib/mcp/tools/dataconnect/execute_graphql_read.js +48 -0
- package/lib/mcp/tools/dataconnect/execute_mutation.js +62 -0
- package/lib/mcp/tools/dataconnect/execute_query.js +62 -0
- package/lib/mcp/tools/dataconnect/generate_operation.js +34 -0
- package/lib/mcp/tools/dataconnect/generate_schema.js +26 -0
- package/lib/mcp/tools/dataconnect/get_connector.js +31 -0
- package/lib/mcp/tools/dataconnect/get_schema.js +31 -0
- package/lib/mcp/tools/dataconnect/index.js +23 -0
- package/lib/mcp/tools/dataconnect/list_services.js +23 -0
- package/lib/mcp/tools/firestore/converter.js +102 -0
- package/lib/mcp/tools/firestore/delete_document.js +50 -0
- package/lib/mcp/tools/firestore/get_documents.js +58 -0
- package/lib/mcp/tools/firestore/index.js +17 -0
- package/lib/mcp/tools/firestore/list_collections.js +36 -0
- package/lib/mcp/tools/firestore/query_collection.js +132 -0
- package/lib/mcp/tools/index.js +62 -0
- package/lib/mcp/tools/messaging/index.js +5 -0
- package/lib/mcp/tools/messaging/send_message.js +42 -0
- package/lib/mcp/tools/remoteconfig/get_template.js +27 -0
- package/lib/mcp/tools/remoteconfig/index.js +7 -0
- package/lib/mcp/tools/remoteconfig/publish_template.js +34 -0
- package/lib/mcp/tools/remoteconfig/rollback_template.js +29 -0
- package/lib/mcp/tools/rules/get_rules.js +29 -0
- package/lib/mcp/tools/rules/validate_rules.js +97 -0
- package/lib/mcp/tools/storage/get_download_url.js +40 -0
- package/lib/mcp/tools/storage/get_rules.js +26 -0
- package/lib/mcp/tools/storage/index.js +11 -0
- package/lib/mcp/types.js +13 -0
- package/lib/mcp/util.js +214 -0
- package/lib/mcp/util.test.js +468 -0
- package/lib/messaging/interfaces.js +2 -0
- package/lib/messaging/sendMessage.js +48 -0
- package/lib/operation-poller.js +3 -1
- package/lib/profileReport.js +1 -1
- package/lib/prompt.js +86 -54
- package/lib/remoteconfig/publish.js +39 -0
- package/lib/requireAuth.js +2 -2
- package/lib/requireTosAcceptance.js +4 -0
- package/lib/rulesDeploy.js +10 -15
- package/lib/track.js +7 -37
- package/lib/utils.js +28 -41
- package/lib/vsCodeUtils.js +7 -3
- package/package.json +31 -15
- package/schema/connector-yaml.json +12 -0
- package/schema/dataconnect-yaml.json +5 -0
- package/schema/extension-yaml.json +17 -4
- package/schema/firebase-config.json +1117 -2121
- package/standalone/package-lock.json +1255 -992
- package/standalone/package.json +1 -1
- package/templates/dataconnect-prompts/operation-generation-cursor-windsurf-rule.txt +273 -0
- package/templates/dataconnect-prompts/schema-generation-cursor-windsurf-rule.txt +653 -0
- package/templates/genkit/firebase.0.9.0.template +1 -1
- package/templates/genkit/firebase.1.0.0.template +71 -0
- package/templates/init/dataconnect/connector.yaml +4 -1
- package/templates/init/dataconnect/dataconnect.yaml +1 -1
- package/templates/init/dataconnect/mutations.gql +9 -26
- package/templates/init/dataconnect/queries.gql +9 -14
- package/templates/init/dataconnect/schema.gql +28 -21
- package/templates/init/firestore/firestore.rules +2 -0
- package/templates/init/functions/javascript/index.js +14 -1
- package/templates/init/functions/javascript/package.lint.json +1 -1
- package/templates/init/functions/javascript/package.nolint.json +1 -1
- package/templates/init/functions/python/_gitignore +6 -1
- package/templates/init/functions/python/main.py +8 -0
- package/templates/init/functions/typescript/index.ts +14 -1
- package/templates/init/functions/typescript/package.lint.json +2 -2
- package/templates/init/functions/typescript/package.nolint.json +3 -3
- package/lib/commands/apphosting-config-export.js +0 -28
- package/lib/commands/experimental-functions-shell.js +0 -13
- package/lib/emulator/dataconnect/pg-gateway/auth/base-auth-flow.js +0 -11
- package/lib/emulator/dataconnect/pg-gateway/auth/cert.js +0 -58
- package/lib/emulator/dataconnect/pg-gateway/auth/index.js +0 -22
- package/lib/emulator/dataconnect/pg-gateway/auth/md5.js +0 -124
- package/lib/emulator/dataconnect/pg-gateway/auth/password.js +0 -54
- package/lib/emulator/dataconnect/pg-gateway/auth/sasl/sasl-mechanism.js +0 -34
- package/lib/emulator/dataconnect/pg-gateway/auth/sasl/scram-sha-256.js +0 -270
- package/lib/emulator/dataconnect/pg-gateway/backend-error.js +0 -75
- package/lib/emulator/dataconnect/pg-gateway/buffer-reader.js +0 -54
- package/lib/emulator/dataconnect/pg-gateway/buffer-writer.js +0 -79
- package/lib/emulator/dataconnect/pg-gateway/connection.js +0 -315
- package/lib/emulator/dataconnect/pg-gateway/connection.types.js +0 -8
- package/lib/emulator/dataconnect/pg-gateway/crypto.js +0 -40
- package/lib/emulator/dataconnect/pg-gateway/duplex.js +0 -53
- package/lib/emulator/dataconnect/pg-gateway/index.js +0 -27
- package/lib/emulator/dataconnect/pg-gateway/message-buffer.js +0 -82
- package/lib/emulator/dataconnect/pg-gateway/message-codes.js +0 -52
- package/lib/emulator/dataconnect/pg-gateway/platforms/node/index.js +0 -16
- package/lib/emulator/dataconnect/pg-gateway/polyfills/readable-stream-async-iterator.js +0 -35
- package/lib/emulator/dataconnect/pg-gateway/utils.js +0 -40
- package/templates/setup/web.js +0 -5
- /package/lib/{emulator/dataconnect/pg-gateway/auth/trust.js → dataconnect/cloudAICompanionTypes.js} +0 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.get_documents = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const tool_js_1 = require("../../tool.js");
|
|
6
|
+
const util_js_1 = require("../../util.js");
|
|
7
|
+
const firestore_js_1 = require("../../../gcp/firestore.js");
|
|
8
|
+
const converter_js_1 = require("./converter.js");
|
|
9
|
+
const types_js_1 = require("../../../emulator/types.js");
|
|
10
|
+
exports.get_documents = (0, tool_js_1.tool)({
|
|
11
|
+
name: "get_documents",
|
|
12
|
+
description: "Retrieves one or more Firestore documents from a database in the current project by full document paths. Use this if you know the exact path of a document.",
|
|
13
|
+
inputSchema: zod_1.z.object({
|
|
14
|
+
database: zod_1.z
|
|
15
|
+
.string()
|
|
16
|
+
.optional()
|
|
17
|
+
.describe("Database id to use. Defaults to `(default)` if unspecified."),
|
|
18
|
+
paths: zod_1.z
|
|
19
|
+
.array(zod_1.z.string())
|
|
20
|
+
.describe("One or more document paths (e.g. `collectionName/documentId` or `parentCollection/parentDocument/collectionName/documentId`)"),
|
|
21
|
+
use_emulator: zod_1.z.boolean().default(false).describe("Target the Firestore emulator if true."),
|
|
22
|
+
}),
|
|
23
|
+
annotations: {
|
|
24
|
+
title: "Get Firestore documents",
|
|
25
|
+
readOnlyHint: true,
|
|
26
|
+
},
|
|
27
|
+
_meta: {
|
|
28
|
+
requiresAuth: true,
|
|
29
|
+
requiresProject: true,
|
|
30
|
+
},
|
|
31
|
+
}, async ({ paths, database, use_emulator }, { projectId, host }) => {
|
|
32
|
+
if (!paths || !paths.length)
|
|
33
|
+
return (0, util_js_1.mcpError)("Must supply at least one document path.");
|
|
34
|
+
let emulatorUrl;
|
|
35
|
+
if (use_emulator) {
|
|
36
|
+
emulatorUrl = await host.getEmulatorUrl(types_js_1.Emulators.FIRESTORE);
|
|
37
|
+
}
|
|
38
|
+
const { documents, missing } = await (0, firestore_js_1.getDocuments)(projectId, paths, database, emulatorUrl);
|
|
39
|
+
if (missing.length > 0 && documents && documents.length === 0) {
|
|
40
|
+
return (0, util_js_1.mcpError)(`None of the specified documents were found in project '${projectId}'`);
|
|
41
|
+
}
|
|
42
|
+
const docs = documents.map(converter_js_1.firestoreDocumentToJson);
|
|
43
|
+
if (documents.length === 1 && missing.length === 0) {
|
|
44
|
+
return (0, util_js_1.toContent)(docs[0]);
|
|
45
|
+
}
|
|
46
|
+
const docsContent = (0, util_js_1.toContent)(docs);
|
|
47
|
+
if (missing.length) {
|
|
48
|
+
docsContent.content = [
|
|
49
|
+
{ type: "text", text: "Retrieved documents:\n\n" },
|
|
50
|
+
...docsContent.content,
|
|
51
|
+
{
|
|
52
|
+
type: "text",
|
|
53
|
+
text: `The following documents do not exist: ${missing.join(", ")}`,
|
|
54
|
+
},
|
|
55
|
+
];
|
|
56
|
+
}
|
|
57
|
+
return docsContent;
|
|
58
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.firestoreTools = void 0;
|
|
4
|
+
const delete_document_1 = require("./delete_document");
|
|
5
|
+
const get_documents_1 = require("./get_documents");
|
|
6
|
+
const list_collections_1 = require("./list_collections");
|
|
7
|
+
const query_collection_1 = require("./query_collection");
|
|
8
|
+
const validate_rules_1 = require("../rules/validate_rules");
|
|
9
|
+
const get_rules_1 = require("../rules/get_rules");
|
|
10
|
+
exports.firestoreTools = [
|
|
11
|
+
delete_document_1.delete_document,
|
|
12
|
+
get_documents_1.get_documents,
|
|
13
|
+
list_collections_1.list_collections,
|
|
14
|
+
query_collection_1.query_collection,
|
|
15
|
+
(0, get_rules_1.getRulesTool)("Firestore", "cloud.firestore"),
|
|
16
|
+
(0, validate_rules_1.validateRulesTool)("Firestore"),
|
|
17
|
+
];
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.list_collections = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const tool_js_1 = require("../../tool.js");
|
|
6
|
+
const util_js_1 = require("../../util.js");
|
|
7
|
+
const firestore_js_1 = require("../../../gcp/firestore.js");
|
|
8
|
+
const errors_js_1 = require("../../errors.js");
|
|
9
|
+
const types_js_1 = require("../../../emulator/types.js");
|
|
10
|
+
exports.list_collections = (0, tool_js_1.tool)({
|
|
11
|
+
name: "list_collections",
|
|
12
|
+
description: "Retrieves a list of collections from a Firestore database in the current project.",
|
|
13
|
+
inputSchema: zod_1.z.object({
|
|
14
|
+
database: zod_1.z
|
|
15
|
+
.string()
|
|
16
|
+
.optional()
|
|
17
|
+
.describe("Database id to use. Defaults to `(default)` if unspecified."),
|
|
18
|
+
use_emulator: zod_1.z.boolean().default(false).describe("Target the Firestore emulator if true."),
|
|
19
|
+
}),
|
|
20
|
+
annotations: {
|
|
21
|
+
title: "List Firestore collections",
|
|
22
|
+
readOnlyHint: true,
|
|
23
|
+
},
|
|
24
|
+
_meta: {
|
|
25
|
+
requiresAuth: true,
|
|
26
|
+
requiresProject: true,
|
|
27
|
+
},
|
|
28
|
+
}, async ({ database, use_emulator }, { projectId, host }) => {
|
|
29
|
+
let emulatorUrl;
|
|
30
|
+
if (use_emulator) {
|
|
31
|
+
emulatorUrl = await host.getEmulatorUrl(types_js_1.Emulators.FIRESTORE);
|
|
32
|
+
}
|
|
33
|
+
if (!projectId)
|
|
34
|
+
return errors_js_1.NO_PROJECT_ERROR;
|
|
35
|
+
return (0, util_js_1.toContent)(await (0, firestore_js_1.listCollectionIds)(projectId, database, emulatorUrl));
|
|
36
|
+
});
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.query_collection = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const tool_js_1 = require("../../tool.js");
|
|
6
|
+
const util_js_1 = require("../../util.js");
|
|
7
|
+
const firestore_js_1 = require("../../../gcp/firestore.js");
|
|
8
|
+
const converter_js_1 = require("./converter.js");
|
|
9
|
+
const types_js_1 = require("../../../emulator/types.js");
|
|
10
|
+
exports.query_collection = (0, tool_js_1.tool)({
|
|
11
|
+
name: "query_collection",
|
|
12
|
+
description: "Retrieves one or more Firestore documents from a collection is a database in the current project by a collection with a full document path. Use this if you know the exact path of a collection and the filtering clause you would like for the document.",
|
|
13
|
+
inputSchema: zod_1.z.object({
|
|
14
|
+
database: zod_1.z
|
|
15
|
+
.string()
|
|
16
|
+
.optional()
|
|
17
|
+
.describe("Database id to use. Defaults to `(default)` if unspecified."),
|
|
18
|
+
collection_path: zod_1.z
|
|
19
|
+
.string()
|
|
20
|
+
.describe("A collection path (e.g. `collectionName/` or `parentCollection/parentDocument/collectionName`)"),
|
|
21
|
+
filters: zod_1.z
|
|
22
|
+
.object({
|
|
23
|
+
compare_value: zod_1.z
|
|
24
|
+
.object({
|
|
25
|
+
string_value: zod_1.z.string().optional().describe("The string value to compare against."),
|
|
26
|
+
boolean_value: zod_1.z
|
|
27
|
+
.string()
|
|
28
|
+
.optional()
|
|
29
|
+
.describe("The boolean value to compare against."),
|
|
30
|
+
string_array_value: zod_1.z
|
|
31
|
+
.array(zod_1.z.string())
|
|
32
|
+
.optional()
|
|
33
|
+
.describe("The string value to compare against."),
|
|
34
|
+
integer_value: zod_1.z
|
|
35
|
+
.number()
|
|
36
|
+
.optional()
|
|
37
|
+
.describe("The integer value to compare against."),
|
|
38
|
+
double_value: zod_1.z.number().optional().describe("The double value to compare against."),
|
|
39
|
+
})
|
|
40
|
+
.describe("One and only one value may be specified per filters object."),
|
|
41
|
+
field: zod_1.z.string().describe("the field searching against"),
|
|
42
|
+
op: zod_1.z
|
|
43
|
+
.enum([
|
|
44
|
+
"OPERATOR_UNSPECIFIED",
|
|
45
|
+
"LESS_THAN",
|
|
46
|
+
"LESS_THAN_OR_EQUAL",
|
|
47
|
+
"GREATER_THAN",
|
|
48
|
+
"GREATER_THAN_OR_EQUAL",
|
|
49
|
+
"EQUAL",
|
|
50
|
+
"NOT_EQUAL",
|
|
51
|
+
"ARRAY_CONTAINS",
|
|
52
|
+
"ARRAY_CONTAINS_ANY",
|
|
53
|
+
"IN",
|
|
54
|
+
"NOT_IN",
|
|
55
|
+
])
|
|
56
|
+
.describe("the equality evaluator to use"),
|
|
57
|
+
})
|
|
58
|
+
.array()
|
|
59
|
+
.describe("the multiple filters to use in querying against the existing collection."),
|
|
60
|
+
order: zod_1.z
|
|
61
|
+
.object({
|
|
62
|
+
orderBy: zod_1.z.string().describe("the field to order by"),
|
|
63
|
+
orderByDirection: zod_1.z
|
|
64
|
+
.enum(["ASCENDING", "DESCENDING"])
|
|
65
|
+
.describe("the direction to order values"),
|
|
66
|
+
})
|
|
67
|
+
.optional()
|
|
68
|
+
.describe("Specifies the field and direction to order the results. If not provided, the order is undefined."),
|
|
69
|
+
limit: zod_1.z
|
|
70
|
+
.number()
|
|
71
|
+
.describe("The maximum amount of records to return. Default is 10.")
|
|
72
|
+
.optional(),
|
|
73
|
+
use_emulator: zod_1.z.boolean().default(false).describe("Target the Firestore emulator if true."),
|
|
74
|
+
}),
|
|
75
|
+
annotations: {
|
|
76
|
+
title: "Query Firestore collection",
|
|
77
|
+
readOnlyHint: true,
|
|
78
|
+
},
|
|
79
|
+
_meta: {
|
|
80
|
+
requiresAuth: true,
|
|
81
|
+
requiresProject: true,
|
|
82
|
+
},
|
|
83
|
+
}, async ({ collection_path, filters, order, limit, database, use_emulator }, { projectId, host }) => {
|
|
84
|
+
if (!collection_path || !collection_path.length)
|
|
85
|
+
return (0, util_js_1.mcpError)("Must supply at least one collection path.");
|
|
86
|
+
const structuredQuery = {
|
|
87
|
+
from: [{ collectionId: collection_path, allDescendants: false }],
|
|
88
|
+
};
|
|
89
|
+
if (filters) {
|
|
90
|
+
structuredQuery.where = {
|
|
91
|
+
compositeFilter: {
|
|
92
|
+
op: "AND",
|
|
93
|
+
filters: filters.map((f) => {
|
|
94
|
+
if (f.compare_value.boolean_value &&
|
|
95
|
+
f.compare_value.double_value &&
|
|
96
|
+
f.compare_value.integer_value &&
|
|
97
|
+
f.compare_value.string_array_value &&
|
|
98
|
+
f.compare_value.string_value) {
|
|
99
|
+
throw (0, util_js_1.mcpError)("One and only one value may be specified per filters object.");
|
|
100
|
+
}
|
|
101
|
+
const out = Object.entries(f.compare_value).filter(([, value]) => {
|
|
102
|
+
return value !== null && value !== undefined;
|
|
103
|
+
});
|
|
104
|
+
return {
|
|
105
|
+
fieldFilter: {
|
|
106
|
+
field: { fieldPath: f.field },
|
|
107
|
+
op: f.op,
|
|
108
|
+
value: (0, converter_js_1.convertInputToValue)(out[0][1]),
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
}),
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
if (order) {
|
|
116
|
+
structuredQuery.orderBy = [
|
|
117
|
+
{
|
|
118
|
+
field: { fieldPath: order.orderBy },
|
|
119
|
+
direction: order.orderByDirection,
|
|
120
|
+
},
|
|
121
|
+
];
|
|
122
|
+
}
|
|
123
|
+
structuredQuery.limit = limit ? limit : 10;
|
|
124
|
+
let emulatorUrl;
|
|
125
|
+
if (use_emulator) {
|
|
126
|
+
emulatorUrl = await host.getEmulatorUrl(types_js_1.Emulators.FIRESTORE);
|
|
127
|
+
}
|
|
128
|
+
const { documents } = await (0, firestore_js_1.queryCollection)(projectId, structuredQuery, database, emulatorUrl);
|
|
129
|
+
const docs = documents.map(converter_js_1.firestoreDocumentToJson);
|
|
130
|
+
const docsContent = (0, util_js_1.toContent)(docs);
|
|
131
|
+
return docsContent;
|
|
132
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.markdownDocsOfTools = exports.availableTools = void 0;
|
|
4
|
+
const index_js_1 = require("./auth/index.js");
|
|
5
|
+
const index_js_2 = require("./dataconnect/index.js");
|
|
6
|
+
const index_js_3 = require("./firestore/index.js");
|
|
7
|
+
const index_js_4 = require("./core/index.js");
|
|
8
|
+
const index_js_5 = require("./storage/index.js");
|
|
9
|
+
const index_js_6 = require("./messaging/index.js");
|
|
10
|
+
const index_js_7 = require("./remoteconfig/index.js");
|
|
11
|
+
const index_js_8 = require("./crashlytics/index.js");
|
|
12
|
+
const index_js_9 = require("./apphosting/index.js");
|
|
13
|
+
function availableTools(activeFeatures) {
|
|
14
|
+
const toolDefs = addFeaturePrefix("firebase", index_js_4.coreTools);
|
|
15
|
+
if (!activeFeatures?.length) {
|
|
16
|
+
activeFeatures = Object.keys(tools);
|
|
17
|
+
}
|
|
18
|
+
for (const key of activeFeatures) {
|
|
19
|
+
toolDefs.push(...tools[key]);
|
|
20
|
+
}
|
|
21
|
+
return toolDefs;
|
|
22
|
+
}
|
|
23
|
+
exports.availableTools = availableTools;
|
|
24
|
+
const tools = {
|
|
25
|
+
firestore: addFeaturePrefix("firestore", index_js_3.firestoreTools),
|
|
26
|
+
auth: addFeaturePrefix("auth", index_js_1.authTools),
|
|
27
|
+
dataconnect: addFeaturePrefix("dataconnect", index_js_2.dataconnectTools),
|
|
28
|
+
storage: addFeaturePrefix("storage", index_js_5.storageTools),
|
|
29
|
+
messaging: addFeaturePrefix("messaging", index_js_6.messagingTools),
|
|
30
|
+
remoteconfig: addFeaturePrefix("remoteconfig", index_js_7.remoteConfigTools),
|
|
31
|
+
crashlytics: addFeaturePrefix("crashlytics", index_js_8.crashlyticsTools),
|
|
32
|
+
apphosting: addFeaturePrefix("apphosting", index_js_9.appHostingTools),
|
|
33
|
+
};
|
|
34
|
+
function addFeaturePrefix(feature, tools) {
|
|
35
|
+
return tools.map((tool) => ({
|
|
36
|
+
...tool,
|
|
37
|
+
mcp: {
|
|
38
|
+
...tool.mcp,
|
|
39
|
+
name: `${feature}_${tool.mcp.name}`,
|
|
40
|
+
_meta: {
|
|
41
|
+
...tool.mcp._meta,
|
|
42
|
+
feature,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
function markdownDocsOfTools() {
|
|
48
|
+
const allTools = availableTools([]);
|
|
49
|
+
let doc = `
|
|
50
|
+
| Tool Name | Feature Group | Description |
|
|
51
|
+
| --------- | ------------- | ----------- |`;
|
|
52
|
+
for (const tool of allTools) {
|
|
53
|
+
let feature = tool.mcp?._meta?.feature || "";
|
|
54
|
+
if (feature === "firebase") {
|
|
55
|
+
feature = "core";
|
|
56
|
+
}
|
|
57
|
+
doc += `
|
|
58
|
+
| ${tool.mcp.name} | ${feature} | ${tool.mcp?.description || ""} |`;
|
|
59
|
+
}
|
|
60
|
+
return doc;
|
|
61
|
+
}
|
|
62
|
+
exports.markdownDocsOfTools = markdownDocsOfTools;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.send_message = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const tool_js_1 = require("../../tool.js");
|
|
6
|
+
const util_js_1 = require("../../util.js");
|
|
7
|
+
const sendMessage_js_1 = require("../../../messaging/sendMessage.js");
|
|
8
|
+
exports.send_message = (0, tool_js_1.tool)({
|
|
9
|
+
name: "send_message",
|
|
10
|
+
description: "Sends a message to a Firebase Cloud Messaging registration token or topic. ONLY ONE of `registration_token` or `topic` may be supplied in a specific call.",
|
|
11
|
+
inputSchema: zod_1.z.object({
|
|
12
|
+
registration_token: zod_1.z
|
|
13
|
+
.string()
|
|
14
|
+
.optional()
|
|
15
|
+
.describe("A specific device registration token for delivery. Supply either this or topic."),
|
|
16
|
+
topic: zod_1.z
|
|
17
|
+
.string()
|
|
18
|
+
.optional()
|
|
19
|
+
.describe("A topic name for delivery. Supply either this or registration_token."),
|
|
20
|
+
title: zod_1.z.string().optional().describe("The title of the push notification message."),
|
|
21
|
+
body: zod_1.z.string().optional().describe("The body of the push notification message."),
|
|
22
|
+
image: zod_1.z
|
|
23
|
+
.string()
|
|
24
|
+
.optional()
|
|
25
|
+
.describe("The URL of an image that will be displayed with the notification. JPEG, PNG, BMP have full support across platforms. Animated GIF and video only work on iOS. WebP and HEIF have varying levels of support across platforms and platform versions."),
|
|
26
|
+
}),
|
|
27
|
+
annotations: {
|
|
28
|
+
title: "Send FCM Message",
|
|
29
|
+
},
|
|
30
|
+
_meta: {
|
|
31
|
+
requiresAuth: true,
|
|
32
|
+
requiresProject: true,
|
|
33
|
+
},
|
|
34
|
+
}, async ({ registration_token, topic, title, body }, { projectId }) => {
|
|
35
|
+
if (!registration_token && !topic) {
|
|
36
|
+
return (0, util_js_1.mcpError)("Must supply either a `registration_token` or `topic` parameter to `send_message`.");
|
|
37
|
+
}
|
|
38
|
+
if (registration_token && topic) {
|
|
39
|
+
return (0, util_js_1.mcpError)("Cannot supply both `registration_token` and `topic` in a single `send_message` request.");
|
|
40
|
+
}
|
|
41
|
+
return (0, util_js_1.toContent)(await (0, sendMessage_js_1.sendFcmMessage)(projectId, { token: registration_token, topic, title, body }));
|
|
42
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.get_template = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const tool_js_1 = require("../../tool.js");
|
|
6
|
+
const util_js_1 = require("../../util.js");
|
|
7
|
+
const get_js_1 = require("../../../remoteconfig/get.js");
|
|
8
|
+
exports.get_template = (0, tool_js_1.tool)({
|
|
9
|
+
name: "get_template",
|
|
10
|
+
description: "Retrieves a remote config template for the project",
|
|
11
|
+
inputSchema: zod_1.z.object({
|
|
12
|
+
version_number: zod_1.z
|
|
13
|
+
.string()
|
|
14
|
+
.optional()
|
|
15
|
+
.describe("The version number of the template to retrieve. If not provided, retrieves the active template."),
|
|
16
|
+
}),
|
|
17
|
+
annotations: {
|
|
18
|
+
title: "Get Remote Config template",
|
|
19
|
+
readOnlyHint: true,
|
|
20
|
+
},
|
|
21
|
+
_meta: {
|
|
22
|
+
requiresAuth: true,
|
|
23
|
+
requiresProject: true,
|
|
24
|
+
},
|
|
25
|
+
}, async ({ version_number }, { projectId }) => {
|
|
26
|
+
return (0, util_js_1.toContent)(await (0, get_js_1.getTemplate)(projectId, version_number));
|
|
27
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.remoteConfigTools = void 0;
|
|
4
|
+
const get_template_js_1 = require("./get_template.js");
|
|
5
|
+
const rollback_template_js_1 = require("./rollback_template.js");
|
|
6
|
+
const publish_template_js_1 = require("./publish_template.js");
|
|
7
|
+
exports.remoteConfigTools = [get_template_js_1.get_template, publish_template_js_1.publish_template, rollback_template_js_1.rollback_template];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.publish_template = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const tool_js_1 = require("../../tool.js");
|
|
6
|
+
const util_js_1 = require("../../util.js");
|
|
7
|
+
const publish_js_1 = require("../../../remoteconfig/publish.js");
|
|
8
|
+
exports.publish_template = (0, tool_js_1.tool)({
|
|
9
|
+
name: "publish_template",
|
|
10
|
+
description: "Publishes a new remote config template for the project",
|
|
11
|
+
inputSchema: zod_1.z.object({
|
|
12
|
+
template: zod_1.z.object({}).describe("The Remote Config template object to publish."),
|
|
13
|
+
force: zod_1.z
|
|
14
|
+
.boolean()
|
|
15
|
+
.optional()
|
|
16
|
+
.describe("If true, the publish will bypass ETag validation and overwrite the current template. Defaults to false if not provided."),
|
|
17
|
+
}),
|
|
18
|
+
annotations: {
|
|
19
|
+
title: "Publish Remote Config template",
|
|
20
|
+
readOnlyHint: false,
|
|
21
|
+
},
|
|
22
|
+
_meta: {
|
|
23
|
+
requiresAuth: true,
|
|
24
|
+
requiresProject: true,
|
|
25
|
+
},
|
|
26
|
+
}, async ({ template, force }, { projectId }) => {
|
|
27
|
+
if (template === undefined) {
|
|
28
|
+
return (0, util_js_1.mcpError)(`No template specified in the publish requests`);
|
|
29
|
+
}
|
|
30
|
+
if (force === undefined) {
|
|
31
|
+
return (0, util_js_1.toContent)(await (0, publish_js_1.publishTemplate)(projectId, template));
|
|
32
|
+
}
|
|
33
|
+
return (0, util_js_1.toContent)(await (0, publish_js_1.publishTemplate)(projectId, template, { force }));
|
|
34
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rollback_template = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const tool_js_1 = require("../../tool.js");
|
|
6
|
+
const util_js_1 = require("../../util.js");
|
|
7
|
+
const rollback_js_1 = require("../../../remoteconfig/rollback.js");
|
|
8
|
+
exports.rollback_template = (0, tool_js_1.tool)({
|
|
9
|
+
name: "rollback_template",
|
|
10
|
+
description: "Rollback to a specific version of Remote Config template for a project",
|
|
11
|
+
inputSchema: zod_1.z.object({
|
|
12
|
+
version_number: zod_1.z
|
|
13
|
+
.number()
|
|
14
|
+
.describe("The version number to roll back to. This field is required."),
|
|
15
|
+
}),
|
|
16
|
+
annotations: {
|
|
17
|
+
title: "Rollback remote config template",
|
|
18
|
+
readOnlyHint: false,
|
|
19
|
+
},
|
|
20
|
+
_meta: {
|
|
21
|
+
requiresAuth: true,
|
|
22
|
+
requiresProject: true,
|
|
23
|
+
},
|
|
24
|
+
}, async ({ version_number }, { projectId }) => {
|
|
25
|
+
if (version_number === undefined) {
|
|
26
|
+
return (0, util_js_1.mcpError)(`No version number specified in the rollback requests`);
|
|
27
|
+
}
|
|
28
|
+
return (0, util_js_1.toContent)(await (0, rollback_js_1.rollbackTemplate)(projectId, version_number));
|
|
29
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRulesTool = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const tool_js_1 = require("../../tool.js");
|
|
6
|
+
const util_js_1 = require("../../util.js");
|
|
7
|
+
const rules_js_1 = require("../../../gcp/rules.js");
|
|
8
|
+
function getRulesTool(productName, releaseName) {
|
|
9
|
+
return (0, tool_js_1.tool)({
|
|
10
|
+
name: "get_rules",
|
|
11
|
+
description: `Retrieves the active ${productName} security rules for the current project.`,
|
|
12
|
+
inputSchema: zod_1.z.object({}),
|
|
13
|
+
annotations: {
|
|
14
|
+
title: `Get Current ${productName} Rules`,
|
|
15
|
+
readOnlyHint: true,
|
|
16
|
+
},
|
|
17
|
+
_meta: {
|
|
18
|
+
requiresProject: true,
|
|
19
|
+
requiresAuth: true,
|
|
20
|
+
},
|
|
21
|
+
}, async (_, { projectId }) => {
|
|
22
|
+
const rulesetName = await (0, rules_js_1.getLatestRulesetName)(projectId, releaseName);
|
|
23
|
+
if (!rulesetName)
|
|
24
|
+
return (0, util_js_1.mcpError)(`No active Firestore rules were found in project '${projectId}'`);
|
|
25
|
+
const rules = await (0, rules_js_1.getRulesetContent)(rulesetName);
|
|
26
|
+
return (0, util_js_1.toContent)(rules[0].content);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
exports.getRulesTool = getRulesTool;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateRulesTool = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const tool_js_1 = require("../../tool.js");
|
|
6
|
+
const util_js_1 = require("../../util.js");
|
|
7
|
+
const rules_js_1 = require("../../../gcp/rules.js");
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
function formatRulesetIssues(issues, rulesSource) {
|
|
10
|
+
const sourceLines = rulesSource.split("\n");
|
|
11
|
+
const formattedOutput = [];
|
|
12
|
+
for (const issue of issues) {
|
|
13
|
+
const { sourcePosition, description, severity } = issue;
|
|
14
|
+
let issueString = `${severity}: ${description} [Ln ${sourcePosition.line}, Col ${sourcePosition.column}]`;
|
|
15
|
+
if (sourcePosition.line) {
|
|
16
|
+
const lineIndex = sourcePosition.line - 1;
|
|
17
|
+
if (lineIndex >= 0 && lineIndex < sourceLines.length) {
|
|
18
|
+
const errorLine = sourceLines[lineIndex];
|
|
19
|
+
issueString += `\n\`\`\`\n${errorLine}`;
|
|
20
|
+
if (sourcePosition.column &&
|
|
21
|
+
sourcePosition.currentOffset &&
|
|
22
|
+
sourcePosition.endOffset &&
|
|
23
|
+
sourcePosition.column > 0 &&
|
|
24
|
+
sourcePosition.endOffset > sourcePosition.currentOffset) {
|
|
25
|
+
const startColumnOnLine = sourcePosition.column - 1;
|
|
26
|
+
const errorTokenLength = sourcePosition.endOffset - sourcePosition.currentOffset;
|
|
27
|
+
if (startColumnOnLine >= 0 &&
|
|
28
|
+
errorTokenLength > 0 &&
|
|
29
|
+
startColumnOnLine <= errorLine.length) {
|
|
30
|
+
const padding = " ".repeat(startColumnOnLine);
|
|
31
|
+
const carets = "^".repeat(errorTokenLength);
|
|
32
|
+
issueString += `\n${padding}${carets}\n\`\`\``;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
formattedOutput.push(issueString);
|
|
38
|
+
}
|
|
39
|
+
return formattedOutput.join("\n\n");
|
|
40
|
+
}
|
|
41
|
+
function validateRulesTool(productName) {
|
|
42
|
+
return (0, tool_js_1.tool)({
|
|
43
|
+
name: "validate_rules",
|
|
44
|
+
description: `Checks the provided ${productName} Rules source for syntax and validation errors. Provide EITHER the source code to validate OR a path to a source file.`,
|
|
45
|
+
inputSchema: zod_1.z.object({
|
|
46
|
+
source: zod_1.z
|
|
47
|
+
.string()
|
|
48
|
+
.optional()
|
|
49
|
+
.describe("the rules source code to check. provide either this OR a path"),
|
|
50
|
+
source_file: zod_1.z
|
|
51
|
+
.string()
|
|
52
|
+
.optional()
|
|
53
|
+
.describe("a file path, relative to the project root, to a file containing the rules source you want to validate. provide this OR source, not both"),
|
|
54
|
+
}),
|
|
55
|
+
annotations: {
|
|
56
|
+
title: `Validate ${productName} Rules`,
|
|
57
|
+
readOnlyHint: true,
|
|
58
|
+
},
|
|
59
|
+
_meta: {
|
|
60
|
+
requiresProject: true,
|
|
61
|
+
requiresAuth: true,
|
|
62
|
+
},
|
|
63
|
+
}, async ({ source, source_file }, { projectId, config, host }) => {
|
|
64
|
+
if (source && source_file) {
|
|
65
|
+
return (0, util_js_1.mcpError)("Must supply `source` or `source_file`, not both.");
|
|
66
|
+
}
|
|
67
|
+
let rulesSourceContent;
|
|
68
|
+
if (source_file) {
|
|
69
|
+
try {
|
|
70
|
+
const filePath = (0, path_1.resolve)(source_file, host.cachedProjectRoot);
|
|
71
|
+
if (filePath.includes("../"))
|
|
72
|
+
return (0, util_js_1.mcpError)("Cannot read files outside of the project directory.");
|
|
73
|
+
rulesSourceContent = config.readProjectFile(source_file);
|
|
74
|
+
}
|
|
75
|
+
catch (e) {
|
|
76
|
+
return (0, util_js_1.mcpError)(`Failed to read source_file '${source_file}': ${e.message}`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
else if (source) {
|
|
80
|
+
rulesSourceContent = source;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
rulesSourceContent = "";
|
|
84
|
+
}
|
|
85
|
+
const result = await (0, rules_js_1.testRuleset)(projectId, [
|
|
86
|
+
{ name: "test.rules", content: rulesSourceContent },
|
|
87
|
+
]);
|
|
88
|
+
if (result.body?.issues?.length) {
|
|
89
|
+
const issues = result.body.issues;
|
|
90
|
+
let out = `Found ${issues.length} issues in rules source:\n\n`;
|
|
91
|
+
out += formatRulesetIssues(issues, rulesSourceContent);
|
|
92
|
+
return (0, util_js_1.toContent)(out);
|
|
93
|
+
}
|
|
94
|
+
return (0, util_js_1.toContent)("OK: No errors detected.");
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
exports.validateRulesTool = validateRulesTool;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.get_object_download_url = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const tool_js_1 = require("../../tool.js");
|
|
6
|
+
const util_js_1 = require("../../util.js");
|
|
7
|
+
const storage_js_1 = require("../../../gcp/storage.js");
|
|
8
|
+
const types_js_1 = require("../../../emulator/types.js");
|
|
9
|
+
exports.get_object_download_url = (0, tool_js_1.tool)({
|
|
10
|
+
name: "get_object_download_url",
|
|
11
|
+
description: "Retrieves the download URL for an object in Firebase Storage.",
|
|
12
|
+
inputSchema: zod_1.z.object({
|
|
13
|
+
bucket: zod_1.z
|
|
14
|
+
.string()
|
|
15
|
+
.optional()
|
|
16
|
+
.describe("The bucket name in Firebase Storage. If not provided, defaults to the project's default bucket (e.g., `{projectid}.firebasestorage.app`)."),
|
|
17
|
+
object_path: zod_1.z
|
|
18
|
+
.string()
|
|
19
|
+
.describe("The path to the object in Firebase storage without the bucket name attached"),
|
|
20
|
+
use_emulator: zod_1.z.boolean().default(false).describe("Target the Storage emulator if true."),
|
|
21
|
+
}),
|
|
22
|
+
annotations: {
|
|
23
|
+
title: "Get Storage Object Download URL",
|
|
24
|
+
readOnlyHint: true,
|
|
25
|
+
},
|
|
26
|
+
_meta: {
|
|
27
|
+
requiresProject: true,
|
|
28
|
+
requiresAuth: true,
|
|
29
|
+
},
|
|
30
|
+
}, async ({ bucket, object_path, use_emulator }, { projectId, host }) => {
|
|
31
|
+
if (!bucket) {
|
|
32
|
+
bucket = `${projectId}.firebasestorage.app`;
|
|
33
|
+
}
|
|
34
|
+
let emulatorUrl;
|
|
35
|
+
if (use_emulator) {
|
|
36
|
+
emulatorUrl = await host.getEmulatorUrl(types_js_1.Emulators.STORAGE);
|
|
37
|
+
}
|
|
38
|
+
const downloadUrl = await (0, storage_js_1.getDownloadUrl)(bucket, object_path, emulatorUrl);
|
|
39
|
+
return (0, util_js_1.toContent)(downloadUrl);
|
|
40
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.get_rules = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const tool_js_1 = require("../../tool.js");
|
|
6
|
+
const util_js_1 = require("../../util.js");
|
|
7
|
+
const rules_js_1 = require("../../../gcp/rules.js");
|
|
8
|
+
exports.get_rules = (0, tool_js_1.tool)({
|
|
9
|
+
name: "get_rules",
|
|
10
|
+
description: "Retrieves the Firebase Cloud Storage Rules for the default bucket.",
|
|
11
|
+
inputSchema: zod_1.z.object({}),
|
|
12
|
+
annotations: {
|
|
13
|
+
title: "Get Current Firebase Cloud Storage Rules",
|
|
14
|
+
readOnlyHint: true,
|
|
15
|
+
},
|
|
16
|
+
_meta: {
|
|
17
|
+
requiresProject: true,
|
|
18
|
+
requiresAuth: true,
|
|
19
|
+
},
|
|
20
|
+
}, async (_, { projectId }) => {
|
|
21
|
+
const rulesetName = await (0, rules_js_1.getLatestRulesetName)(projectId, "firebase.storage");
|
|
22
|
+
if (!rulesetName)
|
|
23
|
+
return (0, util_js_1.mcpError)(`No active Firebase Storage rules were found in project '${projectId}'`);
|
|
24
|
+
const rules = await (0, rules_js_1.getRulesetContent)(rulesetName);
|
|
25
|
+
return (0, util_js_1.toContent)(rules[0].content);
|
|
26
|
+
});
|