Skip to content

Commit caaebb5

Browse files
committed
Actor MCP server load default Actors
1 parent f14025d commit caaebb5

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/main.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import { processInput } from './input.js';
1313
import { createExpressApp } from './actor/server.js';
1414
import type { Input } from './types.js';
1515
import { ActorsMcpServer } from './mcp/server.js';
16-
import { actorDefinitionTool, addTool, removeTool, searchTool, callActorGetDataset } from './tools/index.js';
16+
import { actorDefinitionTool, addTool, removeTool, searchTool, callActorGetDataset, getActorsAsTools } from './tools/index.js';
17+
import { defaults } from './const.js';
1718

1819
const STANDBY_MODE = Actor.getEnv().metaOrigin === 'STANDBY';
1920

@@ -39,6 +40,14 @@ if (STANDBY_MODE) {
3940
if (input.enableActorAutoLoading) {
4041
tools.push(addTool, removeTool);
4142
}
43+
if (input.actors === undefined || input.actors === null) {
44+
const actorTools = await getActorsAsTools(defaults.actors, process.env.APIFY_TOKEN as string);
45+
tools.push(...actorTools);
46+
} else {
47+
const actorsToLoad = Array.isArray(input.actors) ? input.actors : input.actors.split(',');
48+
const actorTools = await getActorsAsTools(actorsToLoad, process.env.APIFY_TOKEN as string);
49+
tools.push(...actorTools);
50+
}
4251
mcpServer.updateTools(tools);
4352
app.listen(PORT, () => {
4453
log.info(`The Actor web server is listening for user requests at ${HOST}`);

0 commit comments

Comments
 (0)