Skip to content

Commit 34ff1e3

Browse files
SkopeXstepskop
authored andcommitted
feat: filter Actors in skyfireMode
1 parent 4512904 commit 34ff1e3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/tools/store_collection.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@ export async function searchActorsByKeywords(
1313
apifyToken: string,
1414
limit: number | undefined = undefined,
1515
offset: number | undefined = undefined,
16+
allowsAgenticUsers: boolean | undefined = undefined,
1617
): Promise<ExtendedActorStoreList[]> {
1718
const client = new ApifyClient({ token: apifyToken });
18-
const results = await client.store().list({ search, limit, offset });
19+
const storeClient = client.store();
20+
if (allowsAgenticUsers !== undefined) storeClient.params = { ...storeClient.params, allowsAgenticUsers };
21+
22+
const results = await storeClient.list({ search, limit, offset });
1923
return results.items;
2024
}
2125

@@ -90,13 +94,14 @@ USAGE EXAMPLES:
9094
inputSchema: zodToJsonSchema(searchActorsArgsSchema),
9195
ajvValidate: ajv.compile(zodToJsonSchema(searchActorsArgsSchema)),
9296
call: async (toolArgs) => {
93-
const { args, apifyToken, userRentedActorIds } = toolArgs;
97+
const { args, apifyToken, userRentedActorIds, apifyMcpServer } = toolArgs;
9498
const parsed = searchActorsArgsSchema.parse(args);
9599
let actors = await searchActorsByKeywords(
96100
parsed.search,
97101
apifyToken,
98102
parsed.limit + ACTOR_SEARCH_ABOVE_LIMIT,
99103
parsed.offset,
104+
apifyMcpServer.options.skyfireMode ? true : undefined, // allowsAgenticUsers - filters Actors available for Agentic users
100105
);
101106
actors = filterRentalActors(actors || [], userRentedActorIds || []).slice(0, parsed.limit);
102107
const actorCards = actors.length === 0 ? [] : actors.map(formatActorToActorCard);

0 commit comments

Comments
 (0)