@apify/actors-mcp-server 0.9.21-beta.1 → 0.9.21-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/const.d.ts +2 -1
- package/dist/const.d.ts.map +1 -1
- package/dist/const.js +2 -1
- package/dist/const.js.map +1 -1
- package/dist/tools/apps/call_actor.d.ts +2 -2
- package/dist/tools/apps/call_actor.d.ts.map +1 -1
- package/dist/tools/apps/call_actor.js +4 -13
- package/dist/tools/apps/call_actor.js.map +1 -1
- package/dist/tools/apps/call_actor_widget.d.ts +3 -0
- package/dist/tools/apps/call_actor_widget.d.ts.map +1 -0
- package/dist/tools/apps/call_actor_widget.js +142 -0
- package/dist/tools/apps/call_actor_widget.js.map +1 -0
- package/dist/tools/apps/search_actors_widget.d.ts +3 -0
- package/dist/tools/apps/search_actors_widget.d.ts.map +1 -0
- package/dist/tools/apps/search_actors_widget.js +113 -0
- package/dist/tools/apps/search_actors_widget.js.map +1 -0
- package/dist/tools/categories.d.ts.map +1 -1
- package/dist/tools/categories.js +5 -4
- package/dist/tools/categories.js.map +1 -1
- package/dist/tools/core/call_actor_common.d.ts +3 -4
- package/dist/tools/core/call_actor_common.d.ts.map +1 -1
- package/dist/tools/core/call_actor_common.js +12 -16
- package/dist/tools/core/call_actor_common.js.map +1 -1
- package/dist/tools/core/get_actor_run_common.d.ts.map +1 -1
- package/dist/tools/core/get_actor_run_common.js +3 -5
- package/dist/tools/core/get_actor_run_common.js.map +1 -1
- package/dist/tools/core/search_actors_common.d.ts +5 -4
- package/dist/tools/core/search_actors_common.d.ts.map +1 -1
- package/dist/tools/core/search_actors_common.js +5 -9
- package/dist/tools/core/search_actors_common.js.map +1 -1
- package/dist/tools/default/call_actor.d.ts.map +1 -1
- package/dist/tools/default/call_actor.js +1 -10
- package/dist/tools/default/call_actor.js.map +1 -1
- package/dist/tools/structured_output_schemas.d.ts +182 -4
- package/dist/tools/structured_output_schemas.d.ts.map +1 -1
- package/dist/tools/structured_output_schemas.js +13 -12
- package/dist/tools/structured_output_schemas.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/server-instructions/index.d.ts +4 -5
- package/dist/utils/server-instructions/index.d.ts.map +1 -1
- package/dist/utils/server-instructions/index.js +12 -12
- package/dist/utils/server-instructions/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/tools/apps/search_actors.d.ts +0 -7
- package/dist/tools/apps/search_actors.d.ts.map +0 -1
- package/dist/tools/apps/search_actors.js +0 -90
- package/dist/tools/apps/search_actors.js.map +0 -1
- package/dist/tools/apps/search_actors_internal.d.ts +0 -3
- package/dist/tools/apps/search_actors_internal.d.ts.map +0 -1
- package/dist/tools/apps/search_actors_internal.js +0 -65
- package/dist/tools/apps/search_actors_internal.js.map +0 -1
|
@@ -3,13 +3,12 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Apps-only sections (widget workflow, widget tool disambiguation) are included
|
|
5
5
|
* only when the resolved server mode is `'apps'`. Default-mode clients never
|
|
6
|
-
* see tool names like `search-actors-
|
|
6
|
+
* see widget tool names like `search-actors-widget` or `fetch-actor-details-widget`,
|
|
7
7
|
* avoiding hallucinated calls to tools absent from `tools/list`.
|
|
8
8
|
*
|
|
9
|
-
* Note: the `-widget` suffix split is rolling out per-tool.
|
|
10
|
-
* `
|
|
11
|
-
*
|
|
12
|
-
* splits land.
|
|
9
|
+
* Note: the `-widget` suffix split is rolling out per-tool. `fetch-actor-details`,
|
|
10
|
+
* `search-actors`, and `call-actor` are already split; `get-actor-run` still renders
|
|
11
|
+
* a widget on its base name until its own split lands.
|
|
13
12
|
*/
|
|
14
13
|
import { ServerMode } from '../../types.js';
|
|
15
14
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/server-instructions/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/server-instructions/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,GAAE,UAA+B,GAAG,MAAM,CA8DnF"}
|
|
@@ -3,13 +3,12 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Apps-only sections (widget workflow, widget tool disambiguation) are included
|
|
5
5
|
* only when the resolved server mode is `'apps'`. Default-mode clients never
|
|
6
|
-
* see tool names like `search-actors-
|
|
6
|
+
* see widget tool names like `search-actors-widget` or `fetch-actor-details-widget`,
|
|
7
7
|
* avoiding hallucinated calls to tools absent from `tools/list`.
|
|
8
8
|
*
|
|
9
|
-
* Note: the `-widget` suffix split is rolling out per-tool.
|
|
10
|
-
* `
|
|
11
|
-
*
|
|
12
|
-
* splits land.
|
|
9
|
+
* Note: the `-widget` suffix split is rolling out per-tool. `fetch-actor-details`,
|
|
10
|
+
* `search-actors`, and `call-actor` are already split; `get-actor-run` still renders
|
|
11
|
+
* a widget on its base name until its own split lands.
|
|
13
12
|
*/
|
|
14
13
|
import { HelperTools, RAG_WEB_BROWSER } from '../../const.js';
|
|
15
14
|
import { ServerMode } from '../../types.js';
|
|
@@ -50,9 +49,8 @@ ${isApps ? `
|
|
|
50
49
|
## Widget workflow (applies when tool responses include widget metadata)
|
|
51
50
|
Some clients render widget-backed Actor tools: the response includes a live UI that automatically polls run status. When a widget is rendered, follow-up status polling by the model is a forbidden duplicate.
|
|
52
51
|
|
|
53
|
-
- **Never call \`${HelperTools.ACTOR_RUNS_GET}\` after
|
|
54
|
-
-
|
|
55
|
-
- The \`-widget\` suffix split is rolling out per-tool (\`${HelperTools.ACTOR_GET_DETAILS_WIDGET}\` already split); until the rest split, widget rendering happens on the base \`${HelperTools.ACTOR_CALL}\`, \`${HelperTools.STORE_SEARCH}\`, and \`${HelperTools.ACTOR_RUNS_GET}\` tool names when the client supports it.
|
|
52
|
+
- **Never call \`${HelperTools.ACTOR_RUNS_GET}\` after \`${HelperTools.ACTOR_CALL_WIDGET}\`.** The widget renders live progress and polls itself — stop after the widget response and defer to it for run status.
|
|
53
|
+
- Polling \`${HelperTools.ACTOR_RUNS_GET}\` after \`${HelperTools.ACTOR_CALL}\` (the silent async variant, no widget) is fine — that tool renders no UI, so polling is expected when you need the run status.
|
|
56
54
|
` : ''}
|
|
57
55
|
## Tool dependencies and disambiguation
|
|
58
56
|
|
|
@@ -60,10 +58,11 @@ Some clients render widget-backed Actor tools: the response includes a live UI t
|
|
|
60
58
|
- \`${HelperTools.ACTOR_CALL}\`:
|
|
61
59
|
- Use \`${HelperTools.ACTOR_GET_DETAILS}\` first to obtain the Actor's input schema.
|
|
62
60
|
- Then call with proper input to execute the Actor.
|
|
63
|
-
- For MCP server Actors, use format "actorName:toolName" to call specific tools
|
|
61
|
+
- For MCP server Actors, use format "actorName:toolName" to call specific tools.${isApps ? `
|
|
62
|
+
- In this mode \`${HelperTools.ACTOR_CALL}\` always runs asynchronously — it starts the run and returns immediately with a runId. Use \`${HelperTools.ACTOR_RUNS_GET}\` to check status and \`${HelperTools.ACTOR_OUTPUT_GET}\` to fetch output once the run completes.` : `
|
|
64
63
|
- Supports async execution via the \`async\` parameter:
|
|
65
64
|
- \`async: false\` or unset: waits for completion and returns results immediately.
|
|
66
|
-
- \`async: true\`: starts the run and returns immediately with a runId
|
|
65
|
+
- \`async: true\`: starts the run and returns immediately with a runId.`}
|
|
67
66
|
|
|
68
67
|
### Tool disambiguation
|
|
69
68
|
- **\`${HelperTools.ACTOR_OUTPUT_GET}\` vs \`${HelperTools.DATASET_GET_ITEMS}\`:**
|
|
@@ -71,9 +70,10 @@ Some clients render widget-backed Actor tools: the response includes a live UI t
|
|
|
71
70
|
- **\`${HelperTools.STORE_SEARCH}\` vs \`${HelperTools.ACTOR_GET_DETAILS}\`:**
|
|
72
71
|
\`${HelperTools.STORE_SEARCH}\` finds Actors; \`${HelperTools.ACTOR_GET_DETAILS}\` retrieves detailed info, README, and schema for a specific Actor.
|
|
73
72
|
${isApps ? `- **Data vs widget Actor tools (when the client supports widgets):**
|
|
74
|
-
- \`${HelperTools.
|
|
73
|
+
- \`${HelperTools.STORE_SEARCH}\` is a silent data lookup (Actor list for name resolution) with no UI; \`${HelperTools.STORE_SEARCH_WIDGET}\` renders an interactive UI element (widget) with Actor search results for the user to browse — use it only when the user explicitly asks to search or discover Actors.
|
|
75
74
|
- \`${HelperTools.ACTOR_GET_DETAILS}\` is a silent data lookup (input schema, README, metadata) with no UI; \`${HelperTools.ACTOR_GET_DETAILS_WIDGET}\` renders an interactive UI element (widget) with Actor details — use it only when the user explicitly asks to see or browse the Actor.
|
|
76
|
-
-
|
|
75
|
+
- \`${HelperTools.ACTOR_CALL}\` is a silent async start (returns runId, no UI); \`${HelperTools.ACTOR_CALL_WIDGET}\` renders an interactive UI element (widget) that tracks live Actor run progress — use it only when the user explicitly asks to see progress.
|
|
76
|
+
- When the next step is running an Actor, prefer silent lookups (\`${HelperTools.STORE_SEARCH}\`, \`${HelperTools.ACTOR_GET_DETAILS}\`) over widget-backed variants.
|
|
77
77
|
` : ''}- **\`${HelperTools.STORE_SEARCH}\` vs ${RAG_WEB_BROWSER}:**
|
|
78
78
|
\`${HelperTools.STORE_SEARCH}\` finds robust and reliable Actors for specific websites; ${RAG_WEB_BROWSER} is a general and versatile web scraping tool.
|
|
79
79
|
- **Dedicated Actor tools (e.g. ${RAG_WEB_BROWSER}) vs \`${HelperTools.ACTOR_CALL}\`:**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/server-instructions/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/server-instructions/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC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CACtE,CAAC;AACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search_actors.d.ts","sourceRoot":"","sources":["../../../src/tools/apps/search_actors.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAoB,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAOlE;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAuFpB,CAAC"}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import dedent from 'dedent';
|
|
2
|
-
import { HelperTools } from '../../const.js';
|
|
3
|
-
import { getWidgetConfig, WIDGET_URIS } from '../../resources/widgets.js';
|
|
4
|
-
import { formatActorForWidget } from '../../utils/actor_card.js';
|
|
5
|
-
import { searchAndFilterActors } from '../../utils/actor_search.js';
|
|
6
|
-
import { buildMCPResponse } from '../../utils/mcp.js';
|
|
7
|
-
import { getUserInfoCached } from '../../utils/userid_cache.js';
|
|
8
|
-
import { buildSearchActorsEmptyResponse, buildSearchActorsResult, searchActorsArgsSchema, searchActorsMetadata } from '../core/search_actors_common.js';
|
|
9
|
-
/**
|
|
10
|
-
* Apps mode search-actors tool.
|
|
11
|
-
* Returns widget-formatted actors with interactive widget metadata.
|
|
12
|
-
*/
|
|
13
|
-
export const appsSearchActors = Object.freeze({
|
|
14
|
-
...searchActorsMetadata,
|
|
15
|
-
call: async (toolArgs) => {
|
|
16
|
-
const { args, apifyToken, apifyClient, userRentedActorIds, apifyMcpServer } = toolArgs;
|
|
17
|
-
const parsed = searchActorsArgsSchema.parse(args);
|
|
18
|
-
// Actor search and user-info fetch are independent; run in parallel to avoid a
|
|
19
|
-
// sequential round-trip on cache miss.
|
|
20
|
-
const [actors, { userPlanTier }] = await Promise.all([
|
|
21
|
-
searchAndFilterActors({
|
|
22
|
-
keywords: parsed.keywords,
|
|
23
|
-
apifyToken,
|
|
24
|
-
limit: parsed.limit,
|
|
25
|
-
offset: parsed.offset,
|
|
26
|
-
paymentProvider: apifyMcpServer.options.paymentProvider,
|
|
27
|
-
userRentedActorIds,
|
|
28
|
-
}),
|
|
29
|
-
getUserInfoCached(apifyToken, apifyClient),
|
|
30
|
-
]);
|
|
31
|
-
if (actors.length === 0) {
|
|
32
|
-
return buildSearchActorsEmptyResponse(parsed.keywords);
|
|
33
|
-
}
|
|
34
|
-
const { actorCardText, actorCardStructured } = buildSearchActorsResult(actors, userPlanTier);
|
|
35
|
-
const structuredContent = {
|
|
36
|
-
actors: actorCardStructured,
|
|
37
|
-
query: parsed.keywords,
|
|
38
|
-
count: actors.length,
|
|
39
|
-
instructions: dedent `
|
|
40
|
-
Choosing the right details tool: Use ${HelperTools.ACTOR_GET_DETAILS_WIDGET} when the user
|
|
41
|
-
wants to see or browse Actor details — it renders an interactive UI element (widget) for the user
|
|
42
|
-
(e.g., "show me", "tell me about this Actor").
|
|
43
|
-
Use ${HelperTools.ACTOR_GET_DETAILS} for silent data lookups (input schema, README, metadata)
|
|
44
|
-
when preparing an Actor run or making a decision (e.g., "scrape", "extract") — no UI is rendered.
|
|
45
|
-
IMPORTANT: You MUST always do a second search with broader, more generic keywords
|
|
46
|
-
(e.g., just the platform name like "TikTok" instead of "TikTok posts") to make sure
|
|
47
|
-
you haven't missed a better Actor.
|
|
48
|
-
`,
|
|
49
|
-
};
|
|
50
|
-
// Add widget-formatted actors for the interactive UI
|
|
51
|
-
structuredContent.widgetActors = actors.map((actor) => formatActorForWidget(actor, userPlanTier));
|
|
52
|
-
const texts = [dedent `
|
|
53
|
-
# Search results:
|
|
54
|
-
- **Search query:** ${parsed.keywords}
|
|
55
|
-
- **Number of Actors found:** ${actors.length}
|
|
56
|
-
|
|
57
|
-
An interactive widget has been rendered with the search results. The user can already see
|
|
58
|
-
the list of Actors visually in the widget, so do NOT print or summarize the Actor list
|
|
59
|
-
in your response.
|
|
60
|
-
|
|
61
|
-
# Actors:
|
|
62
|
-
|
|
63
|
-
${actorCardText}
|
|
64
|
-
|
|
65
|
-
## Choosing the right details tool:
|
|
66
|
-
- Use ${HelperTools.ACTOR_GET_DETAILS_WIDGET} when the user wants to **see or browse**
|
|
67
|
-
an Actor (e.g., "show me apify/rag-web-browser", "tell me about this Actor"). This renders
|
|
68
|
-
an **interactive UI element (widget)** the user can view directly.
|
|
69
|
-
- Use ${HelperTools.ACTOR_GET_DETAILS} for **silent data lookups** — fetching the input
|
|
70
|
-
schema to prepare a run, reading the README for decision making, or inspecting metadata
|
|
71
|
-
(e.g., "scrape Google Maps for restaurants", "extract emails from this website"). No UI
|
|
72
|
-
is rendered.
|
|
73
|
-
|
|
74
|
-
IMPORTANT: You MUST always do a second search with broader, more generic keywords
|
|
75
|
-
(e.g., just the platform name like "TikTok" instead of "TikTok posts") to make sure
|
|
76
|
-
you haven't missed a better Actor.
|
|
77
|
-
`];
|
|
78
|
-
const widgetConfig = getWidgetConfig(WIDGET_URIS.SEARCH_ACTORS);
|
|
79
|
-
return buildMCPResponse({
|
|
80
|
-
texts,
|
|
81
|
-
structuredContent,
|
|
82
|
-
// Response-level meta; only returned in apps mode (this handler is apps-only)
|
|
83
|
-
_meta: {
|
|
84
|
-
...widgetConfig === null || widgetConfig === void 0 ? void 0 : widgetConfig.meta,
|
|
85
|
-
'openai/widgetDescription': `Interactive actor search results showing ${actors.length} actors from Apify Store`,
|
|
86
|
-
},
|
|
87
|
-
});
|
|
88
|
-
},
|
|
89
|
-
});
|
|
90
|
-
//# sourceMappingURL=search_actors.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search_actors.js","sourceRoot":"","sources":["../../../src/tools/apps/search_actors.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE1E,OAAO,EAAE,oBAAoB,EAAoB,MAAM,2BAA2B,CAAC;AACnF,OAAO,EAAE,qBAA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B,KAAK,EAAE,MAAM,CAAC,QAAQ;YACtB,KAAK,EAAE,MAAM,CAAC,MAAM;YACpB,YAAY,EAAE,MAAM,CAAA;uDACuB,WAAW,CAAC,wBAAwB;;;sBAGrE,WAAW,CAAC,iBAAiB;;;;;aAKtC;SACJ,CAAC;QAEF,qDAAqD;QACrD,iBAAiB,CAAC,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,oBAAoB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC;QAElG,MAAM,KAAK,GAAG,CAAC,MAAM,CAAA;;kCAEK,MAAM,CAAC,QAAQ;4CACL,MAAM,CAAC,MAAM;;;;;;;;cAQ3C,aAAa;;;oBAGP,WAAW,CAAC,wBAAwB;;;oBAGpC,WAAW,CAAC,iBAAiB;;;;;;;;SAQxC,CAAC,CAAC;QAEH,MAAM,YAAY,GAAG,eAAe,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;QAChE,OAAO,gBAAgB,CAAC;YACpB,KAAK;YACL,iBAAiB;YACjB,8EAA8E;YAC9E,KAAK,EAAE;gBACH,GAAG,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,IAAI;gBACrB,0BAA0B,EAAE,4CAA4C,MAAM,CAAC,MAAM,0BAA0B;aAClH;SACJ,CAAC,CAAC;IACP,CAAC;CACK,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search_actors_internal.d.ts","sourceRoot":"","sources":["../../../src/tools/apps/search_actors_internal.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAoB,SAAS,EAAmB,MAAM,gBAAgB,CAAC;AASnF,eAAO,MAAM,wBAAwB,EAAE,SAwDrC,CAAC"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import dedent from 'dedent';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import { HelperTools } from '../../const.js';
|
|
4
|
-
import { searchAndFilterActors } from '../../utils/actor_search.js';
|
|
5
|
-
import { compileSchema } from '../../utils/ajv.js';
|
|
6
|
-
import { buildMCPResponse } from '../../utils/mcp.js';
|
|
7
|
-
import { searchActorsBaseArgsSchema } from '../core/search_actors_common.js';
|
|
8
|
-
import { actorSearchInternalOutputSchema } from '../structured_output_schemas.js';
|
|
9
|
-
const searchActorsInternalInputSchema = z.toJSONSchema(searchActorsBaseArgsSchema);
|
|
10
|
-
export const searchActorsInternalTool = Object.freeze({
|
|
11
|
-
type: 'internal',
|
|
12
|
-
name: HelperTools.STORE_SEARCH_INTERNAL,
|
|
13
|
-
description: dedent `
|
|
14
|
-
Search Actors internally (apps mode internal tool).
|
|
15
|
-
|
|
16
|
-
This tool is available because the LLM is operating in apps mode. Use it for internal lookups
|
|
17
|
-
where data presentation to the user is NOT needed - this tool does NOT render a widget.
|
|
18
|
-
|
|
19
|
-
Use this instead of ${HelperTools.STORE_SEARCH} when you need to find an Actor but the user
|
|
20
|
-
did NOT explicitly ask to search Actors. For example, when user says "scrape me google maps"
|
|
21
|
-
and you need to find the right Actor for the task, then fetch its schema and call it.
|
|
22
|
-
|
|
23
|
-
Returns only minimal fields (fullName, title, description) needed for subsequent calls.
|
|
24
|
-
`,
|
|
25
|
-
inputSchema: searchActorsInternalInputSchema,
|
|
26
|
-
outputSchema: actorSearchInternalOutputSchema,
|
|
27
|
-
ajvValidate: compileSchema(searchActorsInternalInputSchema),
|
|
28
|
-
annotations: {
|
|
29
|
-
title: 'Search Actors (internal)',
|
|
30
|
-
readOnlyHint: true,
|
|
31
|
-
destructiveHint: false,
|
|
32
|
-
idempotentHint: true,
|
|
33
|
-
openWorldHint: false,
|
|
34
|
-
},
|
|
35
|
-
call: async (toolArgs) => {
|
|
36
|
-
const { args, apifyToken, userRentedActorIds, apifyMcpServer } = toolArgs;
|
|
37
|
-
const parsed = searchActorsBaseArgsSchema.parse(args);
|
|
38
|
-
const actors = await searchAndFilterActors({
|
|
39
|
-
keywords: parsed.keywords,
|
|
40
|
-
apifyToken,
|
|
41
|
-
limit: parsed.limit,
|
|
42
|
-
offset: parsed.offset,
|
|
43
|
-
paymentProvider: apifyMcpServer.options.paymentProvider,
|
|
44
|
-
userRentedActorIds,
|
|
45
|
-
});
|
|
46
|
-
const minimalActors = actors.map((actor) => ({
|
|
47
|
-
fullName: `${actor.username}/${actor.name}`,
|
|
48
|
-
title: actor.title || actor.name,
|
|
49
|
-
description: actor.description || '',
|
|
50
|
-
}));
|
|
51
|
-
return buildMCPResponse({
|
|
52
|
-
texts: [
|
|
53
|
-
`Found ${minimalActors.length} Actors for "${parsed.keywords}".`,
|
|
54
|
-
`Query: ${parsed.keywords}`,
|
|
55
|
-
`Actors:\n\`\`\`json\n${JSON.stringify(minimalActors)}\n\`\`\``,
|
|
56
|
-
],
|
|
57
|
-
structuredContent: {
|
|
58
|
-
actors: minimalActors,
|
|
59
|
-
query: parsed.keywords,
|
|
60
|
-
count: minimalActors.length,
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
//# sourceMappingURL=search_actors_internal.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search_actors_internal.js","sourceRoot":"","sources":["../../../src/tools/apps/search_actors_internal.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,+BAA+B,EAAE,MAAM,iCAAiC,CAAC;AAElF,MAAM,+BAA+B,GAAG,CAAC,CAA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