Skip to content

Commit 9f64df6

Browse files
authored
[MCP] Add a list_dataconnect_services MCP tool (#8485)
1 parent 835aa7f commit 9f64df6

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

src/mcp/tools/dataconnect/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import type { ServerTool } from "../../tool.js";
2+
3+
import { list_dataconnect_services } from "./list_dataconnect_services.js";
4+
5+
export const dataconnectTools: ServerTool[] = [list_dataconnect_services];
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { z } from "zod";
2+
import { tool } from "../../tool.js";
3+
import { toContent } from "../../util.js";
4+
import * as client from "../../../dataconnect/client";
5+
import { NO_PROJECT_ERROR } from "../../errors.js";
6+
7+
export const list_dataconnect_services = tool(
8+
{
9+
name: "list_dataconnect_services",
10+
description: "List the Firebase Data Connect services available in the current project.",
11+
inputSchema: z.object({}),
12+
annotations: {
13+
title: "List the Firebase Data Connect Services that's available in the backend",
14+
readOnlyHint: true,
15+
},
16+
_meta: {
17+
requiresProject: true,
18+
},
19+
},
20+
async (_, { projectId }) => {
21+
if (!projectId) return NO_PROJECT_ERROR;
22+
const services = await client.listAllServices(projectId);
23+
return toContent(services, { format: "yaml" });
24+
},
25+
);

src/mcp/tools/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import { ServerTool } from "../tool.js";
22
import { ServerFeature } from "../types.js";
33
import { authTools } from "./auth/index.js";
4+
import { dataconnectTools } from "./dataconnect/index.js";
45
import { firestoreTools } from "./firestore/index.js";
56
import { projectTools } from "./project/index.js";
67

78
export const tools: Record<ServerFeature, ServerTool[]> = {
89
project: projectTools,
910
firestore: firestoreTools,
1011
auth: authTools,
11-
dataconnect: [],
12+
dataconnect: dataconnectTools,
1213
storage: [],
1314
};

0 commit comments

Comments
 (0)