@@ -25,6 +25,7 @@ import type {
2525} from './tools/ToolDefinition.js' ;
2626import type { InsightName , TraceResult } from './trace-processing/parse.js' ;
2727import { getInsightOutput , getTraceSummary } from './trace-processing/parse.js' ;
28+ import type { InstalledExtension } from './utils/ExtensionRegistry.js' ;
2829import { paginate } from './utils/pagination.js' ;
2930import type { PaginationOptions } from './utils/types.js' ;
3031
@@ -60,6 +61,7 @@ export class McpResponse implements Response {
6061 types ?: string [ ] ;
6162 includePreservedMessages ?: boolean ;
6263 } ;
64+ #listExtensions?: boolean ;
6365 #devToolsData?: DevToolsData ;
6466 #tabId?: string ;
6567
@@ -81,6 +83,10 @@ export class McpResponse implements Response {
8183 } ;
8284 }
8385
86+ setListExtensions ( ) : void {
87+ this . #listExtensions = true ;
88+ }
89+
8490 setIncludeNetworkRequests (
8591 value : boolean ,
8692 options ?: PaginationOptions & {
@@ -99,9 +105,9 @@ export class McpResponse implements Response {
99105 pagination :
100106 options ?. pageSize || options ?. pageIdx
101107 ? {
102- pageSize : options . pageSize ,
103- pageIdx : options . pageIdx ,
104- }
108+ pageSize : options . pageSize ,
109+ pageIdx : options . pageIdx ,
110+ }
105111 : undefined ,
106112 resourceTypes : options ?. resourceTypes ,
107113 includePreservedRequests : options ?. includePreservedRequests ,
@@ -126,9 +132,9 @@ export class McpResponse implements Response {
126132 pagination :
127133 options ?. pageSize || options ?. pageIdx
128134 ? {
129- pageSize : options . pageSize ,
130- pageIdx : options . pageIdx ,
131- }
135+ pageSize : options . pageSize ,
136+ pageIdx : options . pageIdx ,
137+ }
132138 : undefined ,
133139 types : options ?. types ,
134140 includePreservedMessages : options ?. includePreservedMessages ,
@@ -297,6 +303,11 @@ export class McpResponse implements Response {
297303 }
298304 }
299305
306+ let extensions : InstalledExtension [ ] | undefined ;
307+ if ( this . #listExtensions) {
308+ extensions = context . listExtensions ( ) ;
309+ }
310+
300311 let consoleMessages : Array < ConsoleFormatter | IssueFormatter > | undefined ;
301312 if ( this . #consoleDataOptions?. include ) {
302313 let messages = context . getConsoleData (
@@ -395,6 +406,7 @@ export class McpResponse implements Response {
395406 networkRequests,
396407 traceInsight : this . #attachedTraceInsight,
397408 traceSummary : this . #attachedTraceSummary,
409+ extensions,
398410 } ) ;
399411 }
400412
@@ -409,6 +421,7 @@ export class McpResponse implements Response {
409421 networkRequests ?: NetworkFormatter [ ] ;
410422 traceSummary ?: TraceResult ;
411423 traceInsight ?: TraceInsightData ;
424+ extensions ?: InstalledExtension [ ] ;
412425 } ,
413426 ) : { content : Array < TextContent | ImageContent > ; structuredContent : object } {
414427 const response = [ `# ${ toolName } response` ] ;
@@ -474,6 +487,7 @@ Call ${handleDialog.name} to handle it before continuing.`);
474487 consoleMessages ?: object [ ] ;
475488 traceSummary ?: string ;
476489 traceInsights ?: Array < { insightName : string ; insightKey : string } > ;
490+ extensions ?: object [ ] ;
477491 } = { } ;
478492
479493 if ( this . #tabId) {
@@ -531,6 +545,25 @@ Call ${handleDialog.name} to handle it before continuing.`);
531545 data . detailedConsoleMessage . toJSONDetailed ( ) ;
532546 }
533547
548+ if ( data . extensions ) {
549+ structuredContent . extensions = data . extensions ;
550+ response . push ( '## Extensions' ) ;
551+ if ( data . extensions . length === 0 ) {
552+ response . push ( 'No extensions installed.' ) ;
553+ } else {
554+ const parts = [ ] ;
555+ for ( const extension of data . extensions ) {
556+ parts . push ( [
557+ `Name: ${ extension . name } ` ,
558+ `ID: ${ extension . id } ` ,
559+ `Version: ${ extension . version } ` ,
560+ `Status: ${ extension . isEnabled ? 'Enabled' : 'Disabled' } ` ,
561+ ] . join ( '\n' ) ) ;
562+ }
563+ response . push ( parts . join ( '\n\n' ) ) ;
564+ }
565+ }
566+
534567 if ( this . #networkRequestsOptions?. include ) {
535568 let requests = context . getNetworkRequests (
536569 this . #networkRequestsOptions?. includePreservedRequests ,
0 commit comments