@@ -262,6 +262,29 @@ export class ActorsMcpServer {
262262 for ( const wrap of tools ) {
263263 this . tools . set ( wrap . tool . name , wrap ) ;
264264 }
265+ // Handle Skyfire mode modifications once per tool upsert
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+ }
265288 if ( shouldNotifyToolsChangedHandler ) this . notifyToolsChangedHandler ( ) ;
266289 return tools ;
267290 }
@@ -419,26 +442,6 @@ export class ActorsMcpServer {
419442 * @returns {object } - The response object containing the tools.
420443 */
421444 this . server . setRequestHandler ( ListToolsRequestSchema , async ( ) => {
422- /**
423- * Hack for the Skyfire agentic payments, we check if Skyfire mode is enabled we ad-hoc add
424- * the `skyfire-pay-id` input property to all Actor tools and `call-actor` and `get-actor-output` tool.
425- */
426- if ( this . options . skyfireMode ) {
427- for ( const toolEntry of this . tools . values ( ) ) {
428- if ( toolEntry . type === 'actor'
429- || ( toolEntry . type === 'internal' && toolEntry . tool . name === HelperTools . ACTOR_CALL )
430- || ( toolEntry . type === 'internal' && toolEntry . tool . name === HelperTools . ACTOR_OUTPUT_GET ) ) {
431- if ( toolEntry . tool . inputSchema && 'properties' in toolEntry . tool . inputSchema ) {
432- ( toolEntry . tool . inputSchema . properties as Record < string , unknown > ) [ 'skyfire-pay-id' ] = {
433- type : 'string' ,
434- description : SKYFIRE_PAY_ID_PROPERTY_DESCRIPTION ,
435- } ;
436- }
437- // Update description to include Skyfire instructions
438- toolEntry . tool . description += `\n\n${ SKYFIRE_TOOL_INSTRUCTIONS } ` ;
439- }
440- }
441- }
442445 const tools = Array . from ( this . tools . values ( ) ) . map ( ( tool ) => getToolPublicFieldOnly ( tool . tool ) ) ;
443446 return { tools } ;
444447 } ) ;
0 commit comments