Skip to content

Commit e061357

Browse files
committed
fix: tools autoloading
1 parent b8b185b commit e061357

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/actor/server.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import log from '@apify/log';
1313

1414
import { type ActorsMcpServer } from '../mcp/server.js';
1515
import { processParamsGetTools } from '../mcp/utils.js';
16+
import { addTool, removeTool } from '../tools/helpers.js';
1617
import { getHelpMessage, HEADER_READINESS_PROBE, Routes } from './const.js';
1718
import { getActorRunData } from './utils.js';
1819

@@ -69,7 +70,9 @@ export function createExpressApp(
6970
const tools = await processParamsGetTools(req.url, process.env.APIFY_TOKEN as string);
7071
if (tools.length > 0) {
7172
mcpServer.updateTools(tools);
72-
} else {
73+
}
74+
// TODO fix this - we should not be loading default tools here or provide more generic way
75+
if (tools.length === 2 && tools.includes(addTool) && tools.includes(removeTool)) {
7376
// We are loading default Actors (if not specified otherwise), so that we don't have "empty" tools
7477
await mcpServer.loadDefaultTools(process.env.APIFY_TOKEN as string);
7578
}

src/mcp/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export class ActorsMcpServer {
102102
/**
103103
* Loads tools from URL params.
104104
*
105-
* This method also handles enabling of Actor auto loading via the processParamsGetTools.
105+
* This method also handles enabling of Actor autoloading via the processParamsGetTools.
106106
*
107107
* Used primarily for SSE.
108108
*/

0 commit comments

Comments
 (0)