@@ -4,7 +4,6 @@ import zodToJsonSchema from 'zod-to-json-schema';
44
55import { HelperTools } from '../const.js' ;
66import type { InternalTool , ToolEntry } from '../types' ;
7- import { getActorsAsTools } from './actor.js' ;
87import { actorNameToToolName } from './utils.js' ;
98
109const ajv = new Ajv ( { coerceTypes : 'array' , strict : false } ) ;
@@ -49,7 +48,7 @@ export const addTool: ToolEntry = {
4948 ajvValidate : ajv . compile ( zodToJsonSchema ( addToolArgsSchema ) ) ,
5049 // TODO: I don't like that we are passing apifyMcpServer and mcpServer to the tool
5150 call : async ( toolArgs ) => {
52- const { apifyMcpServer, apifyToken, args, extra : { sendNotification } } = toolArgs ;
51+ const { apifyMcpServer, apifyToken, args, extra : { sendNotification } , getActorsAsTools } = toolArgs ;
5352 const parsed = addToolArgsSchema . parse ( args ) ;
5453 if ( apifyMcpServer . listAllToolNames ( ) . includes ( parsed . actor ) ) {
5554 return {
@@ -59,6 +58,9 @@ export const addTool: ToolEntry = {
5958 } ] ,
6059 } ;
6160 }
61+ if ( ! getActorsAsTools ) {
62+ throw new Error ( 'Internal configuration error: getActorsAsTools must be passed via InternalToolArgs from the MCP server' ) ;
63+ }
6264 const tools = await getActorsAsTools ( [ parsed . actor ] , apifyToken ) ;
6365 /**
6466 * If no tools were found, return a message that the Actor was not found
0 commit comments