@@ -78,7 +78,7 @@ export const addTool: ToolEntry = {
7878 ajvValidate : ajv . compile ( zodToJsonSchema ( addToolArgsSchema ) ) ,
7979 // TODO: I don't like that we are passing apifyMcpServer and mcpServer to the tool
8080 call : async ( toolArgs ) => {
81- const { apifyMcpServer, apifyToken, args, extra } = toolArgs ;
81+ const { apifyMcpServer, apifyToken, args, extra : { sendNotification } } = toolArgs ;
8282 const parsed = addToolArgsSchema . parse ( args ) ;
8383 if ( apifyMcpServer . listAllToolNames ( ) . includes ( parsed . actorName ) ) {
8484 return {
@@ -90,7 +90,7 @@ export const addTool: ToolEntry = {
9090 }
9191 const tools = await getActorsAsTools ( [ parsed . actorName ] , apifyToken ) ;
9292 const toolsAdded = apifyMcpServer . upsertTools ( tools , true ) ;
93- await extra . sendNotification ( { method : 'notifications/tools/list_changed' } ) ;
93+ await sendNotification ( { method : 'notifications/tools/list_changed' } ) ;
9494
9595 return {
9696 content : [ {
@@ -121,13 +121,13 @@ export const removeTool: ToolEntry = {
121121 ajvValidate : ajv . compile ( zodToJsonSchema ( removeToolArgsSchema ) ) ,
122122 // TODO: I don't like that we are passing apifyMcpServer and mcpServer to the tool
123123 call : async ( toolArgs ) => {
124- const { apifyMcpServer, args, extra } = toolArgs ;
124+ const { apifyMcpServer, args, extra : { sendNotification } } = toolArgs ;
125125 const parsed = removeToolArgsSchema . parse ( args ) ;
126126 // Check if tool exists before attempting removal
127127 if ( ! apifyMcpServer . tools . has ( parsed . toolName ) ) {
128128 // Send notification so client can update its tool list
129129 // just in case the client tool list is out of sync
130- await extra . sendNotification ( { method : 'notifications/tools/list_changed' } ) ;
130+ await sendNotification ( { method : 'notifications/tools/list_changed' } ) ;
131131 return {
132132 content : [ {
133133 type : 'text' ,
@@ -136,7 +136,7 @@ export const removeTool: ToolEntry = {
136136 } ;
137137 }
138138 const removedTools = apifyMcpServer . removeToolsByName ( [ parsed . toolName ] , true ) ;
139- await extra . sendNotification ( { method : 'notifications/tools/list_changed' } ) ;
139+ await sendNotification ( { method : 'notifications/tools/list_changed' } ) ;
140140 return { content : [ { type : 'text' , text : `Tools removed: ${ removedTools . join ( ', ' ) } ` } ] } ;
141141 } ,
142142 } as InternalTool ,
0 commit comments