firebase-tools 14.15.0 → 14.15.2

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 (41) hide show
  1. package/lib/command.js +19 -5
  2. package/lib/commands/dataconnect-sdk-generate.js +28 -24
  3. package/lib/commands/init.js +8 -0
  4. package/lib/deploy/functions/build.js +2 -13
  5. package/lib/deploy/functions/prepare.js +2 -1
  6. package/lib/deploy/functions/runtimes/discovery/index.js +1 -1
  7. package/lib/emulator/auth/operations.js +10 -1
  8. package/lib/emulator/dataconnectEmulator.js +27 -24
  9. package/lib/emulator/functionsEmulator.js +1 -1
  10. package/lib/emulator/hub.js +2 -4
  11. package/lib/experiments.js +5 -0
  12. package/lib/functions/env.js +12 -1
  13. package/lib/init/features/dataconnect/index.js +10 -25
  14. package/lib/init/features/dataconnect/sdk.js +0 -1
  15. package/lib/init/features/index.js +1 -2
  16. package/lib/init/index.js +0 -1
  17. package/lib/mcp/index.js +1 -1
  18. package/lib/mcp/prompts/core/deploy.js +1 -1
  19. package/lib/mcp/prompts/dataconnect/index.js +9 -0
  20. package/lib/mcp/prompts/dataconnect/schema.js +68 -0
  21. package/lib/mcp/prompts/index.js +2 -1
  22. package/lib/mcp/tools/core/init.js +11 -2
  23. package/lib/mcp/tools/dataconnect/compile.js +43 -0
  24. package/lib/mcp/tools/dataconnect/execute.js +71 -0
  25. package/lib/mcp/tools/dataconnect/index.js +6 -14
  26. package/lib/mcp/tools/dataconnect/info.js +120 -0
  27. package/lib/mcp/tools/firestore/list_collections.js +0 -3
  28. package/lib/mcp/tools/index.js +3 -0
  29. package/lib/mcp/util/dataconnect/compile.js +18 -0
  30. package/lib/mcp/util/dataconnect/content.js +655 -0
  31. package/lib/track.js +16 -0
  32. package/package.json +1 -1
  33. package/lib/mcp/tools/dataconnect/execute_graphql.js +0 -48
  34. package/lib/mcp/tools/dataconnect/execute_graphql_read.js +0 -48
  35. package/lib/mcp/tools/dataconnect/execute_mutation.js +0 -62
  36. package/lib/mcp/tools/dataconnect/execute_query.js +0 -62
  37. package/lib/mcp/tools/dataconnect/get_connector.js +0 -31
  38. package/lib/mcp/tools/dataconnect/get_schema.js +0 -31
  39. package/lib/mcp/tools/dataconnect/list_services.js +0 -23
  40. /package/lib/mcp/{tools → util}/dataconnect/converter.js +0 -0
  41. /package/lib/mcp/{tools → util}/dataconnect/emulator.js +0 -0
@@ -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_1 = require("../../tool");
6
- const dataplane = require("../../../dataconnect/dataplaneClient");
7
- const load_1 = require("../../../dataconnect/load");
8
- const converter_1 = require("./converter");
9
- const emulator_1 = require("./emulator");
10
- exports.execute_graphql = (0, tool_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, load_1.pickService)(projectId, config, service_id || undefined);
35
- let apiClient;
36
- if (use_emulator) {
37
- apiClient = await (0, emulator_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_1.parseVariables)(unparsedVariables),
46
- });
47
- return (0, converter_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_1 = require("../../tool");
6
- const dataplane = require("../../../dataconnect/dataplaneClient");
7
- const load_1 = require("../../../dataconnect/load");
8
- const converter_1 = require("./converter");
9
- const emulator_1 = require("./emulator");
10
- exports.execute_graphql_read = (0, tool_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, load_1.pickService)(projectId, config, service_id || undefined);
35
- let apiClient;
36
- if (use_emulator) {
37
- apiClient = await (0, emulator_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_1.parseVariables)(unparsedVariables),
46
- });
47
- return (0, converter_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_1 = require("../../tool");
6
- const util_1 = require("../../util");
7
- const dataplane = require("../../../dataconnect/dataplaneClient");
8
- const load_1 = require("../../../dataconnect/load");
9
- const converter_1 = require("./converter");
10
- const emulator_1 = require("./emulator");
11
- exports.execute_mutation = (0, tool_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, load_1.pickService)(projectId, config, service_id || undefined);
40
- let apiClient;
41
- if (!connector_id) {
42
- if (serviceInfo.connectorInfo.length === 0) {
43
- return (0, util_1.mcpError)(`Service ${serviceInfo.serviceName} has no connectors`, "NO_CONNECTORS_FOUND");
44
- }
45
- if (serviceInfo.connectorInfo.length > 1) {
46
- return (0, util_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_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_1.parseVariables)(unparsedVariables),
60
- });
61
- return (0, converter_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_1 = require("../../tool");
6
- const util_1 = require("../../util");
7
- const dataplane = require("../../../dataconnect/dataplaneClient");
8
- const load_1 = require("../../../dataconnect/load");
9
- const converter_1 = require("./converter");
10
- const emulator_1 = require("./emulator");
11
- exports.execute_query = (0, tool_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, load_1.pickService)(projectId, config, service_id || undefined);
40
- let apiClient;
41
- if (!connector_id) {
42
- if (serviceInfo.connectorInfo.length === 0) {
43
- return (0, util_1.mcpError)(`Service ${serviceInfo.serviceName} has no connectors`, "NO_CONNECTORS_FOUND");
44
- }
45
- if (serviceInfo.connectorInfo.length > 1) {
46
- return (0, util_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_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_1.parseVariables)(unparsedVariables),
60
- });
61
- return (0, converter_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_1 = require("../../tool");
6
- const util_1 = require("../../util");
7
- const client = require("../../../dataconnect/client");
8
- const load_1 = require("../../../dataconnect/load");
9
- const converter_1 = require("./converter");
10
- exports.get_connectors = (0, tool_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, load_1.pickService)(projectId, config, service_id || undefined);
29
- const connectors = await client.listConnectors(serviceInfo.serviceName, ["*"]);
30
- return (0, util_1.toContent)(connectors.map(converter_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_1 = require("../../tool");
6
- const util_1 = require("../../util");
7
- const client = require("../../../dataconnect/client");
8
- const load_1 = require("../../../dataconnect/load");
9
- const converter_1 = require("./converter");
10
- exports.get_schema = (0, tool_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, load_1.pickService)(projectId, config, service_id || undefined);
29
- const schemas = await client.listSchemas(serviceInfo.serviceName, ["*"]);
30
- return (0, util_1.toContent)(schemas === null || schemas === void 0 ? void 0 : schemas.map(converter_1.schemaToText).join("\n\n"));
31
- });
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.list_services = void 0;
4
- const zod_1 = require("zod");
5
- const tool_1 = require("../../tool");
6
- const util_1 = require("../../util");
7
- const client = require("../../../dataconnect/client");
8
- exports.list_services = (0, tool_1.tool)({
9
- name: "list_services",
10
- description: "List the Firebase Data Connect services available in the current project.",
11
- inputSchema: zod_1.z.object({}),
12
- annotations: {
13
- title: "List Data Connect Services",
14
- readOnlyHint: true,
15
- },
16
- _meta: {
17
- requiresProject: true,
18
- requiresAuth: true,
19
- },
20
- }, async (_, { projectId }) => {
21
- const services = await client.listAllServices(projectId);
22
- return (0, util_1.toContent)(services, { format: "yaml" });
23
- });
File without changes