File tree Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -11,11 +11,13 @@ import { init } from "./init.js";
11
11
import { get_environment } from "./get_environment.js" ;
12
12
import { update_environment } from "./update_environment.js" ;
13
13
// import { consult_assistant } from "./consult_assistant.js";
14
+ import { list_projects } from "./list_projects.js" ;
14
15
15
16
export const coreTools : ServerTool [ ] = [
16
17
get_project ,
17
18
list_apps ,
18
19
get_admin_sdk_config ,
20
+ list_projects ,
19
21
get_sdk_config ,
20
22
create_project ,
21
23
create_app ,
Original file line number Diff line number Diff line change
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
+ ) ;
You can’t perform that action at this time.
0 commit comments