@@ -6,7 +6,7 @@ import log from '@apify/log';
66import type { ToolWrap } from '../types.js' ;
77import { getActorDefinition } from './build.js' ;
88import { ACTOR_ADDITIONAL_INSTRUCTIONS , ACTOR_MAX_MEMORY_MBYTES } from '../const.js' ;
9- import { ApifyClient } from './mcp- apify-client.js' ;
9+ import { ApifyClient } from '../ apify-client.js' ;
1010import {
1111 actorNameToToolName ,
1212 addEnumsToDescriptionsWithExamples ,
@@ -79,9 +79,16 @@ export async function callActorGetDataset(
7979 * @param {string[] } actors - An array of actor IDs or Actor full names.
8080 * @returns {Promise<Tool[]> } - A promise that resolves to an array of MCP tools.
8181 */
82- export async function getNormalActorsAsTools ( actors : string [ ] ) : Promise < ToolWrap [ ] > {
82+ export async function getNormalActorsAsTools (
83+ actors : string [ ] ,
84+ apifyToken : string ,
85+ ) : Promise < ToolWrap [ ] > {
8386 const ajv = new Ajv ( { coerceTypes : 'array' , strict : false } ) ;
84- const results = await Promise . all ( actors . map ( getActorDefinition ) ) ;
87+ const getActorDefinitionWithToken = async ( actorId : string ) => {
88+ const actor = await getActorDefinition ( actorId , apifyToken ) ;
89+ return actor ;
90+ } ;
91+ const results = await Promise . all ( actors . map ( getActorDefinitionWithToken ) ) ;
8592 const tools : ToolWrap [ ] = [ ] ;
8693 for ( const result of results ) {
8794 if ( result ) {
@@ -153,7 +160,7 @@ export async function getActorsAsTools(
153160 console . log ( 'toolActors' , toolActors ) ;
154161
155162 // Normal Actors as a tool
156- const normalTools = await getNormalActorsAsTools ( toolActors ) ;
163+ const normalTools = await getNormalActorsAsTools ( toolActors , apifyToken ) ;
157164
158165 // Tools from Actorized MCP servers
159166 const mcpServerTools = await getMCPServersAsTools ( actorsMCPServer , apifyToken ) ;
0 commit comments