@@ -26,8 +26,10 @@ import log from '@apify/log';
2626
2727import { ApifyClient } from '../apify-client.js' ;
2828import {
29+ HelperTools ,
2930 SERVER_NAME ,
3031 SERVER_VERSION ,
32+ SKYFIRE_PAY_ID_PROPERTY_DESCRIPTION ,
3133 SKYFIRE_README_CONTENT ,
3234 SKYFIRE_TOOL_INSTRUCTIONS ,
3335} from '../const.js' ;
@@ -261,28 +263,28 @@ export class ActorsMcpServer {
261263 this . tools . set ( wrap . tool . name , wrap ) ;
262264 }
263265 // Handle Skyfire mode modifications once per tool upsert
264- // if (this.options.skyfireMode) {
265- // for (const wrap of tools) {
266- // if (wrap.type === 'actor'
267- // || (wrap.type === 'internal' && wrap.tool.name === HelperTools.ACTOR_CALL)
268- // || (wrap.type === 'internal' && wrap.tool.name === HelperTools.ACTOR_OUTPUT_GET)) {
269- // // Add Skyfire instructions to description if not already present
270- // if (!wrap.tool.description.includes(SKYFIRE_TOOL_INSTRUCTIONS)) {
271- // wrap.tool.description += `\n\n${SKYFIRE_TOOL_INSTRUCTIONS}`;
272- // }
273- // // Add skyfire-pay-id property if not present
274- // if (wrap.tool.inputSchema && 'properties' in wrap.tool.inputSchema) {
275- // const props = wrap.tool.inputSchema.properties as Record<string, unknown>;
276- // if (!props['skyfire-pay-id']) {
277- // props['skyfire-pay-id'] = {
278- // type: 'string',
279- // description: SKYFIRE_PAY_ID_PROPERTY_DESCRIPTION,
280- // };
281- // }
282- // }
283- // }
284- // }
285- // }
266+ if ( this . options . skyfireMode ) {
267+ for ( const wrap of tools ) {
268+ if ( wrap . type === 'actor'
269+ || ( wrap . type === 'internal' && wrap . tool . name === HelperTools . ACTOR_CALL )
270+ || ( wrap . type === 'internal' && wrap . tool . name === HelperTools . ACTOR_OUTPUT_GET ) ) {
271+ // Add Skyfire instructions to description if not already present
272+ if ( ! wrap . tool . description . includes ( SKYFIRE_TOOL_INSTRUCTIONS ) ) {
273+ wrap . tool . description += `\n\n${ SKYFIRE_TOOL_INSTRUCTIONS } ` ;
274+ }
275+ // Add skyfire-pay-id property if not present
276+ if ( wrap . tool . inputSchema && 'properties' in wrap . tool . inputSchema ) {
277+ const props = wrap . tool . inputSchema . properties as Record < string , unknown > ;
278+ if ( ! props [ 'skyfire-pay-id' ] ) {
279+ props [ 'skyfire-pay-id' ] = {
280+ type : 'string' ,
281+ description : SKYFIRE_PAY_ID_PROPERTY_DESCRIPTION ,
282+ } ;
283+ }
284+ }
285+ }
286+ }
287+ }
286288 if ( shouldNotifyToolsChangedHandler ) this . notifyToolsChangedHandler ( ) ;
287289 return tools ;
288290 }
0 commit comments