File tree Expand file tree Collapse file tree 2 files changed +22
-10
lines changed Expand file tree Collapse file tree 2 files changed +22
-10
lines changed Original file line number Diff line number Diff line change @@ -45,8 +45,8 @@ export interface IToolData {
45
45
46
46
export interface IToolProgressStep {
47
47
readonly message : string | IMarkdownString | undefined ;
48
- readonly increment : number | undefined ;
49
- readonly total : number | undefined ;
48
+ readonly increment ? : number ;
49
+ readonly total ? : number ;
50
50
}
51
51
52
52
export type ToolProgress = IProgress < IToolProgressStep > ;
Original file line number Diff line number Diff line change @@ -280,18 +280,30 @@ class McpToolImplementation implements IToolImpl {
280
280
} ;
281
281
282
282
for ( const item of callResult . content ) {
283
+ const audience = item . annotations ?. audience || [ 'assistant' ] ;
284
+ if ( audience . includes ( 'user' ) ) {
285
+ if ( item . type === 'text' ) {
286
+ progress . report ( { message : item . text } ) ;
287
+ }
288
+ }
289
+
290
+ const isForModel = audience . includes ( 'assistant' ) ;
283
291
if ( item . type === 'text' ) {
284
292
details . output . push ( { type : 'text' , value : item . text } ) ;
285
- result . content . push ( {
286
- kind : 'text' ,
287
- value : item . text
288
- } ) ;
293
+ if ( isForModel ) {
294
+ result . content . push ( {
295
+ kind : 'text' ,
296
+ value : item . text
297
+ } ) ;
298
+ }
289
299
} else if ( item . type === 'image' || item . type === 'audio' ) {
290
300
details . output . push ( { type : 'data' , mimeType : item . mimeType , value64 : item . data } ) ;
291
- result . content . push ( {
292
- kind : 'data' ,
293
- value : { mimeType : item . mimeType , data : decodeBase64 ( item . data ) }
294
- } ) ;
301
+ if ( isForModel ) {
302
+ result . content . push ( {
303
+ kind : 'data' ,
304
+ value : { mimeType : item . mimeType , data : decodeBase64 ( item . data ) }
305
+ } ) ;
306
+ }
295
307
} else {
296
308
// unsupported for now.
297
309
}
You can’t perform that action at this time.
0 commit comments