File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 207207 "pathPattern" : " /drives/{drive-id}/items/{driveItem-id}/content" ,
208208 "method" : " get" ,
209209 "toolName" : " download-onedrive-file-content" ,
210- "scopes" : [" Files.Read" ]
210+ "scopes" : [" Files.Read" ],
211+ "returnDownloadUrl" : true
211212 },
212213 {
213214 "pathPattern" : " /drives/{drive-id}/items/{driveItem-id}" ,
278279 "pathPattern" : " /me/onenote/pages/{onenotePage-id}/content" ,
279280 "method" : " get" ,
280281 "toolName" : " get-onenote-page-content" ,
281- "scopes" : [" Notes.Read" ]
282+ "scopes" : [" Notes.Read" ],
283+ "returnDownloadUrl" : true
282284 },
283285 {
284286 "pathPattern" : " /me/onenote/pages" ,
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ interface EndpointConfig {
1616 toolName : string ;
1717 scopes ?: string [ ] ;
1818 workScopes ?: string [ ] ;
19+ returnDownloadUrl ?: boolean ;
1920}
2021
2122const endpointsData = JSON . parse (
@@ -261,7 +262,12 @@ export function registerGraphTools(
261262 tool . errors ?. some ( ( error ) => error . description === 'Retrieved media content' ) ||
262263 path . endsWith ( '/content' ) ;
263264
264- if ( isProbablyMediaContent ) {
265+ if ( endpointConfig ?. returnDownloadUrl && path . endsWith ( '/content' ) ) {
266+ path = path . replace ( / \/ c o n t e n t $ / , '' ) ;
267+ logger . info (
268+ `Auto-returning download URL for ${ tool . alias } (returnDownloadUrl=true in endpoints.json)`
269+ ) ;
270+ } else if ( isProbablyMediaContent ) {
265271 options . rawResponse = true ;
266272 }
267273
You can’t perform that action at this time.
0 commit comments