Skip to content

Commit c6042a7

Browse files
committed
Initital work
1 parent 0ce9ffa commit c6042a7

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

src/mcp/tools/core/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ import { init } from "./init.js";
1111
import { get_environment } from "./get_environment.js";
1212
import { update_environment } from "./update_environment.js";
1313
// import { consult_assistant } from "./consult_assistant.js";
14+
import { list_projects } from "./list_projects.js";
1415

1516
export const coreTools: ServerTool[] = [
1617
get_project,
1718
list_apps,
1819
get_admin_sdk_config,
20+
list_projects,
1921
get_sdk_config,
2022
create_project,
2123
create_app,
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { z } from "zod";
2+
import { tool } from "../../tool.js";
3+
import { toContent } from "../../util.js";
4+
import { getFirebaseProjectPage } from "../../../management/projects.js";
5+
import { FirebaseProjectMetadata } from "../../../types/project/index.d.js";
6+
7+
const PROJECT_LIST_PAGE_SIZE = 10;
8+
9+
export const list_projects = tool(
10+
{
11+
name: "list_projects",
12+
description: "Retrieves a list of Firebase projects up to the specified total count.",
13+
inputSchema: z.object({
14+
page_size: z
15+
.number()
16+
.min(1)
17+
.default(PROJECT_LIST_PAGE_SIZE)
18+
.describe("the number of projects to list per page (defaults to 10)"),
19+
page_token: z
20+
.string()
21+
.optional()
22+
.describe("the page token to start listing from"),
23+
}),
24+
annotations: {
25+
title: "List Firebase Projects",
26+
readOnlyHint: true,
27+
idempotentHint: true,
28+
},
29+
_meta: {
30+
requiresAuth: true,
31+
},
32+
},
33+
async ({ page_size, page_token }) => {
34+
const projectPage = await getFirebaseProjectPage(page_size, page_token);
35+
36+
let message = "";
37+
if (projectPage.nextPageToken) {
38+
message = `Here are ${projectPage.projects.length} Firebase projects.\n\n` +
39+
`To list more projects, call this tool again with page_token: "${projectPage.nextPageToken}"`;
40+
}
41+
42+
return toContent({
43+
message,
44+
projects: projectPage.projects,
45+
next_page_token: projectPage.nextPageToken,
46+
});
47+
},
48+
);

0 commit comments

Comments
 (0)