@@ -4,7 +4,7 @@ import { toContent } from "../../util.js";
4
4
import { getFirebaseProjectPage } from "../../../management/projects.js" ;
5
5
import { FirebaseProjectMetadata } from "../../../types/project/index.d.js" ;
6
6
7
- const PROJECT_LIST_PAGE_SIZE = 10 ;
7
+ const PROJECT_LIST_PAGE_SIZE = 20 ;
8
8
9
9
export const list_projects = tool (
10
10
{
@@ -15,7 +15,7 @@ export const list_projects = tool(
15
15
. number ( )
16
16
. min ( 1 )
17
17
. default ( PROJECT_LIST_PAGE_SIZE )
18
- . describe ( "the number of projects to list per page (defaults to 10 )" ) ,
18
+ . describe ( "the number of projects to list per page (defaults to 1000 )" ) ,
19
19
page_token : z
20
20
. string ( )
21
21
. optional ( )
@@ -31,18 +31,24 @@ export const list_projects = tool(
31
31
} ,
32
32
} ,
33
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
- }
34
+ try {
35
+ const projectPage = await getFirebaseProjectPage ( page_size , page_token ) ;
41
36
42
- return toContent ( {
43
- message,
44
- projects : projectPage . projects ,
45
- next_page_token : projectPage . nextPageToken ,
46
- } ) ;
37
+ return toContent (
38
+ {
39
+ projects : projectPage . projects ,
40
+ next_page_token : projectPage . nextPageToken ,
41
+ } ,
42
+ {
43
+ contentPrefix : `Here are ${ projectPage . projects . length } Firebase projects${ page_token ? " (continued)" : "" } :\n\n` ,
44
+ contentSuffix : projectPage . nextPageToken
45
+ ? "\nThere are more projects available. To see the next page, call this tool again with the next_page_token shown above."
46
+ : "" ,
47
+ } ,
48
+ ) ;
49
+ } catch ( err : any ) {
50
+ const originalMessage = err . original ? `: ${ err . original . message } ` : "" ;
51
+ throw new Error ( `Failed to list Firebase projects${ originalMessage } ` ) ;
52
+ }
47
53
} ,
48
54
) ;
0 commit comments