@@ -16,6 +16,7 @@ import {
1616 uninstallExtension ,
1717 listExtensions ,
1818 reloadExtension ,
19+ triggerExtensionAction ,
1920} from '../../src/tools/extensions.js' ;
2021import { withMcpContext } from '../utils.js' ;
2122
@@ -128,4 +129,39 @@ describe('extension', () => {
128129 assert . ok ( reinstalled , 'Extension should be present after reload' ) ;
129130 } ) ;
130131 } ) ;
132+
133+ it ( 'triggers an extension action' , async ( ) => {
134+ await withMcpContext (
135+ async ( response , context ) => {
136+ const triggerSpy = sinon . spy ( context , 'triggerExtensionAction' ) ;
137+
138+ await installExtension . handler (
139+ { params : { path : EXTENSION_PATH } } ,
140+ response ,
141+ context ,
142+ ) ;
143+
144+ const extensionId = extractId ( response ) ;
145+ response . resetResponseLineForTesting ( ) ;
146+
147+ await triggerExtensionAction . handler (
148+ { params : { id : extensionId } } ,
149+ response ,
150+ context ,
151+ ) ;
152+
153+ assert . ok (
154+ triggerSpy . calledOnceWithExactly ( extensionId ) ,
155+ 'triggerExtensionAction should be called with correct params' ,
156+ ) ;
157+ assert . ok (
158+ response . responseLines [ 0 ] . includes (
159+ `Extension action triggered. Id: ${ extensionId } ` ,
160+ ) ,
161+ 'Response should indicate action triggered' ,
162+ ) ;
163+ } ,
164+ { channel : 'chrome-canary' } ,
165+ ) ;
166+ } ) ;
131167} ) ;
0 commit comments