@@ -32,32 +32,28 @@ export const get_documents = tool(
3232 if ( ! projectId ) return NO_PROJECT_ERROR ;
3333 if ( ! paths . length ) return mcpError ( "Must supply at least one document path." ) ;
3434
35- try {
36- const { documents, missing } = await getDocuments ( projectId , paths ) ;
37- if ( missing . length > 0 && documents . length === 0 ) {
38- return mcpError ( `None of the specified documents were found in project '${ projectId } '` ) ;
39- }
35+ const { documents, missing } = await getDocuments ( projectId , paths ) ;
36+ if ( missing . length > 0 && documents . length === 0 ) {
37+ return mcpError ( `None of the specified documents were found in project '${ projectId } '` ) ;
38+ }
4039
41- const docs = documents . map ( firestoreDocumentToJson ) ;
40+ const docs = documents . map ( firestoreDocumentToJson ) ;
4241
43- if ( documents . length === 1 && missing . length === 0 ) {
44- // return a single document as YAML if that's all we have/need
45- return toContent ( docs [ 0 ] ) ;
46- }
47- const docsContent = toContent ( docs ) ;
48- if ( missing . length ) {
49- docsContent . content = [
50- { type : "text" , text : "Retrieved documents:\n\n" } ,
51- ...docsContent . content ,
52- {
53- type : "text" ,
54- text : `The following documents do not exist: ${ missing . join ( ", " ) } ` ,
55- } ,
56- ] ;
57- }
58- return docsContent ;
59- } catch ( e ) {
60- return mcpError ( e ) ;
42+ if ( documents . length === 1 && missing . length === 0 ) {
43+ // return a single document as YAML if that's all we have/need
44+ return toContent ( docs [ 0 ] ) ;
45+ }
46+ const docsContent = toContent ( docs ) ;
47+ if ( missing . length ) {
48+ docsContent . content = [
49+ { type : "text" , text : "Retrieved documents:\n\n" } ,
50+ ...docsContent . content ,
51+ {
52+ type : "text" ,
53+ text : `The following documents do not exist: ${ missing . join ( ", " ) } ` ,
54+ } ,
55+ ] ;
6156 }
57+ return docsContent ;
6258 } ,
6359) ;
0 commit comments