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.
Files changed (236) hide show
  1. package/lib/api.js +5 -1
  2. package/lib/apphosting/backend.js +40 -15
  3. package/lib/apptesting/ensureProjectConfigured.js +56 -0
  4. package/lib/apptesting/invokeTests.js +40 -0
  5. package/lib/apptesting/parseTestFiles.js +75 -0
  6. package/lib/apptesting/types.js +18 -0
  7. package/lib/auth.js +37 -2
  8. package/lib/command.js +24 -5
  9. package/lib/commands/apphosting-backends-create.js +8 -5
  10. package/lib/commands/apptesting-execute.js +101 -0
  11. package/lib/commands/dataconnect-sdk-generate.js +28 -26
  12. package/lib/commands/dataconnect-services-list.js +1 -1
  13. package/lib/commands/dataconnect-sql-diff.js +2 -2
  14. package/lib/commands/dataconnect-sql-grant.js +7 -2
  15. package/lib/commands/dataconnect-sql-migrate.js +2 -2
  16. package/lib/commands/dataconnect-sql-setup.js +3 -5
  17. package/lib/commands/dataconnect-sql-shell.js +2 -2
  18. package/lib/commands/ext-export.js +1 -1
  19. package/lib/commands/firestore-bulkdelete.js +73 -0
  20. package/lib/commands/firestore-databases-create.js +11 -0
  21. package/lib/commands/firestore-operations-cancel.js +44 -0
  22. package/lib/commands/firestore-operations-describe.js +29 -0
  23. package/lib/commands/firestore-operations-list.js +29 -0
  24. package/lib/commands/firestore-utils.js +15 -0
  25. package/lib/commands/functions-config-clone.js +2 -0
  26. package/lib/commands/functions-config-export.js +5 -2
  27. package/lib/commands/functions-config-get.js +2 -0
  28. package/lib/commands/functions-config-set.js +2 -0
  29. package/lib/commands/functions-config-unset.js +2 -0
  30. package/lib/commands/index.js +9 -0
  31. package/lib/commands/init.js +24 -4
  32. package/lib/commands/internaltesting-functions-discover.js +20 -5
  33. package/lib/commands/login.js +13 -9
  34. package/lib/commands/use.js +5 -0
  35. package/lib/config.js +16 -4
  36. package/lib/crashlytics/addNote.js +27 -0
  37. package/lib/crashlytics/buildToolsJarHelper.js +1 -2
  38. package/lib/crashlytics/deleteNote.js +23 -0
  39. package/lib/crashlytics/getIssueDetails.js +26 -0
  40. package/lib/crashlytics/getSampleCrash.js +34 -0
  41. package/lib/crashlytics/listNotes.js +29 -0
  42. package/lib/crashlytics/listTopDevices.js +33 -0
  43. package/lib/crashlytics/listTopIssues.js +8 -23
  44. package/lib/crashlytics/listTopOperatingSystems.js +32 -0
  45. package/lib/crashlytics/listTopVersions.js +32 -0
  46. package/lib/crashlytics/updateIssue.js +35 -0
  47. package/lib/crashlytics/utils.js +38 -0
  48. package/lib/dataconnect/appFinder.js +102 -0
  49. package/lib/dataconnect/client.js +23 -15
  50. package/lib/dataconnect/ensureApis.js +6 -9
  51. package/lib/dataconnect/errors.js +7 -1
  52. package/lib/dataconnect/freeTrial.js +16 -38
  53. package/lib/dataconnect/load.js +105 -6
  54. package/lib/dataconnect/provisionCloudSql.js +67 -70
  55. package/lib/dataconnect/schemaMigration.js +219 -169
  56. package/lib/deploy/dataconnect/deploy.js +7 -9
  57. package/lib/deploy/dataconnect/prepare.js +7 -12
  58. package/lib/deploy/dataconnect/release.js +43 -31
  59. package/lib/deploy/firestore/deploy.js +10 -0
  60. package/lib/deploy/functions/backend.js +7 -1
  61. package/lib/deploy/functions/build.js +28 -14
  62. package/lib/deploy/functions/deploy.js +3 -2
  63. package/lib/deploy/functions/ensure.js +1 -1
  64. package/lib/deploy/functions/functionsDeployHelper.js +8 -1
  65. package/lib/deploy/functions/params.js +4 -0
  66. package/lib/deploy/functions/prepare.js +25 -13
  67. package/lib/deploy/functions/pricing.js +12 -5
  68. package/lib/deploy/functions/release/fabricator.js +25 -3
  69. package/lib/deploy/functions/release/reporter.js +1 -0
  70. package/lib/deploy/functions/runtimes/discovery/index.js +52 -5
  71. package/lib/deploy/functions/runtimes/node/index.js +83 -51
  72. package/lib/emulator/auth/operations.js +10 -1
  73. package/lib/emulator/commandUtils.js +7 -1
  74. package/lib/emulator/controller.js +22 -34
  75. package/lib/emulator/dataconnectEmulator.js +27 -24
  76. package/lib/emulator/downloadableEmulatorInfo.json +18 -18
  77. package/lib/emulator/env.js +2 -1
  78. package/lib/emulator/functionsEmulator.js +12 -2
  79. package/lib/emulator/hub.js +11 -8
  80. package/lib/emulator/tasksEmulator.js +1 -1
  81. package/lib/emulator/ui.js +3 -1
  82. package/lib/env.js +18 -0
  83. package/lib/experiments.js +20 -0
  84. package/lib/extensions/extensionsHelper.js +4 -15
  85. package/lib/extensions/runtimes/common.js +3 -2
  86. package/lib/extensions/utils.js +1 -12
  87. package/lib/firestore/api-sort.js +96 -3
  88. package/lib/firestore/api-types.js +20 -1
  89. package/lib/firestore/api.js +144 -15
  90. package/lib/firestore/pretty-print.js +35 -1
  91. package/lib/firestore/validator.js +1 -1
  92. package/lib/functional.js +7 -1
  93. package/lib/functions/deprecationWarnings.js +21 -0
  94. package/lib/functions/env.js +31 -16
  95. package/lib/functions/projectConfig.js +87 -8
  96. package/lib/functions/secrets.js +3 -0
  97. package/lib/gcp/cloudfunctions.js +1 -6
  98. package/lib/gcp/cloudfunctionsv2.js +3 -39
  99. package/lib/gcp/cloudscheduler.js +1 -1
  100. package/lib/gcp/cloudsql/cloudsqladmin.js +4 -16
  101. package/lib/gcp/cloudsql/connect.js +4 -3
  102. package/lib/gcp/cloudsql/permissionsSetup.js +23 -16
  103. package/lib/gcp/k8s.js +32 -0
  104. package/lib/gcp/runv2.js +181 -0
  105. package/lib/gemini/fdcExperience.js +5 -3
  106. package/lib/init/features/aitools/claude.js +43 -0
  107. package/lib/init/features/aitools/cursor.js +61 -0
  108. package/lib/init/features/aitools/gemini.js +58 -0
  109. package/lib/init/features/aitools/index.js +28 -0
  110. package/lib/init/features/aitools/promptUpdater.js +111 -0
  111. package/lib/init/features/aitools/studio.js +17 -0
  112. package/lib/init/features/aitools/types.js +2 -0
  113. package/lib/init/features/aitools.js +83 -0
  114. package/lib/init/features/apptesting/index.js +34 -0
  115. package/lib/init/features/dataconnect/create_app.js +53 -0
  116. package/lib/init/features/dataconnect/index.js +280 -186
  117. package/lib/init/features/dataconnect/sdk.js +232 -144
  118. package/lib/init/features/index.js +8 -3
  119. package/lib/init/features/project.js +4 -0
  120. package/lib/init/index.js +18 -2
  121. package/lib/management/apps.js +3 -3
  122. package/lib/management/studio.js +120 -0
  123. package/lib/mcp/errors.js +5 -7
  124. package/lib/mcp/index.js +179 -61
  125. package/lib/mcp/logging-transport.js +23 -0
  126. package/lib/mcp/prompt.js +10 -0
  127. package/lib/mcp/prompts/core/deploy.js +101 -0
  128. package/lib/mcp/prompts/core/index.js +5 -0
  129. package/lib/mcp/prompts/crashlytics/connect.js +114 -0
  130. package/lib/mcp/prompts/crashlytics/index.js +5 -0
  131. package/lib/mcp/prompts/dataconnect/index.js +9 -0
  132. package/lib/mcp/prompts/dataconnect/schema.js +67 -0
  133. package/lib/mcp/prompts/index.js +47 -0
  134. package/lib/mcp/tools/apphosting/fetch_logs.js +22 -22
  135. package/lib/mcp/tools/apphosting/list_backends.js +10 -10
  136. package/lib/mcp/tools/auth/disable_user.js +7 -7
  137. package/lib/mcp/tools/auth/get_user.js +13 -6
  138. package/lib/mcp/tools/auth/index.js +10 -10
  139. package/lib/mcp/tools/auth/list_users.js +6 -6
  140. package/lib/mcp/tools/auth/set_claims.js +7 -7
  141. package/lib/mcp/tools/auth/set_sms_region_policy.js +6 -6
  142. package/lib/mcp/tools/core/consult_assistant.js +13 -8
  143. package/lib/mcp/tools/core/create_android_sha.js +9 -9
  144. package/lib/mcp/tools/core/create_app.js +7 -7
  145. package/lib/mcp/tools/core/create_project.js +13 -13
  146. package/lib/mcp/tools/core/get_admin_sdk_config.js +7 -7
  147. package/lib/mcp/tools/core/get_environment.js +8 -8
  148. package/lib/mcp/tools/core/get_project.js +5 -5
  149. package/lib/mcp/tools/core/get_sdk_config.js +19 -9
  150. package/lib/mcp/tools/core/index.js +28 -24
  151. package/lib/mcp/tools/core/init.js +39 -16
  152. package/lib/mcp/tools/core/list_apps.js +6 -6
  153. package/lib/mcp/tools/core/list_projects.js +6 -6
  154. package/lib/mcp/tools/core/login.js +46 -0
  155. package/lib/mcp/tools/core/logout.js +62 -0
  156. package/lib/mcp/tools/core/update_environment.js +10 -10
  157. package/lib/mcp/tools/crashlytics/add_note.js +32 -0
  158. package/lib/mcp/tools/crashlytics/constants.js +11 -0
  159. package/lib/mcp/tools/crashlytics/delete_note.js +35 -0
  160. package/lib/mcp/tools/crashlytics/get_issue_details.js +31 -0
  161. package/lib/mcp/tools/crashlytics/get_sample_crash.js +43 -0
  162. package/lib/mcp/tools/crashlytics/index.js +22 -2
  163. package/lib/mcp/tools/crashlytics/list_notes.js +37 -0
  164. package/lib/mcp/tools/crashlytics/list_top_devices.js +33 -0
  165. package/lib/mcp/tools/crashlytics/list_top_issues.js +12 -13
  166. package/lib/mcp/tools/crashlytics/list_top_operating_systems.js +33 -0
  167. package/lib/mcp/tools/crashlytics/list_top_versions.js +33 -0
  168. package/lib/mcp/tools/crashlytics/update_issue.js +37 -0
  169. package/lib/mcp/tools/database/get_data.js +49 -0
  170. package/lib/mcp/tools/database/get_rules.js +39 -0
  171. package/lib/mcp/tools/database/index.js +8 -0
  172. package/lib/mcp/tools/database/set_data.js +57 -0
  173. package/lib/mcp/tools/database/validate_rules.js +41 -0
  174. package/lib/mcp/tools/dataconnect/compile.js +43 -0
  175. package/lib/mcp/tools/dataconnect/execute.js +71 -0
  176. package/lib/mcp/tools/dataconnect/generate_operation.js +8 -8
  177. package/lib/mcp/tools/dataconnect/generate_schema.js +6 -6
  178. package/lib/mcp/tools/dataconnect/index.js +10 -18
  179. package/lib/mcp/tools/dataconnect/list_services.js +107 -11
  180. package/lib/mcp/tools/firestore/delete_document.js +13 -13
  181. package/lib/mcp/tools/firestore/get_documents.js +13 -13
  182. package/lib/mcp/tools/firestore/list_collections.js +7 -10
  183. package/lib/mcp/tools/firestore/query_collection.js +13 -13
  184. package/lib/mcp/tools/index.js +24 -18
  185. package/lib/mcp/tools/messaging/index.js +2 -2
  186. package/lib/mcp/tools/messaging/send_message.js +7 -7
  187. package/lib/mcp/tools/remoteconfig/get_template.js +5 -5
  188. package/lib/mcp/tools/remoteconfig/index.js +4 -4
  189. package/lib/mcp/tools/remoteconfig/publish_template.js +7 -7
  190. package/lib/mcp/tools/remoteconfig/rollback_template.js +6 -6
  191. package/lib/mcp/tools/rules/get_rules.js +8 -8
  192. package/lib/mcp/tools/rules/validate_rules.js +10 -10
  193. package/lib/mcp/tools/storage/get_download_url.js +8 -8
  194. package/lib/mcp/tools/storage/get_rules.js +8 -8
  195. package/lib/mcp/types.js +2 -0
  196. package/lib/mcp/util/dataconnect/compile.js +20 -0
  197. package/lib/mcp/util/dataconnect/content.js +655 -0
  198. package/lib/mcp/util/dataconnect/emulator.js +16 -0
  199. package/lib/mcp/util.js +5 -18
  200. package/lib/requireAuth.js +14 -4
  201. package/lib/rtdb.js +10 -6
  202. package/lib/scopes.js +2 -1
  203. package/lib/serve/functions.js +4 -3
  204. package/lib/timeout.js +21 -0
  205. package/lib/track.js +18 -1
  206. package/lib/unzip.js +13 -0
  207. package/lib/utils.js +76 -2
  208. package/package.json +5 -3
  209. package/prompts/FIREBASE.md +121 -0
  210. package/prompts/FIREBASE_FUNCTIONS.md +221 -0
  211. package/schema/apptesting-yaml.json +64 -0
  212. package/schema/firebase-config.json +163 -53
  213. package/templates/init/aitools/cursor-rules-header.txt +8 -0
  214. package/templates/init/aitools/gemini-extension.json +11 -0
  215. package/templates/init/apptesting/smoke_test.yaml +6 -0
  216. package/templates/init/dataconnect/connector.yaml +0 -16
  217. package/templates/init/dataconnect/dataconnect.yaml +2 -1
  218. package/templates/init/dataconnect/mutations.gql +29 -29
  219. package/templates/init/dataconnect/queries.gql +73 -73
  220. package/templates/init/dataconnect/schema.gql +48 -48
  221. package/templates/init/firestore/firestore.indexes.json +26 -1
  222. package/lib/dataconnect/fileUtils.js +0 -168
  223. package/lib/emulator/adminSdkConfig.test.js +0 -16
  224. package/lib/extensions/resolveSource.js +0 -23
  225. package/lib/firestore/api-sort.test.js +0 -74
  226. package/lib/firestore/backupUtils.test.js +0 -18
  227. package/lib/firestore/pretty-print.test.js +0 -61
  228. package/lib/firestore/util.test.js +0 -42
  229. package/lib/mcp/tools/dataconnect/emulator.js +0 -16
  230. package/lib/mcp/tools/dataconnect/execute_graphql.js +0 -48
  231. package/lib/mcp/tools/dataconnect/execute_graphql_read.js +0 -48
  232. package/lib/mcp/tools/dataconnect/execute_mutation.js +0 -62
  233. package/lib/mcp/tools/dataconnect/execute_query.js +0 -62
  234. package/lib/mcp/tools/dataconnect/get_connector.js +0 -31
  235. package/lib/mcp/tools/dataconnect/get_schema.js +0 -31
  236. /package/lib/mcp/{tools → util}/dataconnect/converter.js +0 -0
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const chai_1 = require("chai");
4
- const util = require("./util");
5
- describe("IndexNameParsing", () => {
6
- it("should parse an index name correctly", () => {
7
- const name = "/projects/myproject/databases/(default)/collectionGroups/collection/indexes/abc123/";
8
- (0, chai_1.expect)(util.parseIndexName(name)).to.eql({
9
- projectId: "myproject",
10
- databaseId: "(default)",
11
- collectionGroupId: "collection",
12
- indexId: "abc123",
13
- });
14
- });
15
- it("should parse a field name correctly", () => {
16
- const name = "/projects/myproject/databases/(default)/collectionGroups/collection/fields/abc123/";
17
- (0, chai_1.expect)(util.parseFieldName(name)).to.eql({
18
- projectId: "myproject",
19
- databaseId: "(default)",
20
- collectionGroupId: "collection",
21
- fieldPath: "abc123",
22
- });
23
- });
24
- it("should parse an index name from a named database correctly", () => {
25
- const name = "/projects/myproject/databases/named-db/collectionGroups/collection/indexes/abc123/";
26
- (0, chai_1.expect)(util.parseIndexName(name)).to.eql({
27
- projectId: "myproject",
28
- databaseId: "named-db",
29
- collectionGroupId: "collection",
30
- indexId: "abc123",
31
- });
32
- });
33
- it("should parse a field name from a named database correctly", () => {
34
- const name = "/projects/myproject/databases/named-db/collectionGroups/collection/fields/abc123/";
35
- (0, chai_1.expect)(util.parseFieldName(name)).to.eql({
36
- projectId: "myproject",
37
- databaseId: "named-db",
38
- collectionGroupId: "collection",
39
- fieldPath: "abc123",
40
- });
41
- });
42
- });
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDataConnectEmulatorClient = void 0;
4
- const types_js_1 = require("../../../emulator/types.js");
5
- const apiv2_js_1 = require("../../../apiv2.js");
6
- const dataplaneClient_js_1 = require("../../../dataconnect/dataplaneClient.js");
7
- async function getDataConnectEmulatorClient(host) {
8
- const emulatorUrl = await host.getEmulatorUrl(types_js_1.Emulators.DATACONNECT);
9
- const apiClient = new apiv2_js_1.Client({
10
- urlPrefix: emulatorUrl,
11
- apiVersion: dataplaneClient_js_1.DATACONNECT_API_VERSION,
12
- auth: false,
13
- });
14
- return apiClient;
15
- }
16
- exports.getDataConnectEmulatorClient = getDataConnectEmulatorClient;
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.execute_graphql = void 0;
4
- const zod_1 = require("zod");
5
- const tool_js_1 = require("../../tool.js");
6
- const dataplane = require("../../../dataconnect/dataplaneClient.js");
7
- const fileUtils_js_1 = require("../../../dataconnect/fileUtils.js");
8
- const converter_js_1 = require("./converter.js");
9
- const emulator_js_1 = require("./emulator.js");
10
- exports.execute_graphql = (0, tool_js_1.tool)({
11
- name: "execute_graphql",
12
- description: "Executes an arbitrary GraphQL against a Data Connect service or its emulator.",
13
- inputSchema: zod_1.z.object({
14
- query: zod_1.z.string().describe("A GraphQL query or mutation to execute against the service"),
15
- service_id: zod_1.z
16
- .string()
17
- .nullable()
18
- .describe("The Firebase Data Connect service ID to look for. If there is only one service defined in firebase.json, this can be omitted and that will be used."),
19
- variables: zod_1.z
20
- .string()
21
- .optional()
22
- .describe("A stringified JSON object containing variables for the operation. MUST be valid JSON."),
23
- use_emulator: zod_1.z.boolean().default(false).describe("Target the DataConnect emulator if true."),
24
- }),
25
- annotations: {
26
- title: "Execute GraphQL Operation",
27
- readOnlyHint: false,
28
- },
29
- _meta: {
30
- requiresProject: true,
31
- requiresAuth: true,
32
- },
33
- }, async ({ query, service_id, variables: unparsedVariables, use_emulator }, { projectId, config, host }) => {
34
- const serviceInfo = await (0, fileUtils_js_1.pickService)(projectId, config, service_id || undefined);
35
- let apiClient;
36
- if (use_emulator) {
37
- apiClient = await (0, emulator_js_1.getDataConnectEmulatorClient)(host);
38
- }
39
- else {
40
- apiClient = dataplane.dataconnectDataplaneClient();
41
- }
42
- const response = await dataplane.executeGraphQL(apiClient, serviceInfo.serviceName, {
43
- name: "",
44
- query,
45
- variables: (0, converter_js_1.parseVariables)(unparsedVariables),
46
- });
47
- return (0, converter_js_1.graphqlResponseToToolResponse)(response.body);
48
- });
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.execute_graphql_read = void 0;
4
- const zod_1 = require("zod");
5
- const tool_js_1 = require("../../tool.js");
6
- const dataplane = require("../../../dataconnect/dataplaneClient.js");
7
- const fileUtils_js_1 = require("../../../dataconnect/fileUtils.js");
8
- const converter_js_1 = require("./converter.js");
9
- const emulator_js_1 = require("./emulator.js");
10
- exports.execute_graphql_read = (0, tool_js_1.tool)({
11
- name: "execute_graphql_read",
12
- description: "Executes an arbitrary GraphQL query against a Data Connect service or its emulator. Cannot write data.",
13
- inputSchema: zod_1.z.object({
14
- query: zod_1.z.string().describe("A GraphQL query to execute against the service"),
15
- service_id: zod_1.z
16
- .string()
17
- .nullable()
18
- .describe("The Firebase Data Connect service ID to look for. If there is only one service defined in firebase.json, this can be omitted and that will be used."),
19
- variables: zod_1.z
20
- .string()
21
- .optional()
22
- .describe("A stringified JSON object containing variables for the operation. MUST be valid JSON."),
23
- use_emulator: zod_1.z.boolean().default(false).describe("Target the DataConnect emulator if true."),
24
- }),
25
- annotations: {
26
- title: "Execute Data Connect GraphQL Query",
27
- readOnlyHint: true,
28
- },
29
- _meta: {
30
- requiresProject: true,
31
- requiresAuth: true,
32
- },
33
- }, async ({ query, service_id, variables: unparsedVariables, use_emulator }, { projectId, config, host }) => {
34
- const serviceInfo = await (0, fileUtils_js_1.pickService)(projectId, config, service_id || undefined);
35
- let apiClient;
36
- if (use_emulator) {
37
- apiClient = await (0, emulator_js_1.getDataConnectEmulatorClient)(host);
38
- }
39
- else {
40
- apiClient = dataplane.dataconnectDataplaneClient();
41
- }
42
- const response = await dataplane.executeGraphQLRead(apiClient, serviceInfo.serviceName, {
43
- name: "",
44
- query,
45
- variables: (0, converter_js_1.parseVariables)(unparsedVariables),
46
- });
47
- return (0, converter_js_1.graphqlResponseToToolResponse)(response.body);
48
- });
@@ -1,62 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.execute_mutation = 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 dataplane = require("../../../dataconnect/dataplaneClient.js");
8
- const fileUtils_js_1 = require("../../../dataconnect/fileUtils.js");
9
- const converter_js_1 = require("./converter.js");
10
- const emulator_js_1 = require("./emulator.js");
11
- exports.execute_mutation = (0, tool_js_1.tool)({
12
- name: "execute_mutation",
13
- description: "Executes a deployed Data Connect mutation against a service or its emulator. Can read and write data.",
14
- inputSchema: zod_1.z.object({
15
- operationName: zod_1.z.string().describe("The name of the deployed operation you want to execute"),
16
- service_id: zod_1.z
17
- .string()
18
- .nullable()
19
- .describe("The Firebase Data Connect service ID to look for. If there is only one service defined in firebase.json, this can be omitted and that will be used."),
20
- connector_id: zod_1.z
21
- .string()
22
- .nullable()
23
- .describe("The Firebase Data Connect connector ID to look for. If there is only one connector defined in dataconnect.yaml, this can be omitted and that will be used."),
24
- variables: zod_1.z
25
- .string()
26
- .optional()
27
- .describe("A stringified JSON object containing the variables needed to execute the operation. The value MUST be able to be parsed as a JSON object."),
28
- use_emulator: zod_1.z.boolean().default(false).describe("Target the DataConnect emulator if true."),
29
- }),
30
- annotations: {
31
- title: "Execute Data Connect Connector Mutation",
32
- readOnlyHint: false,
33
- },
34
- _meta: {
35
- requiresProject: true,
36
- requiresAuth: true,
37
- },
38
- }, async ({ operationName, service_id, connector_id, variables: unparsedVariables, use_emulator }, { projectId, config, host }) => {
39
- const serviceInfo = await (0, fileUtils_js_1.pickService)(projectId, config, service_id || undefined);
40
- let apiClient;
41
- if (!connector_id) {
42
- if (serviceInfo.connectorInfo.length === 0) {
43
- return (0, util_js_1.mcpError)(`Service ${serviceInfo.serviceName} has no connectors`, "NO_CONNECTORS_FOUND");
44
- }
45
- if (serviceInfo.connectorInfo.length > 1) {
46
- return (0, util_js_1.mcpError)(`Service ${serviceInfo.serviceName} has more than one connector. Please use the connector_id argument to specify which connector this operation is part of.`, "MULTIPLE_CONNECTORS_FOUND");
47
- }
48
- connector_id = serviceInfo.connectorInfo[0].connectorYaml.connectorId;
49
- }
50
- const connectorPath = `${serviceInfo.serviceName}/connectors/${connector_id}`;
51
- if (use_emulator) {
52
- apiClient = await (0, emulator_js_1.getDataConnectEmulatorClient)(host);
53
- }
54
- else {
55
- apiClient = dataplane.dataconnectDataplaneClient();
56
- }
57
- const response = await dataplane.executeGraphQLMutation(apiClient, connectorPath, {
58
- operationName,
59
- variables: (0, converter_js_1.parseVariables)(unparsedVariables),
60
- });
61
- return (0, converter_js_1.graphqlResponseToToolResponse)(response.body);
62
- });
@@ -1,62 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.execute_query = 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 dataplane = require("../../../dataconnect/dataplaneClient.js");
8
- const fileUtils_js_1 = require("../../../dataconnect/fileUtils.js");
9
- const converter_js_1 = require("./converter.js");
10
- const emulator_js_1 = require("./emulator.js");
11
- exports.execute_query = (0, tool_js_1.tool)({
12
- name: "execute_query",
13
- description: "Executes a deployed Data Connect query against a service or its emulator. Cannot write any data.",
14
- inputSchema: zod_1.z.object({
15
- operationName: zod_1.z.string().describe("The name of the deployed operation you want to execute"),
16
- service_id: zod_1.z
17
- .string()
18
- .nullable()
19
- .describe("The Firebase Data Connect service ID to look for. If there is only one service defined in firebase.json, this can be omitted and that will be used."),
20
- connector_id: zod_1.z
21
- .string()
22
- .nullable()
23
- .describe("The Firebase Data Connect connector ID to look for. If there is only one connector defined in dataconnect.yaml, this can be omitted and that will be used."),
24
- variables: zod_1.z
25
- .string()
26
- .optional()
27
- .describe("A stringified JSON object containing the variables needed to execute the operation. The value MUST be able to be parsed as a JSON object."),
28
- use_emulator: zod_1.z.boolean().default(false).describe("Target the DataConnect emulator if true."),
29
- }),
30
- annotations: {
31
- title: "Executes a deployed Data Connect query.",
32
- readOnlyHint: true,
33
- },
34
- _meta: {
35
- requiresProject: true,
36
- requiresAuth: true,
37
- },
38
- }, async ({ operationName, service_id, connector_id, variables: unparsedVariables, use_emulator }, { projectId, config, host }) => {
39
- const serviceInfo = await (0, fileUtils_js_1.pickService)(projectId, config, service_id || undefined);
40
- let apiClient;
41
- if (!connector_id) {
42
- if (serviceInfo.connectorInfo.length === 0) {
43
- return (0, util_js_1.mcpError)(`Service ${serviceInfo.serviceName} has no connectors`, "NO_CONNECTORS_FOUND");
44
- }
45
- if (serviceInfo.connectorInfo.length > 1) {
46
- return (0, util_js_1.mcpError)(`Service ${serviceInfo.serviceName} has more than one connector. Please use the connector_id argument to specify which connector this operation is part of.`, "MULTIPLE_CONNECTORS_FOUND");
47
- }
48
- connector_id = serviceInfo.connectorInfo[0].connectorYaml.connectorId;
49
- }
50
- const connectorPath = `${serviceInfo.serviceName}/connectors/${connector_id}`;
51
- if (use_emulator) {
52
- apiClient = await (0, emulator_js_1.getDataConnectEmulatorClient)(host);
53
- }
54
- else {
55
- apiClient = dataplane.dataconnectDataplaneClient();
56
- }
57
- const response = await dataplane.executeGraphQLQuery(apiClient, connectorPath, {
58
- operationName,
59
- variables: (0, converter_js_1.parseVariables)(unparsedVariables),
60
- });
61
- return (0, converter_js_1.graphqlResponseToToolResponse)(response.body);
62
- });
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.get_connectors = 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 client = require("../../../dataconnect/client.js");
8
- const fileUtils_js_1 = require("../../../dataconnect/fileUtils.js");
9
- const converter_js_1 = require("./converter.js");
10
- exports.get_connectors = (0, tool_js_1.tool)({
11
- name: "get_connectors",
12
- description: "Get the Firebase Data Connect Connectors in the project, which includes the pre-defined GraphQL queries accessible to client SDKs.",
13
- inputSchema: zod_1.z.object({
14
- service_id: zod_1.z
15
- .string()
16
- .nullable()
17
- .describe("The Firebase Data Connect service ID to look for. If there is only one service defined in firebase.json, this can be omitted and that will be used."),
18
- }),
19
- annotations: {
20
- title: "Get Data Connect Connectors",
21
- readOnlyHint: true,
22
- },
23
- _meta: {
24
- requiresProject: true,
25
- requiresAuth: true,
26
- },
27
- }, async ({ service_id }, { projectId, config }) => {
28
- const serviceInfo = await (0, fileUtils_js_1.pickService)(projectId, config, service_id || undefined);
29
- const connectors = await client.listConnectors(serviceInfo.serviceName, ["*"]);
30
- return (0, util_js_1.toContent)(connectors.map(converter_js_1.connectorToText).join("\n\n"));
31
- });
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.get_schema = 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 client = require("../../../dataconnect/client.js");
8
- const fileUtils_js_1 = require("../../../dataconnect/fileUtils.js");
9
- const converter_js_1 = require("./converter.js");
10
- exports.get_schema = (0, tool_js_1.tool)({
11
- name: "get_schema",
12
- description: "Retrieve information about the Firebase Data Connect Schema in the project, including Cloud SQL data sources and the GraphQL Schema describing the data model.",
13
- inputSchema: zod_1.z.object({
14
- service_id: zod_1.z
15
- .string()
16
- .nullable()
17
- .describe("The Firebase Data Connect service ID to look for. If there is only one service defined in firebase.json, this can be omitted and that will be used."),
18
- }),
19
- annotations: {
20
- title: "Get Data Connect Schemas",
21
- readOnlyHint: true,
22
- },
23
- _meta: {
24
- requiresProject: true,
25
- requiresAuth: true,
26
- },
27
- }, async ({ service_id }, { projectId, config }) => {
28
- const serviceInfo = await (0, fileUtils_js_1.pickService)(projectId, config, service_id || undefined);
29
- const schemas = await client.listSchemas(serviceInfo.serviceName, ["*"]);
30
- return (0, util_js_1.toContent)(schemas?.map(converter_js_1.schemaToText).join("\n\n"));
31
- });