firebase-tools-with-isolate 14.10.1 → 14.16.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/lib/api.js +5 -1
- package/lib/apphosting/backend.js +40 -15
- package/lib/apptesting/ensureProjectConfigured.js +56 -0
- package/lib/apptesting/invokeTests.js +40 -0
- package/lib/apptesting/parseTestFiles.js +75 -0
- package/lib/apptesting/types.js +18 -0
- package/lib/auth.js +37 -2
- package/lib/command.js +24 -5
- package/lib/commands/apphosting-backends-create.js +8 -5
- package/lib/commands/apptesting-execute.js +101 -0
- package/lib/commands/dataconnect-sdk-generate.js +28 -26
- package/lib/commands/dataconnect-services-list.js +1 -1
- package/lib/commands/dataconnect-sql-diff.js +2 -2
- package/lib/commands/dataconnect-sql-grant.js +7 -2
- package/lib/commands/dataconnect-sql-migrate.js +2 -2
- package/lib/commands/dataconnect-sql-setup.js +3 -5
- package/lib/commands/dataconnect-sql-shell.js +2 -2
- package/lib/commands/ext-export.js +1 -1
- package/lib/commands/firestore-bulkdelete.js +73 -0
- package/lib/commands/firestore-databases-create.js +11 -0
- package/lib/commands/firestore-operations-cancel.js +44 -0
- package/lib/commands/firestore-operations-describe.js +29 -0
- package/lib/commands/firestore-operations-list.js +29 -0
- package/lib/commands/firestore-utils.js +15 -0
- package/lib/commands/functions-config-clone.js +2 -0
- package/lib/commands/functions-config-export.js +5 -2
- package/lib/commands/functions-config-get.js +2 -0
- package/lib/commands/functions-config-set.js +2 -0
- package/lib/commands/functions-config-unset.js +2 -0
- package/lib/commands/index.js +9 -0
- package/lib/commands/init.js +24 -4
- package/lib/commands/internaltesting-functions-discover.js +20 -5
- package/lib/commands/login.js +13 -9
- package/lib/commands/use.js +5 -0
- package/lib/config.js +16 -4
- package/lib/crashlytics/addNote.js +27 -0
- package/lib/crashlytics/buildToolsJarHelper.js +1 -2
- package/lib/crashlytics/deleteNote.js +23 -0
- package/lib/crashlytics/getIssueDetails.js +26 -0
- package/lib/crashlytics/getSampleCrash.js +34 -0
- package/lib/crashlytics/listNotes.js +29 -0
- package/lib/crashlytics/listTopDevices.js +33 -0
- package/lib/crashlytics/listTopIssues.js +8 -23
- package/lib/crashlytics/listTopOperatingSystems.js +32 -0
- package/lib/crashlytics/listTopVersions.js +32 -0
- package/lib/crashlytics/updateIssue.js +35 -0
- package/lib/crashlytics/utils.js +38 -0
- package/lib/dataconnect/appFinder.js +102 -0
- package/lib/dataconnect/client.js +23 -15
- package/lib/dataconnect/ensureApis.js +6 -9
- package/lib/dataconnect/errors.js +7 -1
- package/lib/dataconnect/freeTrial.js +16 -38
- package/lib/dataconnect/load.js +105 -6
- package/lib/dataconnect/provisionCloudSql.js +67 -70
- package/lib/dataconnect/schemaMigration.js +219 -169
- package/lib/deploy/dataconnect/deploy.js +7 -9
- package/lib/deploy/dataconnect/prepare.js +7 -12
- package/lib/deploy/dataconnect/release.js +43 -31
- package/lib/deploy/firestore/deploy.js +10 -0
- package/lib/deploy/functions/backend.js +7 -1
- package/lib/deploy/functions/build.js +28 -14
- package/lib/deploy/functions/deploy.js +3 -2
- package/lib/deploy/functions/ensure.js +1 -1
- package/lib/deploy/functions/functionsDeployHelper.js +8 -1
- package/lib/deploy/functions/params.js +4 -0
- package/lib/deploy/functions/prepare.js +25 -13
- package/lib/deploy/functions/pricing.js +12 -5
- package/lib/deploy/functions/release/fabricator.js +25 -3
- package/lib/deploy/functions/release/reporter.js +1 -0
- package/lib/deploy/functions/runtimes/discovery/index.js +52 -5
- package/lib/deploy/functions/runtimes/node/index.js +83 -51
- package/lib/emulator/auth/operations.js +10 -1
- package/lib/emulator/commandUtils.js +7 -1
- package/lib/emulator/controller.js +22 -34
- package/lib/emulator/dataconnectEmulator.js +27 -24
- package/lib/emulator/downloadableEmulatorInfo.json +18 -18
- package/lib/emulator/env.js +2 -1
- package/lib/emulator/functionsEmulator.js +12 -2
- package/lib/emulator/hub.js +11 -8
- package/lib/emulator/tasksEmulator.js +1 -1
- package/lib/emulator/ui.js +3 -1
- package/lib/env.js +18 -0
- package/lib/experiments.js +20 -0
- package/lib/extensions/extensionsHelper.js +4 -15
- package/lib/extensions/runtimes/common.js +3 -2
- package/lib/extensions/utils.js +1 -12
- package/lib/firestore/api-sort.js +96 -3
- package/lib/firestore/api-types.js +20 -1
- package/lib/firestore/api.js +144 -15
- package/lib/firestore/pretty-print.js +35 -1
- package/lib/firestore/validator.js +1 -1
- package/lib/functional.js +7 -1
- package/lib/functions/deprecationWarnings.js +21 -0
- package/lib/functions/env.js +31 -16
- package/lib/functions/projectConfig.js +87 -8
- package/lib/functions/secrets.js +3 -0
- package/lib/gcp/cloudfunctions.js +1 -6
- package/lib/gcp/cloudfunctionsv2.js +3 -39
- package/lib/gcp/cloudscheduler.js +1 -1
- package/lib/gcp/cloudsql/cloudsqladmin.js +4 -16
- package/lib/gcp/cloudsql/connect.js +4 -3
- package/lib/gcp/cloudsql/permissionsSetup.js +23 -16
- package/lib/gcp/k8s.js +32 -0
- package/lib/gcp/runv2.js +181 -0
- package/lib/gemini/fdcExperience.js +5 -3
- package/lib/init/features/aitools/claude.js +43 -0
- package/lib/init/features/aitools/cursor.js +61 -0
- package/lib/init/features/aitools/gemini.js +58 -0
- package/lib/init/features/aitools/index.js +28 -0
- package/lib/init/features/aitools/promptUpdater.js +111 -0
- package/lib/init/features/aitools/studio.js +17 -0
- package/lib/init/features/aitools/types.js +2 -0
- package/lib/init/features/aitools.js +83 -0
- package/lib/init/features/apptesting/index.js +34 -0
- package/lib/init/features/dataconnect/create_app.js +53 -0
- package/lib/init/features/dataconnect/index.js +280 -186
- package/lib/init/features/dataconnect/sdk.js +232 -144
- package/lib/init/features/index.js +8 -3
- package/lib/init/features/project.js +4 -0
- package/lib/init/index.js +18 -2
- package/lib/management/apps.js +3 -3
- package/lib/management/studio.js +120 -0
- package/lib/mcp/errors.js +5 -7
- package/lib/mcp/index.js +179 -61
- package/lib/mcp/logging-transport.js +23 -0
- package/lib/mcp/prompt.js +10 -0
- package/lib/mcp/prompts/core/deploy.js +101 -0
- package/lib/mcp/prompts/core/index.js +5 -0
- package/lib/mcp/prompts/crashlytics/connect.js +114 -0
- package/lib/mcp/prompts/crashlytics/index.js +5 -0
- package/lib/mcp/prompts/dataconnect/index.js +9 -0
- package/lib/mcp/prompts/dataconnect/schema.js +67 -0
- package/lib/mcp/prompts/index.js +47 -0
- package/lib/mcp/tools/apphosting/fetch_logs.js +22 -22
- package/lib/mcp/tools/apphosting/list_backends.js +10 -10
- package/lib/mcp/tools/auth/disable_user.js +7 -7
- package/lib/mcp/tools/auth/get_user.js +13 -6
- package/lib/mcp/tools/auth/index.js +10 -10
- package/lib/mcp/tools/auth/list_users.js +6 -6
- package/lib/mcp/tools/auth/set_claims.js +7 -7
- package/lib/mcp/tools/auth/set_sms_region_policy.js +6 -6
- package/lib/mcp/tools/core/consult_assistant.js +13 -8
- package/lib/mcp/tools/core/create_android_sha.js +9 -9
- package/lib/mcp/tools/core/create_app.js +7 -7
- package/lib/mcp/tools/core/create_project.js +13 -13
- package/lib/mcp/tools/core/get_admin_sdk_config.js +7 -7
- package/lib/mcp/tools/core/get_environment.js +8 -8
- package/lib/mcp/tools/core/get_project.js +5 -5
- package/lib/mcp/tools/core/get_sdk_config.js +19 -9
- package/lib/mcp/tools/core/index.js +28 -24
- package/lib/mcp/tools/core/init.js +39 -16
- package/lib/mcp/tools/core/list_apps.js +6 -6
- package/lib/mcp/tools/core/list_projects.js +6 -6
- package/lib/mcp/tools/core/login.js +46 -0
- package/lib/mcp/tools/core/logout.js +62 -0
- package/lib/mcp/tools/core/update_environment.js +10 -10
- package/lib/mcp/tools/crashlytics/add_note.js +32 -0
- package/lib/mcp/tools/crashlytics/constants.js +11 -0
- package/lib/mcp/tools/crashlytics/delete_note.js +35 -0
- package/lib/mcp/tools/crashlytics/get_issue_details.js +31 -0
- package/lib/mcp/tools/crashlytics/get_sample_crash.js +43 -0
- package/lib/mcp/tools/crashlytics/index.js +22 -2
- package/lib/mcp/tools/crashlytics/list_notes.js +37 -0
- package/lib/mcp/tools/crashlytics/list_top_devices.js +33 -0
- package/lib/mcp/tools/crashlytics/list_top_issues.js +12 -13
- package/lib/mcp/tools/crashlytics/list_top_operating_systems.js +33 -0
- package/lib/mcp/tools/crashlytics/list_top_versions.js +33 -0
- package/lib/mcp/tools/crashlytics/update_issue.js +37 -0
- package/lib/mcp/tools/database/get_data.js +49 -0
- package/lib/mcp/tools/database/get_rules.js +39 -0
- package/lib/mcp/tools/database/index.js +8 -0
- package/lib/mcp/tools/database/set_data.js +57 -0
- package/lib/mcp/tools/database/validate_rules.js +41 -0
- package/lib/mcp/tools/dataconnect/compile.js +43 -0
- package/lib/mcp/tools/dataconnect/execute.js +71 -0
- package/lib/mcp/tools/dataconnect/generate_operation.js +8 -8
- package/lib/mcp/tools/dataconnect/generate_schema.js +6 -6
- package/lib/mcp/tools/dataconnect/index.js +10 -18
- package/lib/mcp/tools/dataconnect/list_services.js +107 -11
- package/lib/mcp/tools/firestore/delete_document.js +13 -13
- package/lib/mcp/tools/firestore/get_documents.js +13 -13
- package/lib/mcp/tools/firestore/list_collections.js +7 -10
- package/lib/mcp/tools/firestore/query_collection.js +13 -13
- package/lib/mcp/tools/index.js +24 -18
- package/lib/mcp/tools/messaging/index.js +2 -2
- package/lib/mcp/tools/messaging/send_message.js +7 -7
- package/lib/mcp/tools/remoteconfig/get_template.js +5 -5
- package/lib/mcp/tools/remoteconfig/index.js +4 -4
- package/lib/mcp/tools/remoteconfig/publish_template.js +7 -7
- package/lib/mcp/tools/remoteconfig/rollback_template.js +6 -6
- package/lib/mcp/tools/rules/get_rules.js +8 -8
- package/lib/mcp/tools/rules/validate_rules.js +10 -10
- package/lib/mcp/tools/storage/get_download_url.js +8 -8
- package/lib/mcp/tools/storage/get_rules.js +8 -8
- package/lib/mcp/types.js +2 -0
- package/lib/mcp/util/dataconnect/compile.js +20 -0
- package/lib/mcp/util/dataconnect/content.js +655 -0
- package/lib/mcp/util/dataconnect/emulator.js +16 -0
- package/lib/mcp/util.js +5 -18
- package/lib/requireAuth.js +14 -4
- package/lib/rtdb.js +10 -6
- package/lib/scopes.js +2 -1
- package/lib/serve/functions.js +4 -3
- package/lib/timeout.js +21 -0
- package/lib/track.js +18 -1
- package/lib/unzip.js +13 -0
- package/lib/utils.js +76 -2
- package/package.json +5 -3
- package/prompts/FIREBASE.md +121 -0
- package/prompts/FIREBASE_FUNCTIONS.md +221 -0
- package/schema/apptesting-yaml.json +64 -0
- package/schema/firebase-config.json +163 -53
- package/templates/init/aitools/cursor-rules-header.txt +8 -0
- package/templates/init/aitools/gemini-extension.json +11 -0
- package/templates/init/apptesting/smoke_test.yaml +6 -0
- package/templates/init/dataconnect/connector.yaml +0 -16
- package/templates/init/dataconnect/dataconnect.yaml +2 -1
- package/templates/init/dataconnect/mutations.gql +29 -29
- package/templates/init/dataconnect/queries.gql +73 -73
- package/templates/init/dataconnect/schema.gql +48 -48
- package/templates/init/firestore/firestore.indexes.json +26 -1
- package/lib/dataconnect/fileUtils.js +0 -168
- package/lib/emulator/adminSdkConfig.test.js +0 -16
- package/lib/extensions/resolveSource.js +0 -23
- package/lib/firestore/api-sort.test.js +0 -74
- package/lib/firestore/backupUtils.test.js +0 -18
- package/lib/firestore/pretty-print.test.js +0 -61
- package/lib/firestore/util.test.js +0 -42
- package/lib/mcp/tools/dataconnect/emulator.js +0 -16
- package/lib/mcp/tools/dataconnect/execute_graphql.js +0 -48
- package/lib/mcp/tools/dataconnect/execute_graphql_read.js +0 -48
- package/lib/mcp/tools/dataconnect/execute_mutation.js +0 -62
- package/lib/mcp/tools/dataconnect/execute_query.js +0 -62
- package/lib/mcp/tools/dataconnect/get_connector.js +0 -31
- package/lib/mcp/tools/dataconnect/get_schema.js +0 -31
- /package/lib/mcp/{tools → util}/dataconnect/converter.js +0 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deploy = void 0;
|
|
4
|
+
const prompt_1 = require("../../prompt");
|
|
5
|
+
exports.deploy = (0, prompt_1.prompt)({
|
|
6
|
+
name: "deploy",
|
|
7
|
+
omitPrefix: true,
|
|
8
|
+
description: "Use this command to deploy resources to Firebase.",
|
|
9
|
+
arguments: [
|
|
10
|
+
{
|
|
11
|
+
name: "prompt",
|
|
12
|
+
description: "any specific instructions you wish to provide about deploying",
|
|
13
|
+
required: false,
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
annotations: {
|
|
17
|
+
title: "Deploy to Firebase",
|
|
18
|
+
},
|
|
19
|
+
}, async ({ prompt }, { config, projectId, accountEmail }) => {
|
|
20
|
+
return [
|
|
21
|
+
{
|
|
22
|
+
role: "user",
|
|
23
|
+
content: {
|
|
24
|
+
type: "text",
|
|
25
|
+
text: `
|
|
26
|
+
Your goal is to deploy resources from the current project to Firebase.
|
|
27
|
+
|
|
28
|
+
Active user: ${accountEmail || "<NONE>"}
|
|
29
|
+
Active project: ${projectId || "<NONE>"}
|
|
30
|
+
|
|
31
|
+
Contents of \`firebase.json\` config file:
|
|
32
|
+
|
|
33
|
+
\`\`\`json
|
|
34
|
+
${config.readProjectFile("firebase.json", { fallback: "<FILE DOES NOT EXIST>" })}
|
|
35
|
+
\`\`\`
|
|
36
|
+
|
|
37
|
+
## User Instructions
|
|
38
|
+
|
|
39
|
+
${prompt || "<the user didn't supply specific instructions>"}
|
|
40
|
+
|
|
41
|
+
## Steps
|
|
42
|
+
|
|
43
|
+
Follow the steps below taking note of any user instructions provided above.
|
|
44
|
+
|
|
45
|
+
1. If there is no active user, prompt the user to run \`firebase login\` in an interactive terminal before continuing.
|
|
46
|
+
2. Analyze the source code in the current working directory to determine if this is a web app. If it isn't, end this process and tell the user "The /deploy command only works with web apps."
|
|
47
|
+
3. Analyze the source code in the current working directory to determine if the app requires a server for Server-Side Rendering (SSR). This will determine whether or not to use Firebase App Hosting. Here are instructions to determine if the app needs a server:
|
|
48
|
+
Objective: Analyze the provided codebase files to determine if the web application requires a backend for Server-Side Rendering (SSR). Your final output must be a clear "Yes" or "No" followed by a brief justification.
|
|
49
|
+
Primary Analysis: package.json
|
|
50
|
+
This is the most critical step. If the package.json file is present, perform the following checks in order.
|
|
51
|
+
Parse package.json: Locate and read the contents of the package.json file.
|
|
52
|
+
Check Dependencies:
|
|
53
|
+
Examine the dependencies and devDependencies objects.
|
|
54
|
+
If any of the following packages are listed as keys, you can conclude the app uses SSR.
|
|
55
|
+
next
|
|
56
|
+
nuxt
|
|
57
|
+
@sveltejs/kit
|
|
58
|
+
@angular/ssr
|
|
59
|
+
remix
|
|
60
|
+
If a match is found, proceed directly to the Final Determination step.
|
|
61
|
+
Check Scripts: If no framework dependency was found, examine the scripts object.
|
|
62
|
+
Look for scripts (commonly start or serve) that execute a server process.
|
|
63
|
+
Examples include: "start": "next start", "start": "nuxt start", or "dev": "ng serve --ssr".
|
|
64
|
+
If such a script is found, conclude the app uses SSR and proceed to the Final Determination step.
|
|
65
|
+
Secondary Analysis: Project File Structure
|
|
66
|
+
Perform this analysis only if package.json is missing or inconclusive.
|
|
67
|
+
Scan for Framework-Specific Files and Directories: Search the codebase for the following patterns:
|
|
68
|
+
Next.js: A directory named app/ or pages/. Inside these, check for files containing the function name getServerSideProps.
|
|
69
|
+
Nuxt.js: A directory named server/.
|
|
70
|
+
SvelteKit: Any file ending with the .server.js suffix (e.g., +page.server.js, +layout.server.js).
|
|
71
|
+
Angular: A file named server.ts.
|
|
72
|
+
If any of these patterns are found, conclude the app uses SSR.
|
|
73
|
+
Final Determination
|
|
74
|
+
State Your Conclusion: Begin your response with a definitive "Yes" or "No".
|
|
75
|
+
Yes: The application requires a backend for SSR.
|
|
76
|
+
No: The application does not appear to require a backend for SSR and is likely a static or client-side rendered app.
|
|
77
|
+
Provide Justification: Follow your conclusion with a single sentence explaining the evidence.
|
|
78
|
+
Example (Yes): "Yes, the project requires SSR, as evidenced by the next dependency in package.json."
|
|
79
|
+
Example (Yes): "Yes, the project requires SSR, as evidenced by the presence of a +page.server.js file."
|
|
80
|
+
Example (No): "No, there are no dependencies or file structures that indicate the use of a server-side rendering framework."
|
|
81
|
+
4. If there is no \`firebase.json\` file, manually create one based on whether the app requires SSR:
|
|
82
|
+
4a. If the app requires SSR, configure Firebase App Hosting:
|
|
83
|
+
Create \`firebase.json\ with an "apphosting" configuration, setting backendId to the app's name in package.json: \`{"apphosting": {"backendId": "<backendId>"}}\
|
|
84
|
+
4b. If the app does NOT require SSR, configure Firebase Hosting:
|
|
85
|
+
Create \`firebase.json\ with a "hosting" configuration. Add a \`{"hosting": {"predeploy": "<build_script>"}}\` config to build before deploying.
|
|
86
|
+
5. Check if there is an active Firebase project for this environment (the \`firebase_get_environment\` tool may be helpful). If there is, provide the active project ID to the user and ask them if they want to proceed using that project. If there is not an active project, give the user two options: Provide an existing project ID or create a new project. Only use the list_projects tool on user request. Wait for their response before proceeding.
|
|
87
|
+
5a. If the user chooses to use an existing Firebase project, the \`firebase_list_projects\` tool may be helpful. Set the selected project as the active project (the \`firebase_update_environment\` tool may be helpful).
|
|
88
|
+
5b. If the user chooses to create a new project, use the \`firebase_create_project \` tool. Then set the new project as the active project (the \`firebase_update_environment\` tool may be helpful).
|
|
89
|
+
6. If firebase.json contains an "apphosting" configuration, check if a backend exists matching the provided backendId (the \`apphosting_list_backends\` tool may be helpful).
|
|
90
|
+
If it doesn't exist, create one by running the \`firebase apphosting:backends:create --backend <backendId> --primary-region us-central1 --root-dir .\` shell.
|
|
91
|
+
7. Only after making sure Firebase has been initialized, run the \`firebase deploy\` shell command to perform the deploy. This may take a few minutes.
|
|
92
|
+
7a. If deploying to apphosting, tell the user the deployment will take a few minutes, and they can monitor deployment progress in the Firebase console: \`https://console.firebase.google.com/project/<projectId>/apphosting\`
|
|
93
|
+
8. If the deploy has errors, attempt to fix them and ask the user clarifying questions as needed.
|
|
94
|
+
9. If the deploy needs \`--force\` to run successfully, ALWAYS prompt the user before running \`firebase deploy --force\`.
|
|
95
|
+
10. If only one specific feature is failing, use command \`firebase deploy --only <feature>\` as you debug.
|
|
96
|
+
11. If the deploy succeeds, your job is finished.
|
|
97
|
+
`.trim(),
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
];
|
|
101
|
+
});
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.connect = void 0;
|
|
4
|
+
const prompt_1 = require("../../prompt");
|
|
5
|
+
exports.connect = (0, prompt_1.prompt)({
|
|
6
|
+
name: "connect",
|
|
7
|
+
omitPrefix: false,
|
|
8
|
+
description: "Access a Firebase application's Crashlytics data.",
|
|
9
|
+
annotations: {
|
|
10
|
+
title: "Access Crashlytics data",
|
|
11
|
+
},
|
|
12
|
+
}, async (unused, { accountEmail }) => {
|
|
13
|
+
return [
|
|
14
|
+
{
|
|
15
|
+
role: "user",
|
|
16
|
+
content: {
|
|
17
|
+
type: "text",
|
|
18
|
+
text: `
|
|
19
|
+
You are going to help a developer prioritize and fix issues in their
|
|
20
|
+
mobile application by accessing their Firebase Crashlytics data.
|
|
21
|
+
|
|
22
|
+
Active user: ${accountEmail || "<NONE>"}
|
|
23
|
+
|
|
24
|
+
## Required first steps! Absolutely required! Incredibly important!
|
|
25
|
+
|
|
26
|
+
1. **Make sure the user is logged in. No Crashlytics tools will work if the user is not logged in.**
|
|
27
|
+
a. Use the \`firebase_get_environment\` tool to verify that the user is logged in,
|
|
28
|
+
and find the active Firebase project.
|
|
29
|
+
b. If the Firebase 'Active user' is set to <NONE>, instruct the user to run \`firebase login\`
|
|
30
|
+
before continuing.
|
|
31
|
+
|
|
32
|
+
2. **Get the app_id for the Firebase application.**
|
|
33
|
+
a. If this is an Android app, read the mobilesdk_app_id value specified in the
|
|
34
|
+
google-services.json file. If there are multiple files or multiple app ids in a
|
|
35
|
+
single file, ask the user to choose one by providing a numbered list of all the package names.
|
|
36
|
+
b. If this is an iOS app, read the GOOGLE_APP_ID from GoogleService-Info.plist file.
|
|
37
|
+
If there are multiple files or multiple app ids in single file, ask the user to
|
|
38
|
+
choose one by providing a numbered list of all the bundle names.
|
|
39
|
+
c. If you can't find either of the above, just ask the user for the app id.
|
|
40
|
+
|
|
41
|
+
## Next steps
|
|
42
|
+
|
|
43
|
+
Once you have confirmed that the user is logged in to Firebase, and confirmed the
|
|
44
|
+
id for the application that they want to access, then you can ask the user what actions
|
|
45
|
+
they would like to perform. Here are some possibilities and instructions follow below:
|
|
46
|
+
|
|
47
|
+
1. Prioritize the most impactful stability issues
|
|
48
|
+
2. Diagnose and propose a fix for a crash
|
|
49
|
+
|
|
50
|
+
## Instructions for Using Crashlytics Data
|
|
51
|
+
|
|
52
|
+
### How to prioritize issues
|
|
53
|
+
|
|
54
|
+
Follow these steps to fetch issues and prioritize them.
|
|
55
|
+
|
|
56
|
+
1. Use the 'crashlytics_list_top_issues' tool to fetch up to 20 issues.
|
|
57
|
+
2. Use the 'crashlytics_list_top_versions' tool to fetch the top versions for this app.
|
|
58
|
+
3. If the user instructions include statements about prioritization, use those instructions.
|
|
59
|
+
4. If the user instructions do not include statements about prioritization,
|
|
60
|
+
then prioritize the returned issues using the following criteria:
|
|
61
|
+
4a. The app versions for the issue include the most recent version of the app.
|
|
62
|
+
4b. The number of users experiencing the issue across variants
|
|
63
|
+
4c. The volume of crashes
|
|
64
|
+
5. Return the top 5 issues, with a brief description each in a numerical list with the following format:
|
|
65
|
+
1. Issue <issue id>
|
|
66
|
+
* <the issue title>
|
|
67
|
+
* <the issue subtitle>
|
|
68
|
+
* **Description:** <a discription of the issue based on information from the tool response>
|
|
69
|
+
* **Rationale:** <the reason this issue was prioritized in the way it was>
|
|
70
|
+
|
|
71
|
+
### How to diagnose and fix issues
|
|
72
|
+
|
|
73
|
+
Follow these steps to diagnose and fix issues.
|
|
74
|
+
|
|
75
|
+
1. Make sure you have a good understanding of the code structure and where different functionality exists
|
|
76
|
+
2. Use the 'crashlytics_get_issue_details' tool to get more context on the issue.
|
|
77
|
+
3. Use the 'crashlytics_get_sample_crash_for_issue' tool to get 3 example crashes for this issue.
|
|
78
|
+
4. Read the files that exist in the stack trace of the issue to understand the crash deeply.
|
|
79
|
+
5. Determine the root cause of the crash.
|
|
80
|
+
6. Write out a plan using the following criteria:
|
|
81
|
+
6a. Write out a description of the issue and including
|
|
82
|
+
* A brief description of the cause of the issue
|
|
83
|
+
* A determination of your level of confidence in the cause of the issue
|
|
84
|
+
* A determination of which library is at fault, this codebase or a dependent library
|
|
85
|
+
* A determination for how complex the fix will be
|
|
86
|
+
6b. The plan should include relevant files to change
|
|
87
|
+
6c. The plan should include a test plan to verify the fix
|
|
88
|
+
6d. Use the following format for the plan:
|
|
89
|
+
|
|
90
|
+
## Cause
|
|
91
|
+
<A description of the root cause leading to the issue>
|
|
92
|
+
- **Fault**: <a determination of whether this code base is at fault or a dependent library is at fault>
|
|
93
|
+
- **Complexity**: <one of "simple", "moderately simple", "moderately hard", "hard", "oof, I don't know where to start">
|
|
94
|
+
|
|
95
|
+
## Fix
|
|
96
|
+
<A description of the fix for this issue and a break down of the changes.>
|
|
97
|
+
1. <Step 1>
|
|
98
|
+
2. <Step 2>
|
|
99
|
+
|
|
100
|
+
## Test
|
|
101
|
+
<A plan for how to test that the issue has been fixed and protect against regressions>
|
|
102
|
+
1. <Test case 1>
|
|
103
|
+
2. <Test case 2>
|
|
104
|
+
|
|
105
|
+
7. Present the plan to the user and get approval before making the change.
|
|
106
|
+
8. Fix the issue.
|
|
107
|
+
8a. Be mindful of API contracts and do not add fields to resources without a clear way to populate those fields
|
|
108
|
+
8b. If there is not enough information in the crash report to find a root cause, describe why you cannot fix the issue instead of making a guess.
|
|
109
|
+
9. Ask the developer if they would like you to test the fix for them.
|
|
110
|
+
`.trim(),
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
];
|
|
114
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dataconnectPrompts = void 0;
|
|
4
|
+
const experiments_1 = require("../../../experiments");
|
|
5
|
+
const schema_1 = require("./schema");
|
|
6
|
+
exports.dataconnectPrompts = [];
|
|
7
|
+
if ((0, experiments_1.isEnabled)("mcpalpha")) {
|
|
8
|
+
exports.dataconnectPrompts.push(schema_1.schema);
|
|
9
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.schema = void 0;
|
|
4
|
+
const prompt_1 = require("../../prompt");
|
|
5
|
+
const load_1 = require("../../../dataconnect/load");
|
|
6
|
+
const content_1 = require("../../util/dataconnect/content");
|
|
7
|
+
const compile_1 = require("../../util/dataconnect/compile");
|
|
8
|
+
function renderServices(fdcServices) {
|
|
9
|
+
if (!fdcServices.length)
|
|
10
|
+
return "Data Connect Status: <UNCONFIGURED>";
|
|
11
|
+
return `\n\n## Data Connect Schema
|
|
12
|
+
|
|
13
|
+
The following is the up-to-date content of existing schema files (their paths are relative to the Data Connect source directory).
|
|
14
|
+
|
|
15
|
+
${fdcServices[0].schema.source.files?.map((f) => `\`\`\`graphql ${f.path}\n${f.content}\n\`\`\``).join("\n\n")}`;
|
|
16
|
+
}
|
|
17
|
+
function renderErrors(errors) {
|
|
18
|
+
return `\n\n## Current Schema Build Errors\n\n${errors || "<NO ERRORS>"}`;
|
|
19
|
+
}
|
|
20
|
+
exports.schema = (0, prompt_1.prompt)({
|
|
21
|
+
name: "schema",
|
|
22
|
+
description: "Generate or update your Firebase Data Connect schema.",
|
|
23
|
+
arguments: [
|
|
24
|
+
{
|
|
25
|
+
name: "prompt",
|
|
26
|
+
description: "describe the schema you want generated or the edits you want to make to your existing schema",
|
|
27
|
+
required: true,
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
annotations: {
|
|
31
|
+
title: "Generate Data Connect Schema",
|
|
32
|
+
},
|
|
33
|
+
}, async ({ prompt }, { config, projectId, accountEmail }) => {
|
|
34
|
+
const fdcServices = await (0, load_1.loadAll)(projectId, config);
|
|
35
|
+
const buildErrors = fdcServices.length
|
|
36
|
+
? await (0, compile_1.compileErrors)(fdcServices[0].sourceDirectory)
|
|
37
|
+
: "";
|
|
38
|
+
return [
|
|
39
|
+
{
|
|
40
|
+
role: "user",
|
|
41
|
+
content: {
|
|
42
|
+
type: "text",
|
|
43
|
+
text: `
|
|
44
|
+
${content_1.MAIN_INSTRUCTIONS}\n\n${content_1.BUILTIN_SDL}
|
|
45
|
+
|
|
46
|
+
==== CURRENT ENVIRONMENT INFO ====
|
|
47
|
+
|
|
48
|
+
User Email: ${accountEmail || "<NONE>"}
|
|
49
|
+
Project ID: ${projectId || "<NONE>"}
|
|
50
|
+
${renderServices(fdcServices)}${renderErrors(buildErrors)}
|
|
51
|
+
|
|
52
|
+
==== USER PROMPT ====
|
|
53
|
+
|
|
54
|
+
${prompt}
|
|
55
|
+
|
|
56
|
+
==== TASK INSTRUCTIONS ====
|
|
57
|
+
|
|
58
|
+
1. If Data Connect is marked as \`<UNCONFIGURED>\`, first run the \`firebase_init\` tool with \`{dataconnect: {}}\` arguments to initialize it.
|
|
59
|
+
2. If there is not an existing schema to work with (or the existing schema is the commented-out default schema about a movie app), follow the user's prompt to generate a robust schema meeting the specified requirements.
|
|
60
|
+
3. If there is already a schema, perform edits to the existing schema file(s) based on the user's instructions. If schema build errors are present and seem relevant to your changes, attempt to fix them.
|
|
61
|
+
4. After you have performed edits on the schema, run the \`dataconnect_compile\` tool to build the schema and see if there are any errors. Fix errors that are related to the user's prompt or your changes.
|
|
62
|
+
5. If there are errors, attempt to fix them. If you have attempted to fix them 3 times without success, ask the user for help.
|
|
63
|
+
6. If there are no errors, write a brief paragraph summarizing your changes.`,
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
];
|
|
67
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.availablePrompts = void 0;
|
|
4
|
+
const core_1 = require("./core");
|
|
5
|
+
const dataconnect_1 = require("./dataconnect");
|
|
6
|
+
const crashlytics_1 = require("./crashlytics");
|
|
7
|
+
const prompts = {
|
|
8
|
+
core: core_1.corePrompts,
|
|
9
|
+
firestore: [],
|
|
10
|
+
storage: [],
|
|
11
|
+
dataconnect: dataconnect_1.dataconnectPrompts,
|
|
12
|
+
auth: [],
|
|
13
|
+
messaging: [],
|
|
14
|
+
remoteconfig: [],
|
|
15
|
+
crashlytics: crashlytics_1.crashlyticsPrompts,
|
|
16
|
+
apphosting: [],
|
|
17
|
+
database: [],
|
|
18
|
+
};
|
|
19
|
+
function namespacePrompts(promptsToNamespace, feature) {
|
|
20
|
+
return promptsToNamespace.map((p) => {
|
|
21
|
+
const newPrompt = { ...p };
|
|
22
|
+
newPrompt.mcp = { ...p.mcp };
|
|
23
|
+
if (newPrompt.mcp.omitPrefix) {
|
|
24
|
+
}
|
|
25
|
+
else if (feature === "core") {
|
|
26
|
+
newPrompt.mcp.name = `firebase:${p.mcp.name}`;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
newPrompt.mcp.name = `${feature}:${p.mcp.name}`;
|
|
30
|
+
}
|
|
31
|
+
newPrompt.mcp._meta = { ...p.mcp._meta, feature };
|
|
32
|
+
return newPrompt;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function availablePrompts(features) {
|
|
36
|
+
const allPrompts = namespacePrompts(prompts["core"], "core");
|
|
37
|
+
if (!features) {
|
|
38
|
+
features = Object.keys(prompts).filter((f) => f !== "core");
|
|
39
|
+
}
|
|
40
|
+
for (const feature of features) {
|
|
41
|
+
if (prompts[feature] && feature !== "core") {
|
|
42
|
+
allPrompts.push(...namespacePrompts(prompts[feature], feature));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return allPrompts;
|
|
46
|
+
}
|
|
47
|
+
exports.availablePrompts = availablePrompts;
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fetch_logs = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
exports.fetch_logs = (0,
|
|
5
|
+
const tool_1 = require("../../tool");
|
|
6
|
+
const util_1 = require("../../util");
|
|
7
|
+
const apphosting_1 = require("../../../gcp/apphosting");
|
|
8
|
+
const utils_1 = require("../../../utils");
|
|
9
|
+
const error_1 = require("../../../error");
|
|
10
|
+
const run_1 = require("../../../gcp/run");
|
|
11
|
+
const cloudlogging_1 = require("../../../gcp/cloudlogging");
|
|
12
|
+
exports.fetch_logs = (0, tool_1.tool)({
|
|
13
13
|
name: "fetch_logs",
|
|
14
14
|
description: "Fetches the most recent logs for a specified App Hosting backend. If `buildLogs` is specified, the logs from the build process for the latest build are returned. The most recent logs are listed first.",
|
|
15
15
|
inputSchema: zod_1.z.object({
|
|
@@ -33,36 +33,36 @@ exports.fetch_logs = (0, tool_js_1.tool)({
|
|
|
33
33
|
}, async ({ buildLogs, backendId, location } = {}, { projectId }) => {
|
|
34
34
|
location || (location = "");
|
|
35
35
|
if (!backendId) {
|
|
36
|
-
return (0,
|
|
36
|
+
return (0, util_1.toContent)(`backendId must be specified.`);
|
|
37
37
|
}
|
|
38
|
-
const backend = await (0,
|
|
39
|
-
const traffic = await (0,
|
|
38
|
+
const backend = await (0, apphosting_1.getBackend)(projectId, location, backendId);
|
|
39
|
+
const traffic = await (0, apphosting_1.getTraffic)(projectId, location, backendId);
|
|
40
40
|
const data = { ...backend, traffic };
|
|
41
41
|
if (buildLogs) {
|
|
42
|
-
const builds = await (0,
|
|
42
|
+
const builds = await (0, apphosting_1.listBuilds)(projectId, location, backendId);
|
|
43
43
|
builds.builds.sort((a, b) => new Date(a.createTime).getTime() - new Date(b.createTime).getTime());
|
|
44
|
-
const build = (0,
|
|
44
|
+
const build = (0, utils_1.last)(builds.builds);
|
|
45
45
|
const r = new RegExp(`region=${location}/([0-9a-f-]+)?`);
|
|
46
46
|
const match = r.exec(build.buildLogsUri ?? "");
|
|
47
47
|
if (!match) {
|
|
48
|
-
throw new
|
|
48
|
+
throw new error_1.FirebaseError("Unable to determine the build ID.");
|
|
49
49
|
}
|
|
50
50
|
const buildId = match[1];
|
|
51
51
|
const thirtyDaysAgo = new Date();
|
|
52
52
|
thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - 30);
|
|
53
53
|
const timestampFilter = `timestamp >= "${thirtyDaysAgo.toISOString()}"`;
|
|
54
54
|
const filter = `resource.type="build" resource.labels.build_id="${buildId}" ${timestampFilter}`;
|
|
55
|
-
const entries = await (0,
|
|
55
|
+
const entries = await (0, cloudlogging_1.listEntries)(projectId, filter, 100, "asc");
|
|
56
56
|
if (!Array.isArray(entries) || !entries.length) {
|
|
57
|
-
return (0,
|
|
57
|
+
return (0, util_1.toContent)("No logs found.");
|
|
58
58
|
}
|
|
59
|
-
return (0,
|
|
59
|
+
return (0, util_1.toContent)(entries);
|
|
60
60
|
}
|
|
61
|
-
const serviceName = (0,
|
|
61
|
+
const serviceName = (0, utils_1.last)(data.managedResources)?.runService.service;
|
|
62
62
|
if (!serviceName) {
|
|
63
|
-
throw new
|
|
63
|
+
throw new error_1.FirebaseError("Unable to get service name from managedResources.");
|
|
64
64
|
}
|
|
65
|
-
const serviceId = (0,
|
|
66
|
-
const logs = await (0,
|
|
67
|
-
return (0,
|
|
65
|
+
const serviceId = (0, utils_1.last)(serviceName.split("/"));
|
|
66
|
+
const logs = await (0, run_1.fetchServiceLogs)(projectId, serviceId);
|
|
67
|
+
return (0, util_1.toContent)(logs);
|
|
68
68
|
});
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.list_backends = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
exports.list_backends = (0,
|
|
5
|
+
const tool_1 = require("../../tool");
|
|
6
|
+
const util_1 = require("../../util");
|
|
7
|
+
const apphosting_1 = require("../../../gcp/apphosting");
|
|
8
|
+
exports.list_backends = (0, tool_1.tool)({
|
|
9
9
|
name: "list_backends",
|
|
10
10
|
description: "Retrieves a list of App Hosting backends in the current project. An empty list means that there are no backends. " +
|
|
11
11
|
"The `uri` is the public URL of the backend. " +
|
|
@@ -34,18 +34,18 @@ exports.list_backends = (0, tool_js_1.tool)({
|
|
|
34
34
|
projectId = projectId || "";
|
|
35
35
|
if (!location)
|
|
36
36
|
location = "-";
|
|
37
|
-
const backends = await (0,
|
|
37
|
+
const backends = await (0, apphosting_1.listBackends)(projectId, location);
|
|
38
38
|
if (!backends.backends.length) {
|
|
39
|
-
return (0,
|
|
39
|
+
return (0, util_1.toContent)(`No backends exist for project ${projectId}${location !== "-" ? ` in ${location}` : ""}.`);
|
|
40
40
|
}
|
|
41
41
|
const promises = backends.backends.map(async (backend) => {
|
|
42
|
-
const { location, id } = (0,
|
|
42
|
+
const { location, id } = (0, apphosting_1.parseBackendName)(backend.name);
|
|
43
43
|
const [traffic, domains] = await Promise.all([
|
|
44
|
-
(0,
|
|
45
|
-
(0,
|
|
44
|
+
(0, apphosting_1.getTraffic)(projectId, location, id),
|
|
45
|
+
(0, apphosting_1.listDomains)(projectId, location, id),
|
|
46
46
|
]);
|
|
47
47
|
return { ...backend, traffic: traffic, domains: domains };
|
|
48
48
|
});
|
|
49
49
|
const data = await Promise.all(promises);
|
|
50
|
-
return (0,
|
|
50
|
+
return (0, util_1.toContent)(data);
|
|
51
51
|
});
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.disable_user = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
exports.disable_user = (0,
|
|
5
|
+
const tool_1 = require("../../tool");
|
|
6
|
+
const util_1 = require("../../util");
|
|
7
|
+
const auth_1 = require("../../../gcp/auth");
|
|
8
|
+
exports.disable_user = (0, tool_1.tool)({
|
|
9
9
|
name: "disable_user",
|
|
10
10
|
description: "Disables or enables a user based on a UID.",
|
|
11
11
|
inputSchema: zod_1.z.object({
|
|
@@ -22,9 +22,9 @@ exports.disable_user = (0, tool_js_1.tool)({
|
|
|
22
22
|
requiresProject: true,
|
|
23
23
|
},
|
|
24
24
|
}, async ({ uid, disabled }, { projectId }) => {
|
|
25
|
-
const res = await (0,
|
|
25
|
+
const res = await (0, auth_1.disableUser)(projectId, uid, disabled);
|
|
26
26
|
if (res) {
|
|
27
|
-
return (0,
|
|
27
|
+
return (0, util_1.toContent)(`User ${uid} has been ${disabled ? "disabled" : "enabled"}`);
|
|
28
28
|
}
|
|
29
|
-
return (0,
|
|
29
|
+
return (0, util_1.toContent)(`Failed to ${disabled ? "disable" : "enable"} user ${uid}`);
|
|
30
30
|
});
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.get_user = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
exports.get_user = (0,
|
|
5
|
+
const tool_1 = require("../../tool");
|
|
6
|
+
const util_1 = require("../../util");
|
|
7
|
+
const auth_1 = require("../../../gcp/auth");
|
|
8
|
+
exports.get_user = (0, tool_1.tool)({
|
|
9
9
|
name: "get_user",
|
|
10
10
|
description: "Retrieves a user based on an email address, phone number, or UID.",
|
|
11
11
|
inputSchema: zod_1.z.object({
|
|
@@ -32,7 +32,14 @@ exports.get_user = (0, tool_js_1.tool)({
|
|
|
32
32
|
},
|
|
33
33
|
}, async ({ email, phone_number, uid }, { projectId }) => {
|
|
34
34
|
if (email === undefined && phone_number === undefined && uid === undefined) {
|
|
35
|
-
return (0,
|
|
35
|
+
return (0, util_1.mcpError)("No user identifier supplied in auth_get_user tool");
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
let user;
|
|
38
|
+
try {
|
|
39
|
+
user = await (0, auth_1.findUser)(projectId, email, phone_number, uid);
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
return (0, util_1.mcpError)("Unable to find user");
|
|
43
|
+
}
|
|
44
|
+
return (0, util_1.toContent)(user);
|
|
38
45
|
});
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.authTools = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
4
|
+
const get_user_1 = require("./get_user");
|
|
5
|
+
const disable_user_1 = require("./disable_user");
|
|
6
|
+
const set_claims_1 = require("./set_claims");
|
|
7
|
+
const set_sms_region_policy_1 = require("./set_sms_region_policy");
|
|
8
|
+
const list_users_1 = require("./list_users");
|
|
9
9
|
exports.authTools = [
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
get_user_1.get_user,
|
|
11
|
+
disable_user_1.disable_user,
|
|
12
|
+
list_users_1.list_users,
|
|
13
|
+
set_claims_1.set_claim,
|
|
14
|
+
set_sms_region_policy_1.set_sms_region_policy,
|
|
15
15
|
];
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.list_users = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
exports.list_users = (0,
|
|
5
|
+
const tool_1 = require("../../tool");
|
|
6
|
+
const util_1 = require("../../util");
|
|
7
|
+
const auth_1 = require("../../../gcp/auth");
|
|
8
|
+
exports.list_users = (0, tool_1.tool)({
|
|
9
9
|
name: "list_users",
|
|
10
10
|
description: "Retrieves all users in the project up to the specified limit.",
|
|
11
11
|
inputSchema: zod_1.z.object({
|
|
@@ -27,10 +27,10 @@ exports.list_users = (0, tool_js_1.tool)({
|
|
|
27
27
|
if (!limit) {
|
|
28
28
|
limit = 100;
|
|
29
29
|
}
|
|
30
|
-
const users = await (0,
|
|
30
|
+
const users = await (0, auth_1.listUsers)(projectId, limit);
|
|
31
31
|
const usersPruned = users.map((user) => {
|
|
32
32
|
const { passwordHash, salt, ...prunedUser } = user;
|
|
33
33
|
return prunedUser;
|
|
34
34
|
});
|
|
35
|
-
return (0,
|
|
35
|
+
return (0, util_1.toContent)(usersPruned);
|
|
36
36
|
});
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.set_claim = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
exports.set_claim = (0,
|
|
5
|
+
const tool_1 = require("../../tool");
|
|
6
|
+
const util_1 = require("../../util");
|
|
7
|
+
const auth_1 = require("../../../gcp/auth");
|
|
8
|
+
exports.set_claim = (0, tool_1.tool)({
|
|
9
9
|
name: "set_claim",
|
|
10
10
|
description: "Sets a custom claim on a specific user's account. Use to create trusted values associated with a user e.g. marking them as an admin. Claims are limited in size and should be succinct in name and value. Specify ONLY ONE OF `value` or `json_value` parameters.",
|
|
11
11
|
inputSchema: zod_1.z.object({
|
|
@@ -30,14 +30,14 @@ exports.set_claim = (0, tool_js_1.tool)({
|
|
|
30
30
|
},
|
|
31
31
|
}, async ({ uid, claim, value, json_value }, { projectId }) => {
|
|
32
32
|
if (value && json_value)
|
|
33
|
-
return (0,
|
|
33
|
+
return (0, util_1.mcpError)("Must supply only `value` or `json_value`, not both.");
|
|
34
34
|
if (json_value) {
|
|
35
35
|
try {
|
|
36
36
|
value = JSON.parse(json_value);
|
|
37
37
|
}
|
|
38
38
|
catch (e) {
|
|
39
|
-
return (0,
|
|
39
|
+
return (0, util_1.mcpError)(`Provided \`json_value\` was not valid JSON: ${json_value}`);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
return (0,
|
|
42
|
+
return (0, util_1.toContent)(await (0, auth_1.setCustomClaim)(projectId, uid, { [claim]: value }, { merge: true }));
|
|
43
43
|
});
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.set_sms_region_policy = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
exports.set_sms_region_policy = (0,
|
|
5
|
+
const tool_1 = require("../../tool");
|
|
6
|
+
const util_1 = require("../../util");
|
|
7
|
+
const auth_1 = require("../../../gcp/auth");
|
|
8
|
+
exports.set_sms_region_policy = (0, tool_1.tool)({
|
|
9
9
|
name: "set_sms_region_policy",
|
|
10
10
|
description: "Sets an SMS Region Policy for Firebase Auth to restrict the regions which can receive text messages based on an ALLOW or DENY list of country codes. This policy will override any existing policies when set.",
|
|
11
11
|
inputSchema: zod_1.z.object({
|
|
@@ -30,7 +30,7 @@ exports.set_sms_region_policy = (0, tool_js_1.tool)({
|
|
|
30
30
|
return code.toUpperCase();
|
|
31
31
|
});
|
|
32
32
|
if (policy_type === "ALLOW") {
|
|
33
|
-
return (0,
|
|
33
|
+
return (0, util_1.toContent)(await (0, auth_1.setAllowSmsRegionPolicy)(projectId, country_codes));
|
|
34
34
|
}
|
|
35
|
-
return (0,
|
|
35
|
+
return (0, util_1.toContent)(await (0, auth_1.setDenySmsRegionPolicy)(projectId, country_codes));
|
|
36
36
|
});
|