Skip to content

Commit 46ef186

Browse files
committed
Simplify actor tools loading logic
1 parent 2f6dec6 commit 46ef186

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/main.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,10 @@ if (STANDBY_MODE) {
4040
if (input.enableActorAutoLoading) {
4141
tools.push(addTool, removeTool);
4242
}
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-
}
43+
const actors = input.actors ?? defaults.actors;
44+
const actorsToLoad = Array.isArray(actors) ? actors : actors.split(',');
45+
const actorTools = await getActorsAsTools(actorsToLoad, process.env.APIFY_TOKEN as string);
46+
tools.push(...actorTools);
5147
mcpServer.updateTools(tools);
5248
app.listen(PORT, () => {
5349
log.info(`The Actor web server is listening for user requests at ${HOST}`);

0 commit comments

Comments
 (0)