Skip to content

Commit fd1436f

Browse files
committed
lint
1 parent 48301cd commit fd1436f

File tree

4 files changed

+16
-15
lines changed

4 files changed

+16
-15
lines changed

src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ export type InternalToolArgs = {
113113
* Passing it from the server avoids a stdio-only circular import that made the
114114
* add-actor tool null during module initialization.
115115
*/
116+
// eslint-disable-next-line no-use-before-define
116117
getActorsAsTools?: (actorIdsOrNames: string[], apifyToken: string) => Promise<ToolEntry[]>;
117118
}
118119

src/utils/tools-loader.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,14 @@ export async function loadToolsFromInput(
6767
}
6868

6969
// Decide which Actors to load
70-
const actorsFromField: string[] | undefined = input.actors === undefined
71-
? undefined
72-
: Array.isArray(input.actors)
73-
? input.actors
74-
: [input.actors];
70+
let actorsFromField: string[] | undefined;
71+
if (input.actors === undefined) {
72+
actorsFromField = undefined;
73+
} else if (Array.isArray(input.actors)) {
74+
actorsFromField = input.actors;
75+
} else {
76+
actorsFromField = [input.actors];
77+
}
7578

7679
let actorNamesToLoad: string[] = [];
7780
if (actorsFromField !== undefined) {
@@ -94,13 +97,11 @@ export async function loadToolsFromInput(
9497
const hasAddActor = result.some((e) => e.tool.name === addTool.tool.name);
9598
if (!hasAddActor) result.push(addTool);
9699
}
97-
} else {
100+
} else if (addActorEnabled && !actorsExplicitlyEmpty) {
98101
// No selectors: either expose only add-actor (when enabled), or default categories
99-
if (addActorEnabled && !actorsExplicitlyEmpty) {
100-
result.push(addTool);
101-
} else if (!actorsExplicitlyEmpty) {
102-
result.push(...getExpectedToolsByCategories(toolCategoriesEnabledByDefault));
103-
}
102+
result.push(addTool);
103+
} else if (!actorsExplicitlyEmpty) {
104+
result.push(...getExpectedToolsByCategories(toolCategoriesEnabledByDefault));
104105
}
105106

106107
// Actor tools (if any)
@@ -112,7 +113,7 @@ export async function loadToolsFromInput(
112113
// De-duplicate by tool name for safety
113114
const seen = new Set<string>();
114115
const deduped = result.filter((entry) => {
115-
const name = entry.tool.name;
116+
const { name } = entry.tool;
116117
if (seen.has(name)) return false;
117118
seen.add(name);
118119
return true;

tests/integration/internals.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ import { beforeAll, describe, expect, it } from 'vitest';
33
import log from '@apify/log';
44

55
import { actorNameToToolName } from '../../dist/tools/utils.js';
6-
import { defaults } from '../../src/const.js';
76
import { ActorsMcpServer } from '../../src/index.js';
87
import { addTool } from '../../src/tools/helpers.js';
9-
import { defaultTools, getActorsAsTools } from '../../src/tools/index.js';
8+
import { getActorsAsTools } from '../../src/tools/index.js';
109
import type { Input } from '../../src/types.js';
1110
import { loadToolsFromInput } from '../../src/utils/tools-loader.js';
1211
import { ACTOR_PYTHON_EXAMPLE } from '../const.js';

tests/integration/suite.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export function createIntegrationTestsSuite(
114114
expectToolNamesToContain(names, DEFAULT_ACTOR_NAMES);
115115
await client.close();
116116
});
117-
117+
118118
it('should override enableAddingActors false with experimental tool category', async () => {
119119
const client = await createClientFn({ enableAddingActors: false, tools: ['experimental'] });
120120
const names = getToolNames(await client.listTools());

0 commit comments

Comments
 (0)