@@ -37,7 +37,7 @@ import {
3737import { prompts } from '../prompts/index.js' ;
3838import { callActorGetDataset , defaultTools , getActorsAsTools , toolCategories } from '../tools/index.js' ;
3939import { decodeDotPropertyNames } from '../tools/utils.js' ;
40- import type { ActorMcpTool , ActorTool , HelperTool , ToolEntry } from '../types.js' ;
40+ import type { ToolEntry } from '../types.js' ;
4141import { buildActorResponseContent } from '../utils/actor-response.js' ;
4242import { buildMCPResponse } from '../utils/mcp.js' ;
4343import { createProgressTracker } from '../utils/progress.js' ;
@@ -142,7 +142,7 @@ export class ActorsMcpServer {
142142 private listInternalToolNames ( ) : string [ ] {
143143 return Array . from ( this . tools . values ( ) )
144144 . filter ( ( tool ) => tool . type === 'internal' )
145- . map ( ( tool ) => ( tool as HelperTool ) . name ) ;
145+ . map ( ( tool ) => tool . name ) ;
146146 }
147147
148148 /**
@@ -152,7 +152,7 @@ export class ActorsMcpServer {
152152 public listActorToolNames ( ) : string [ ] {
153153 return Array . from ( this . tools . values ( ) )
154154 . filter ( ( tool ) => tool . type === 'actor' )
155- . map ( ( tool ) => ( tool as ActorTool ) . actorFullName ) ;
155+ . map ( ( tool ) => tool . actorFullName ) ;
156156 }
157157
158158 /**
@@ -162,7 +162,7 @@ export class ActorsMcpServer {
162162 private listActorMcpServerToolIds ( ) : string [ ] {
163163 const ids = Array . from ( this . tools . values ( ) )
164164 . filter ( ( tool : ToolEntry ) => tool . type === 'actor-mcp' )
165- . map ( ( tool : ToolEntry ) => ( tool as ActorMcpTool ) . actorId ) ;
165+ . map ( ( tool ) => tool . actorId ) ;
166166 // Ensure uniqueness
167167 return Array . from ( new Set ( ids ) ) ;
168168 }
@@ -504,7 +504,7 @@ export class ActorsMcpServer {
504504 // TODO - if connection is /mcp client will not receive notification on tool change
505505 // Find tool by name or actor full name
506506 const tool = Array . from ( this . tools . values ( ) )
507- . find ( ( t ) => t . name === name || ( t . type === 'actor' && ( t as ActorTool ) . actorFullName === name ) ) ;
507+ . find ( ( t ) => t . name === name || ( t . type === 'actor' && t . actorFullName === name ) ) ;
508508 if ( ! tool ) {
509509 const msg = `Tool ${ name } not found. Available tools: ${ this . listToolNames ( ) . join ( ', ' ) } ` ;
510510 log . error ( msg ) ;
@@ -540,15 +540,13 @@ export class ActorsMcpServer {
540540 try {
541541 // Handle internal tool
542542 if ( tool . type === 'internal' ) {
543- const internalTool = tool as HelperTool ;
544-
545543 // Only create progress tracker for call-actor tool
546- const progressTracker = internalTool . name === 'call-actor'
544+ const progressTracker = tool . name === 'call-actor'
547545 ? createProgressTracker ( progressToken , extra . sendNotification )
548546 : null ;
549547
550- log . info ( 'Calling internal tool' , { name : internalTool . name , input : args } ) ;
551- const res = await internalTool . call ( {
548+ log . info ( 'Calling internal tool' , { name : tool . name , input : args } ) ;
549+ const res = await tool . call ( {
552550 args,
553551 extra,
554552 apifyMcpServer : this ,
@@ -566,12 +564,11 @@ export class ActorsMcpServer {
566564 }
567565
568566 if ( tool . type === 'actor-mcp' ) {
569- const serverTool = tool as ActorMcpTool ;
570567 let client : Client | null = null ;
571568 try {
572- client = await connectMCPClient ( serverTool . serverUrl , apifyToken ) ;
569+ client = await connectMCPClient ( tool . serverUrl , apifyToken ) ;
573570 if ( ! client ) {
574- const msg = `Failed to connect to MCP server ${ serverTool . serverUrl } ` ;
571+ const msg = `Failed to connect to MCP server ${ tool . serverUrl } ` ;
575572 log . error ( msg ) ;
576573 await this . server . sendLoggingMessage ( { level : 'error' , data : msg } ) ;
577574 return {
@@ -597,9 +594,9 @@ export class ActorsMcpServer {
597594 }
598595 }
599596
600- log . info ( 'Calling Actor-MCP' , { actorId : serverTool . actorId , toolName : serverTool . originToolName , input : args } ) ;
597+ log . info ( 'Calling Actor-MCP' , { actorId : tool . actorId , toolName : tool . originToolName , input : args } ) ;
601598 const res = await client . callTool ( {
602- name : serverTool . originToolName ,
599+ name : tool . originToolName ,
603600 arguments : args ,
604601 _meta : {
605602 progressToken,
@@ -627,12 +624,10 @@ export class ActorsMcpServer {
627624 } ;
628625 }
629626
630- const actorTool = tool as ActorTool ;
631-
632627 // Create progress tracker if progressToken is available
633628 const progressTracker = createProgressTracker ( progressToken , extra . sendNotification ) ;
634629
635- const callOptions : ActorCallOptions = { memory : actorTool . memoryMbytes } ;
630+ const callOptions : ActorCallOptions = { memory : tool . memoryMbytes } ;
636631
637632 /**
638633 * Create Apify token, for Skyfire mode use `skyfire-pay-id` and for normal mode use `apifyToken`.
@@ -643,9 +638,9 @@ export class ActorsMcpServer {
643638 : new ApifyClient ( { token : apifyToken } ) ;
644639
645640 try {
646- log . info ( 'Calling Actor' , { actorName : actorTool . actorFullName , input : actorArgs } ) ;
641+ log . info ( 'Calling Actor' , { actorName : tool . actorFullName , input : actorArgs } ) ;
647642 const callResult = await callActorGetDataset (
648- actorTool . actorFullName ,
643+ tool . actorFullName ,
649644 actorArgs ,
650645 apifyClient ,
651646 callOptions ,
@@ -659,7 +654,7 @@ export class ActorsMcpServer {
659654 return { } ;
660655 }
661656
662- const content = buildActorResponseContent ( actorTool . actorFullName , callResult ) ;
657+ const content = buildActorResponseContent ( tool . actorFullName , callResult ) ;
663658 return { content } ;
664659 } finally {
665660 if ( progressTracker ) {
0 commit comments