@apify/actors-mcp-server 0.9.21-beta.0 → 0.9.21-beta.10
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 +4 -2
- package/dist/const.d.ts.map +1 -1
- package/dist/const.js +4 -2
- package/dist/const.js.map +1 -1
- package/dist/input.d.ts +0 -1
- package/dist/input.d.ts.map +1 -1
- package/dist/input.js +4 -13
- package/dist/input.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 +6 -15
- 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/fetch_actor_details_widget.d.ts +3 -0
- package/dist/tools/apps/fetch_actor_details_widget.d.ts.map +1 -0
- package/dist/tools/apps/fetch_actor_details_widget.js +91 -0
- package/dist/tools/apps/fetch_actor_details_widget.js.map +1 -0
- package/dist/tools/apps/get_actor_run_widget.d.ts +3 -0
- package/dist/tools/apps/get_actor_run_widget.d.ts.map +1 -0
- package/dist/tools/apps/get_actor_run_widget.js +69 -0
- package/dist/tools/apps/get_actor_run_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 +14 -9
- package/dist/tools/categories.d.ts.map +1 -1
- package/dist/tools/categories.js +39 -12
- package/dist/tools/categories.js.map +1 -1
- package/dist/tools/common/fetch_apify_docs.d.ts +1 -0
- package/dist/tools/common/fetch_apify_docs.d.ts.map +1 -1
- package/dist/tools/common/fetch_apify_docs.js +16 -1
- package/dist/tools/common/fetch_apify_docs.js.map +1 -1
- package/dist/tools/core/call_actor_common.d.ts +5 -6
- package/dist/tools/core/call_actor_common.d.ts.map +1 -1
- package/dist/tools/core/call_actor_common.js +13 -16
- package/dist/tools/core/call_actor_common.js.map +1 -1
- package/dist/tools/core/fetch_actor_details_common.d.ts +9 -7
- package/dist/tools/core/fetch_actor_details_common.d.ts.map +1 -1
- package/dist/tools/core/fetch_actor_details_common.js +10 -13
- package/dist/tools/core/fetch_actor_details_common.js.map +1 -1
- package/dist/tools/core/get_actor_run_common.d.ts +3 -2
- package/dist/tools/core/get_actor_run_common.d.ts.map +1 -1
- package/dist/tools/core/get_actor_run_common.js +9 -13
- 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/default/fetch_actor_details.d.ts.map +1 -1
- package/dist/tools/default/fetch_actor_details.js +1 -2
- package/dist/tools/default/fetch_actor_details.js.map +1 -1
- package/dist/tools/default/search_actors.d.ts.map +1 -1
- package/dist/tools/default/search_actors.js +9 -5
- package/dist/tools/default/search_actors.js.map +1 -1
- package/dist/tools/structured_output_schemas.d.ts +214 -4
- package/dist/tools/structured_output_schemas.d.ts.map +1 -1
- package/dist/tools/structured_output_schemas.js +36 -15
- package/dist/tools/structured_output_schemas.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/pricing_info.js +3 -3
- package/dist/utils/server-instructions/index.d.ts +1 -6
- 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/dist/utils/tools_loader.d.ts.map +1 -1
- package/dist/utils/tools_loader.js +33 -20
- package/dist/utils/tools_loader.js.map +1 -1
- package/package.json +4 -1
- package/dist/tools/apps/fetch_actor_details.d.ts +0 -7
- package/dist/tools/apps/fetch_actor_details.d.ts.map +0 -1
- package/dist/tools/apps/fetch_actor_details.js +0 -55
- package/dist/tools/apps/fetch_actor_details.js.map +0 -1
- package/dist/tools/apps/fetch_actor_details_internal.d.ts +0 -3
- package/dist/tools/apps/fetch_actor_details_internal.d.ts.map +0 -1
- package/dist/tools/apps/fetch_actor_details_internal.js +0 -36
- package/dist/tools/apps/fetch_actor_details_internal.js.map +0 -1
- package/dist/tools/apps/get_actor_run.d.ts +0 -7
- package/dist/tools/apps/get_actor_run.d.ts.map +0 -1
- package/dist/tools/apps/get_actor_run.js +0 -29
- package/dist/tools/apps/get_actor_run.js.map +0 -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 -89
- 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
|
@@ -169,7 +169,7 @@ function formatPayPerEventComplete(pricingPerEvent) {
|
|
|
169
169
|
const eventLines = Object.values(pricingPerEvent.actorChargeEvents).map((event) => {
|
|
170
170
|
var _a;
|
|
171
171
|
const detail = formatCompleteEventDetail(event);
|
|
172
|
-
return
|
|
172
|
+
return ` - **${event.eventTitle}**: ${(_a = event.eventDescription) !== null && _a !== void 0 ? _a : ''} (${detail})`;
|
|
173
173
|
});
|
|
174
174
|
return `This Actor is paid per event:\n${eventLines.join('\n')}`;
|
|
175
175
|
}
|
|
@@ -295,8 +295,8 @@ function formatPayPerEventSimplified(pricingPerEvent, userTier) {
|
|
|
295
295
|
}
|
|
296
296
|
const detail = typeof price === 'number' ? `$${price} per event` : 'No price info';
|
|
297
297
|
if (omitDescriptions)
|
|
298
|
-
return
|
|
299
|
-
return
|
|
298
|
+
return ` - **${event.eventTitle}**: ${detail}`;
|
|
299
|
+
return ` - **${event.eventTitle}**: ${(_a = event.eventDescription) !== null && _a !== void 0 ? _a : ''} (${detail})`;
|
|
300
300
|
});
|
|
301
301
|
const body = `This Actor is paid per event:\n${eventLines.join('\n')}`;
|
|
302
302
|
const anyMultiTier = events.some((event) => hasMultipleTiers(event.eventTieredPricingUsd));
|
|
@@ -3,13 +3,8 @@
|
|
|
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
|
-
*
|
|
9
|
-
* Note: the `-widget` suffix split (separating widget-backed tools from silent
|
|
10
|
-
* variants by name) is planned in follow-up PRs. Until then, widget rendering
|
|
11
|
-
* happens on the base tool names (`call-actor`, `search-actors`,
|
|
12
|
-
* `fetch-actor-details`) in apps mode.
|
|
13
8
|
*/
|
|
14
9
|
import { ServerMode } from '../../types.js';
|
|
15
10
|
/**
|
|
@@ -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;;;;;;;GAOG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,GAAE,UAA+B,GAAG,MAAM,CA+DnF"}
|
|
@@ -3,13 +3,8 @@
|
|
|
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
|
-
*
|
|
9
|
-
* Note: the `-widget` suffix split (separating widget-backed tools from silent
|
|
10
|
-
* variants by name) is planned in follow-up PRs. Until then, widget rendering
|
|
11
|
-
* happens on the base tool names (`call-actor`, `search-actors`,
|
|
12
|
-
* `fetch-actor-details`) in apps mode.
|
|
13
8
|
*/
|
|
14
9
|
import { HelperTools, RAG_WEB_BROWSER } from '../../const.js';
|
|
15
10
|
import { ServerMode } from '../../types.js';
|
|
@@ -50,9 +45,8 @@ ${isApps ? `
|
|
|
50
45
|
## Widget workflow (applies when tool responses include widget metadata)
|
|
51
46
|
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
47
|
|
|
53
|
-
- **
|
|
54
|
-
-
|
|
55
|
-
- Follow-up PRs will split widget-backed tools into a dedicated \`-widget\`-suffixed namespace; until then, widget rendering happens on the base tool names when the client supports it.
|
|
48
|
+
- **After \`${HelperTools.ACTOR_CALL_WIDGET}\` or \`${HelperTools.ACTOR_RUNS_GET_WIDGET}\`, never call \`${HelperTools.ACTOR_RUNS_GET}\` or \`${HelperTools.ACTOR_RUNS_GET_WIDGET}\` for the same run.** Both widgets render live progress and poll themselves — stop after the widget response and defer to it for run status. Re-rendering the same run via \`${HelperTools.ACTOR_RUNS_GET_WIDGET}\` is a duplicate.
|
|
49
|
+
- 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
50
|
` : ''}
|
|
57
51
|
## Tool dependencies and disambiguation
|
|
58
52
|
|
|
@@ -60,17 +54,23 @@ Some clients render widget-backed Actor tools: the response includes a live UI t
|
|
|
60
54
|
- \`${HelperTools.ACTOR_CALL}\`:
|
|
61
55
|
- Use \`${HelperTools.ACTOR_GET_DETAILS}\` first to obtain the Actor's input schema.
|
|
62
56
|
- Then call with proper input to execute the Actor.
|
|
63
|
-
- For MCP server Actors, use format "actorName:toolName" to call specific tools
|
|
57
|
+
- For MCP server Actors, use format "actorName:toolName" to call specific tools.${isApps ? `
|
|
58
|
+
- 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
59
|
- Supports async execution via the \`async\` parameter:
|
|
65
60
|
- \`async: false\` or unset: waits for completion and returns results immediately.
|
|
66
|
-
- \`async: true\`: starts the run and returns immediately with a runId
|
|
61
|
+
- \`async: true\`: starts the run and returns immediately with a runId.`}
|
|
67
62
|
|
|
68
63
|
### Tool disambiguation
|
|
69
64
|
- **\`${HelperTools.ACTOR_OUTPUT_GET}\` vs \`${HelperTools.DATASET_GET_ITEMS}\`:**
|
|
70
65
|
Use \`${HelperTools.ACTOR_OUTPUT_GET}\` for Actor run outputs and \`${HelperTools.DATASET_GET_ITEMS}\` for direct dataset access.
|
|
71
66
|
- **\`${HelperTools.STORE_SEARCH}\` vs \`${HelperTools.ACTOR_GET_DETAILS}\`:**
|
|
72
67
|
\`${HelperTools.STORE_SEARCH}\` finds Actors; \`${HelperTools.ACTOR_GET_DETAILS}\` retrieves detailed info, README, and schema for a specific Actor.
|
|
73
|
-
${isApps ? `- **
|
|
68
|
+
${isApps ? `- **Data vs widget Actor tools (when the client supports widgets):**
|
|
69
|
+
- \`${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.
|
|
70
|
+
- \`${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.
|
|
71
|
+
- \`${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.
|
|
72
|
+
- \`${HelperTools.ACTOR_RUNS_GET}\` is a silent data lookup (run status, dataset IDs, stats) with no UI; \`${HelperTools.ACTOR_RUNS_GET_WIDGET}\` renders an interactive UI element (widget) showing live run progress for the user — use it only when the user explicitly asks to see run progress.
|
|
73
|
+
- When the next step is running an Actor, prefer silent lookups (\`${HelperTools.STORE_SEARCH}\`, \`${HelperTools.ACTOR_GET_DETAILS}\`) over widget-backed variants.
|
|
74
74
|
` : ''}- **\`${HelperTools.STORE_SEARCH}\` vs ${RAG_WEB_BROWSER}:**
|
|
75
75
|
\`${HelperTools.STORE_SEARCH}\` finds robust and reliable Actors for specific websites; ${RAG_WEB_BROWSER} is a general and versatile web scraping tool.
|
|
76
76
|
- **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;;;;;;;GAOG;AAEH,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAmB,UAAU,CAAC,OAAO;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UAAU;CACtE,CAAC;AACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools_loader.d.ts","sourceRoot":"","sources":["../../src/utils/tools_loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"tools_loader.d.ts","sourceRoot":"","sources":["../../src/utils/tools_loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAgBhD,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAgB,SAAS,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,EAAgB,UAAU,EAAE,MAAM,aAAa,CAAC;AAyGvD,+DAA+D;AAC/D,wBAAsB,SAAS,CAC3B,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,UAAU,CAAC,EAAE,UAAU,GACxB,OAAO,CAAC,SAAS,EAAE,CAAC,CAKtB;AAED,gHAAgH;AAChH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,KAAK,CAqB3D;AAED,0GAA0G;AAC1G,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,IAAI,GAAE,UAA+B,GAAG,SAAS,EAAE,CA0H/H;AAED,0FAA0F;AAC1F,wBAAsB,kBAAkB,CACpC,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,IAAI,GAAE,UAA+B,EACrC,UAAU,CAAC,EAAE,UAAU,GACxB,OAAO,CAAC,SAAS,EAAE,CAAC,CAGtB"}
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import log from '@apify/log';
|
|
6
6
|
import { defaults, HelperTools } from '../const.js';
|
|
7
|
-
import { CATEGORY_NAME_SET, CATEGORY_NAMES, getCategoryTools, toolCategoriesEnabledByDefault } from '../tools/categories.js';
|
|
7
|
+
import { CATEGORY_NAME_SET, CATEGORY_NAMES, getCategoryTools, toolCategoriesEnabledByDefault, WIDGET_BY_BASE_TOOL, } from '../tools/categories.js';
|
|
8
8
|
import { addTool } from '../tools/common/add_actor.js';
|
|
9
9
|
import { getActorOutput } from '../tools/common/get_actor_output.js';
|
|
10
|
+
import { defaultGetActorRun } from '../tools/default/get_actor_run.js';
|
|
10
11
|
import { getActorsAsTools } from '../tools/index.js';
|
|
11
12
|
import { SERVER_MODES, ServerMode } from '../types.js';
|
|
12
13
|
// All internal tool names across all modes. Selectors matching these are not treated as Actor IDs.
|
|
@@ -23,6 +24,10 @@ function getAllInternalToolNames() {
|
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
}
|
|
27
|
+
// Widgets live only in WIDGET_BY_BASE_TOOL, not in any category
|
|
28
|
+
for (const widget of WIDGET_BY_BASE_TOOL.values()) {
|
|
29
|
+
allNames.add(widget.name);
|
|
30
|
+
}
|
|
26
31
|
ALL_INTERNAL_TOOL_NAMES_CACHE = allNames;
|
|
27
32
|
}
|
|
28
33
|
return ALL_INTERNAL_TOOL_NAMES_CACHE;
|
|
@@ -129,12 +134,17 @@ export function getToolsForServerMode(input, actorTools, mode = ServerMode.DEFAU
|
|
|
129
134
|
const categories = getCategoryTools(mode);
|
|
130
135
|
const { selectors, addActorEnabled, actorsExplicitlyEmpty } = normalizeInput(input);
|
|
131
136
|
const selectorsExplicitEmpty = (selectors === null || selectors === void 0 ? void 0 : selectors.length) === 0;
|
|
132
|
-
const explicitlyNoToolsRequested = selectorsExplicitEmpty || actorsExplicitlyEmpty;
|
|
133
137
|
// Build mode-specific tool-by-name map for individual tool selection
|
|
134
|
-
const
|
|
138
|
+
const toolsByName = new Map();
|
|
135
139
|
for (const name of CATEGORY_NAMES) {
|
|
136
140
|
for (const tool of categories[name]) {
|
|
137
|
-
|
|
141
|
+
toolsByName.set(tool.name, tool);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
// Widgets are apps-only and not in any category; include for direct selection
|
|
145
|
+
if (mode === ServerMode.APPS) {
|
|
146
|
+
for (const widget of WIDGET_BY_BASE_TOOL.values()) {
|
|
147
|
+
toolsByName.set(widget.name, widget);
|
|
138
148
|
}
|
|
139
149
|
}
|
|
140
150
|
// Walk selectors for internal picks (mode-specific). Actor-name classification
|
|
@@ -145,7 +155,7 @@ export function getToolsForServerMode(input, actorTools, mode = ServerMode.DEFAU
|
|
|
145
155
|
if (sel === 'preview') {
|
|
146
156
|
// 'preview' category is deprecated. It contained `call-actor` which is now default.
|
|
147
157
|
log.warning('Tool category "preview" is deprecated');
|
|
148
|
-
const callActorTool =
|
|
158
|
+
const callActorTool = toolsByName.get(HelperTools.ACTOR_CALL);
|
|
149
159
|
if (callActorTool)
|
|
150
160
|
internalSelections.push(callActorTool);
|
|
151
161
|
continue;
|
|
@@ -155,7 +165,7 @@ export function getToolsForServerMode(input, actorTools, mode = ServerMode.DEFAU
|
|
|
155
165
|
internalSelections.push(...categoryTools);
|
|
156
166
|
continue;
|
|
157
167
|
}
|
|
158
|
-
const internalByName =
|
|
168
|
+
const internalByName = toolsByName.get(sel);
|
|
159
169
|
if (internalByName) {
|
|
160
170
|
internalSelections.push(internalByName);
|
|
161
171
|
continue;
|
|
@@ -190,10 +200,6 @@ export function getToolsForServerMode(input, actorTools, mode = ServerMode.DEFAU
|
|
|
190
200
|
result.push(...categories[cat]);
|
|
191
201
|
}
|
|
192
202
|
}
|
|
193
|
-
// In apps mode, unconditionally add UI-specific tools (regardless of selectors)
|
|
194
|
-
if (mode === ServerMode.APPS && !explicitlyNoToolsRequested) {
|
|
195
|
-
result.push(...categories.ui);
|
|
196
|
-
}
|
|
197
203
|
// Actor tools (pre-fetched, mode-agnostic)
|
|
198
204
|
if (actorTools.length > 0) {
|
|
199
205
|
result.push(...actorTools);
|
|
@@ -202,22 +208,18 @@ export function getToolsForServerMode(input, actorTools, mode = ServerMode.DEFAU
|
|
|
202
208
|
* Auto-inject get-actor-run and get-actor-output when call-actor or actor tools are present.
|
|
203
209
|
* Insert them right after call-actor to follow the logical workflow order:
|
|
204
210
|
* search → details → call → run status → output → docs → actor tools
|
|
205
|
-
*
|
|
206
|
-
* Uses mode-resolved variants from getCategoryTools() for get-actor-run.
|
|
207
211
|
*/
|
|
208
212
|
const hasCallActor = result.some((entry) => entry.name === HelperTools.ACTOR_CALL);
|
|
209
213
|
const hasActorTools = result.some((entry) => entry.type === 'actor');
|
|
210
214
|
const hasAddActorTool = result.some((entry) => entry.name === HelperTools.ACTOR_ADD);
|
|
211
|
-
|
|
212
|
-
const hasGetActorOutput = result.some((entry) => entry.name === HelperTools.ACTOR_OUTPUT_GET);
|
|
215
|
+
// No presence guards here — the de-dup pass at the end drops any duplicates.
|
|
213
216
|
const toolsToInject = [];
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
toolsToInject.push(modeGetActorRun);
|
|
217
|
+
// In default mode call-actor is synchronous, so get-actor-run is only needed when call-actor
|
|
218
|
+
// is present. In apps mode call-actor is always async, so actor tools also need get-actor-run.
|
|
219
|
+
if (hasCallActor || (hasActorTools && mode === ServerMode.APPS)) {
|
|
220
|
+
toolsToInject.push(defaultGetActorRun);
|
|
219
221
|
}
|
|
220
|
-
if (
|
|
222
|
+
if (hasCallActor || hasActorTools || hasAddActorTool) {
|
|
221
223
|
toolsToInject.push(getActorOutput);
|
|
222
224
|
}
|
|
223
225
|
if (toolsToInject.length > 0) {
|
|
@@ -229,6 +231,17 @@ export function getToolsForServerMode(input, actorTools, mode = ServerMode.DEFAU
|
|
|
229
231
|
result.push(...toolsToInject);
|
|
230
232
|
}
|
|
231
233
|
}
|
|
234
|
+
// Apps mode: append a widget tool for each base tool already in the result.
|
|
235
|
+
// Runs after the get-actor-run auto-inject so an auto-injected base still
|
|
236
|
+
// brings its widget sibling.
|
|
237
|
+
if (mode === ServerMode.APPS) {
|
|
238
|
+
for (const entry of [...result]) {
|
|
239
|
+
const widget = WIDGET_BY_BASE_TOOL.get(entry.name);
|
|
240
|
+
// Push unconditionally; any duplicates are stripped by the de-dup pass below.
|
|
241
|
+
if (widget)
|
|
242
|
+
result.push(widget);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
232
245
|
// De-duplicate by tool name for safety
|
|
233
246
|
const seen = new Set();
|
|
234
247
|
return result.filter((entry) => !seen.has(entry.name) && seen.add(entry.name));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools_loader.js","sourceRoot":"","sources":["../../src/utils/tools_loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,GAAG,MAAM,YAAY,CAAC;AAE7B,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,
|
|
1
|
+
{"version":3,"file":"tools_loader.js","sourceRoot":"","sources":["../../src/utils/tools_loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,GAAG,MAAM,YAAY,CAAC;AAE7B,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EACH,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,8BAA8B,EAC9B,mBAAmB,GACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEvD,mGAAmG;AACnG,IAAI,6BAA6B,GAAuB,IAAI,CAAC;AAC7D,SAAS,uBAAuB;IAC5B,IAAI,CAAC,6BAA6B,EAAE,CAAC;QACjC,MAAM,QAAQ,GAAG,IAAI,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CAAC;QAC3D,CAAC;aAAM,CAAC;YACJ,MAAM,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC;QAClC,CAAC;IACL,CAAC;IAED,4EAA4E;IAC5E,0EAA0E;IAC1E,6BAA6B;IAC7B,IAAI,IAAI,KAAK,UAAU,CAAC,IAAI,EAAE,CAAC;QAC3B,KAAK,MAAM,KAAK,IAAI,CAAC,GAAG,MAAM,CAAC,EAAE,CAAC;YAC9B,MAAM,MAAM,GAAG,mBAAmB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAmB,CAAC,CAAC;YAClE,8EAA8E;YAC9E,IAAI,MAAM;gBAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACpC,CAAC;IACL,CAAC;IAED,uCAAuC;IACvC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AACnF,CAAC;AAED,0FAA0F;AAC1F,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACpC,KAAY,EACZ,WAAwB,EACxB,OAAmB,UAAU,CAAC,OAAO,EACrC,UAAuB;IAEvB,MAAM,UAAU,GAAG,MAAM,SAAS,CAAC,KAAK,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;IACnE,OAAO,qBAAqB,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;AAC1D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apify/actors-mcp-server",
|
|
3
|
-
"version": "0.9.21-beta.
|
|
3
|
+
"version": "0.9.21-beta.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Apify MCP Server",
|
|
6
6
|
"mcpName": "com.apify/apify-mcp-server",
|
|
@@ -97,6 +97,9 @@
|
|
|
97
97
|
"test": "npm run test:unit",
|
|
98
98
|
"test:unit": "vitest run tests/unit",
|
|
99
99
|
"test:integration": "npm run build && vitest run tests/integration",
|
|
100
|
+
"test:integration:stdio": "npm run build && vitest run tests/integration/stdio.test.ts",
|
|
101
|
+
"test:integration:sse": "npm run build && vitest run tests/integration/actor.server_sse.test.ts",
|
|
102
|
+
"test:integration:streamable": "npm run build && vitest run tests/integration/actor.server_streamable.test.ts",
|
|
100
103
|
"inspector:stdio": "npx @modelcontextprotocol/inspector -e APIFY_TOKEN=$APIFY_TOKEN -- node dist/stdio.js",
|
|
101
104
|
"evals:create-dataset": "tsx evals/create_dataset.ts",
|
|
102
105
|
"evals:run": "tsx evals/run_evaluation.ts",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ToolEntry } from '../../types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Apps mode fetch-actor-details tool.
|
|
4
|
-
* Returns simplified structured content with interactive widget metadata.
|
|
5
|
-
*/
|
|
6
|
-
export declare const appsFetchActorDetails: ToolEntry;
|
|
7
|
-
//# sourceMappingURL=fetch_actor_details.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetch_actor_details.d.ts","sourceRoot":"","sources":["../../../src/tools/apps/fetch_actor_details.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAoB,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAgBlE;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,SA6CzB,CAAC"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import dedent from 'dedent';
|
|
2
|
-
import { ApifyClient } from '../../apify_client.js';
|
|
3
|
-
import { getWidgetConfig, WIDGET_URIS } from '../../resources/widgets.js';
|
|
4
|
-
import { buildActorDetailsForWidget, buildCardOptions, fetchActorDetails, } from '../../utils/actor_details.js';
|
|
5
|
-
import { buildMCPResponse } from '../../utils/mcp.js';
|
|
6
|
-
import { getUserInfoCached } from '../../utils/userid_cache.js';
|
|
7
|
-
import { fixActorNameInputAndLog } from '../core/actor_tools_factory.js';
|
|
8
|
-
import { buildActorNotFoundResponse, fetchActorDetailsMetadata, fetchActorDetailsToolArgsSchema, resolveOutputOptions, } from '../core/fetch_actor_details_common.js';
|
|
9
|
-
/**
|
|
10
|
-
* Apps mode fetch-actor-details tool.
|
|
11
|
-
* Returns simplified structured content with interactive widget metadata.
|
|
12
|
-
*/
|
|
13
|
-
export const appsFetchActorDetails = Object.freeze({
|
|
14
|
-
...fetchActorDetailsMetadata,
|
|
15
|
-
call: async (toolArgs) => {
|
|
16
|
-
const { args, apifyToken, mcpSessionId } = toolArgs;
|
|
17
|
-
const parsed = fetchActorDetailsToolArgsSchema.parse(args);
|
|
18
|
-
const actorName = fixActorNameInputAndLog(parsed.actor, { mcpSessionId, route: 'fetch-actor-details' });
|
|
19
|
-
const apifyClient = new ApifyClient({ token: apifyToken });
|
|
20
|
-
const { userPlanTier } = await getUserInfoCached(apifyToken, apifyClient);
|
|
21
|
-
const cardOptions = { ...buildCardOptions(resolveOutputOptions(parsed.output)), userTier: userPlanTier };
|
|
22
|
-
const details = await fetchActorDetails(apifyClient, actorName, cardOptions);
|
|
23
|
-
if (!details) {
|
|
24
|
-
return buildActorNotFoundResponse(actorName);
|
|
25
|
-
}
|
|
26
|
-
const { actorUrl, actorDetails } = buildActorDetailsForWidget(details, userPlanTier);
|
|
27
|
-
// Pricing is already carried by `actorDetails.actorInfo.currentPricingInfo` (widget-facing,
|
|
28
|
-
// tier-aware simplified). Omit the complete-mode `pricing` field from the top-level
|
|
29
|
-
// `actorInfo` to avoid two conflicting pricing shapes in the same response.
|
|
30
|
-
const { pricing: _pricing, ...actorInfoWithoutPricing } = details.actorCardStructured;
|
|
31
|
-
const structuredContent = {
|
|
32
|
-
actorInfo: actorInfoWithoutPricing,
|
|
33
|
-
inputSchema: details.inputSchema,
|
|
34
|
-
actorDetails,
|
|
35
|
-
};
|
|
36
|
-
const texts = [dedent `
|
|
37
|
-
# Actor information:
|
|
38
|
-
- **Actor:** ${actorName}
|
|
39
|
-
- **URL:** ${actorUrl}
|
|
40
|
-
|
|
41
|
-
An interactive widget has been rendered with detailed Actor information.
|
|
42
|
-
`];
|
|
43
|
-
const widgetConfig = getWidgetConfig(WIDGET_URIS.SEARCH_ACTORS);
|
|
44
|
-
return buildMCPResponse({
|
|
45
|
-
texts,
|
|
46
|
-
structuredContent,
|
|
47
|
-
// Response-level meta; only returned in apps mode (this handler is apps-only)
|
|
48
|
-
_meta: {
|
|
49
|
-
...widgetConfig === null || widgetConfig === void 0 ? void 0 : widgetConfig.meta,
|
|
50
|
-
'openai/widgetDescription': `Actor details for ${actorName} from Apify Store`,
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
},
|
|
54
|
-
});
|
|
55
|
-
//# sourceMappingURL=fetch_actor_details.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetch_actor_details.js","sourceRoot":"","sources":["../../../src/tools/apps/fetch_actor_details.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE1E,OAAO,EACH,0BAA0B,EAC1B,gBAAgB,EAChB,iBAAiB,GACpB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EACH,0BAA0B,EAC1B,yBAAyB,EACzB,+BAA+B,EAC/B,oBAAoB,GACvB,MAAM,uCAAuC,CAAC;AAE/C;;;GAGG;AACH,MAAM,CAAC,MAAM,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C,MAAM,CAAA;;2BAEF,SAAS;yBACX,QAAQ;;;SAGxB,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,qBAAqB,SAAS,mBAAmB;aAChF;SACJ,CAAC,CAAC;IACP,CAAC;CACK,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetch_actor_details_internal.d.ts","sourceRoot":"","sources":["../../../src/tools/apps/fetch_actor_details_internal.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAmB,MAAM,gBAAgB,CAAC;AAQjE,eAAO,MAAM,6BAA6B,EAAE,SA4BjC,CAAC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import dedent from 'dedent';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import { HelperTools } from '../../const.js';
|
|
4
|
-
import { compileSchema } from '../../utils/ajv.js';
|
|
5
|
-
import { buildFetchActorDetailsResult, fetchActorDetailsToolArgsSchema, } from '../core/fetch_actor_details_common.js';
|
|
6
|
-
import { actorDetailsOutputSchema } from '../structured_output_schemas.js';
|
|
7
|
-
export const fetchActorDetailsInternalTool = Object.freeze({
|
|
8
|
-
type: 'internal',
|
|
9
|
-
name: HelperTools.ACTOR_GET_DETAILS_INTERNAL,
|
|
10
|
-
description: dedent `
|
|
11
|
-
Fetch Actor details with flexible output options (apps mode internal tool).
|
|
12
|
-
|
|
13
|
-
This tool is available because the LLM is operating in apps mode. Use it for internal lookups
|
|
14
|
-
where data presentation to the user is NOT needed - this tool does NOT render a widget.
|
|
15
|
-
|
|
16
|
-
Use 'output' parameter with boolean flags to control returned information:
|
|
17
|
-
- Default: Fields: description, stats, pricing, rating, metadata, inputSchema, readme - except mcpTools
|
|
18
|
-
- Selective: Set desired fields to true to save tokens (e.g., output: { inputSchema: true, readme: false })
|
|
19
|
-
- Common patterns: inputSchema only for execution prep, readme + inputSchema for documentation, etc.
|
|
20
|
-
|
|
21
|
-
Use this instead of fetch-actor-details when you need Actor information to prepare execution
|
|
22
|
-
but the user did NOT explicitly ask for Actor details presentation.
|
|
23
|
-
`,
|
|
24
|
-
inputSchema: z.toJSONSchema(fetchActorDetailsToolArgsSchema),
|
|
25
|
-
outputSchema: actorDetailsOutputSchema,
|
|
26
|
-
ajvValidate: compileSchema(z.toJSONSchema(fetchActorDetailsToolArgsSchema)),
|
|
27
|
-
annotations: {
|
|
28
|
-
title: 'Fetch Actor details internal',
|
|
29
|
-
readOnlyHint: true,
|
|
30
|
-
destructiveHint: false,
|
|
31
|
-
idempotentHint: true,
|
|
32
|
-
openWorldHint: false,
|
|
33
|
-
},
|
|
34
|
-
call: async (toolArgs) => buildFetchActorDetailsResult(toolArgs, HelperTools.ACTOR_GET_DETAILS_INTERNAL),
|
|
35
|
-
});
|
|
36
|
-
//# sourceMappingURL=fetch_actor_details_internal.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetch_actor_details_internal.js","sourceRoot":"","sources":["../../../src/tools/apps/fetch_actor_details_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,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACH,4BAA4B,EAC5B,+BAA+B,GAClC,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAE3E,MAAM,CAAC,MAAM,6BAA6B,GAAc,MAAM,CAAC,MAAM,CAAC;IAClE,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,WAAW,CAAC,0BAA0B;IAC5C,WAAW,EAAE,MAAM,CAAA;;;;;;;;;;;;;KAalB;IACD,WAAW,EAAE,CAAC,CAAC,YAAY,CAAC,+BAA+B,CAAoB;IAC/E,YAAY,EAAE,wBAAwB;IACtC,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC,YAAY,CAAC,+BAA+B,CAAC,CAAC;IAC3E,WAAW,EAAE;QACT,KAAK,EAAE,8BAA8B;QACrC,YAAY,EAAE,IAAI;QAClB,eAAe,EAAE,KAAK;QACtB,cAAc,EAAE,IAAI;QACpB,aAAa,EAAE,KAAK;KACvB;IACD,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,4BAA4B,CAAC,QAAQ,EAAE,WAAW,CAAC,0BAA0B,CAAC;CAClG,CAAC,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ToolEntry } from '../../types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Apps mode get-actor-run tool.
|
|
4
|
-
* Returns abbreviated text with widget metadata for interactive progress display.
|
|
5
|
-
*/
|
|
6
|
-
export declare const appsGetActorRun: ToolEntry;
|
|
7
|
-
//# sourceMappingURL=get_actor_run.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get_actor_run.d.ts","sourceRoot":"","sources":["../../../src/tools/apps/get_actor_run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAUlE;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,SAuBnB,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { logHttpError } from '../../utils/logging.js';
|
|
2
|
-
import { buildGetActorRunError, buildGetActorRunSuccessResponse, fetchActorRunData, getActorRunArgs, getActorRunMetadata, } from '../core/get_actor_run_common.js';
|
|
3
|
-
/**
|
|
4
|
-
* Apps mode get-actor-run tool.
|
|
5
|
-
* Returns abbreviated text with widget metadata for interactive progress display.
|
|
6
|
-
*/
|
|
7
|
-
export const appsGetActorRun = Object.freeze({
|
|
8
|
-
...getActorRunMetadata,
|
|
9
|
-
call: async (toolArgs) => {
|
|
10
|
-
const { args, apifyClient: client, mcpSessionId } = toolArgs;
|
|
11
|
-
const parsed = getActorRunArgs.parse(args);
|
|
12
|
-
try {
|
|
13
|
-
const fetchResult = await fetchActorRunData({
|
|
14
|
-
runId: parsed.runId,
|
|
15
|
-
client,
|
|
16
|
-
mcpSessionId,
|
|
17
|
-
});
|
|
18
|
-
if ('error' in fetchResult) {
|
|
19
|
-
return fetchResult.error;
|
|
20
|
-
}
|
|
21
|
-
return buildGetActorRunSuccessResponse({ ...fetchResult.result, widget: true });
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
logHttpError(error, 'Failed to get Actor run', { runId: parsed.runId });
|
|
25
|
-
return buildGetActorRunError(parsed.runId, error);
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
//# sourceMappingURL=get_actor_run.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get_actor_run.js","sourceRoot":"","sources":["../../../src/tools/apps/get_actor_run.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EACH,qBAAqB,EACrB,+BAA+B,EAC/B,iBAAiB,EACjB,eAAe,EACf,mBAAmB,GACtB,MAAM,iCAAiC,CAAC;AAEzC;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAc,MAAM,CAAC,MAAM,CAAC;IACpD,GAAG,mBAAmB;IACtB,IAAI,EAAE,KAAK,EAAE,QAA0B,EAAE,EAAE;QACvC,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,QAAQ,CAAC;QAC7D,MAAM,MAAM,GAAG,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAE3C,IAAI,CAAC;YACD,MAAM,WAAW,GAAG,MAAM,iBAAiB,CAAC;gBACxC,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,MAAM;gBACN,YAAY;aACf,CAAC,CAAC;YAEH,IAAI,OAAO,IAAI,WAAW,EAAE,CAAC;gBACzB,OAAO,WAAW,CAAC,KAAK,CAAC;YAC7B,CAAC;YAED,OAAO,+BAA+B,CAAC,EAAE,GAAG,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QACpF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,YAAY,CAAC,KAAK,EAAE,yBAAyB,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;YACxE,OAAO,qBAAqB,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACtD,CAAC;IACL,CAAC;CACK,CAAC,CAAC"}
|
|
@@ -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,SAsFpB,CAAC"}
|
|
@@ -1,89 +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} when the user
|
|
41
|
-
wants to browse or explore Actors (e.g., "show me", "find me").
|
|
42
|
-
Use ${HelperTools.ACTOR_GET_DETAILS_INTERNAL} when the user wants to execute a task and
|
|
43
|
-
you need the input schema (e.g., "scrape", "extract").
|
|
44
|
-
IMPORTANT: You MUST always do a second search with broader, more generic keywords
|
|
45
|
-
(e.g., just the platform name like "TikTok" instead of "TikTok posts") to make sure
|
|
46
|
-
you haven't missed a better Actor.
|
|
47
|
-
`,
|
|
48
|
-
};
|
|
49
|
-
// Add widget-formatted actors for the interactive UI
|
|
50
|
-
structuredContent.widgetActors = actors.map((actor) => formatActorForWidget(actor, userPlanTier));
|
|
51
|
-
const texts = [dedent `
|
|
52
|
-
# Search results:
|
|
53
|
-
- **Search query:** ${parsed.keywords}
|
|
54
|
-
- **Number of Actors found:** ${actors.length}
|
|
55
|
-
|
|
56
|
-
An interactive widget has been rendered with the search results. The user can already see
|
|
57
|
-
the list of Actors visually in the widget, so do NOT print or summarize the Actor list
|
|
58
|
-
in your response.
|
|
59
|
-
|
|
60
|
-
# Actors:
|
|
61
|
-
|
|
62
|
-
${actorCardText}
|
|
63
|
-
|
|
64
|
-
## Choosing the right details tool:
|
|
65
|
-
- Use ${HelperTools.ACTOR_GET_DETAILS} when the user wants to **browse or explore**
|
|
66
|
-
Actors (e.g., "show me Google Maps scrapers", "find me a TikTok scraper", "what Actors
|
|
67
|
-
exist for LinkedIn"). This renders an interactive widget for the user.
|
|
68
|
-
- Use ${HelperTools.ACTOR_GET_DETAILS_INTERNAL} when the user wants to **execute a task**
|
|
69
|
-
and you need the Actor's input schema to prepare the run (e.g., "scrape Google Maps for
|
|
70
|
-
restaurants", "extract emails from this website"). This is a silent lookup — no widget
|
|
71
|
-
is rendered.
|
|
72
|
-
|
|
73
|
-
IMPORTANT: You MUST always do a second search with broader, more generic keywords
|
|
74
|
-
(e.g., just the platform name like "TikTok" instead of "TikTok posts") to make sure
|
|
75
|
-
you haven't missed a better Actor.
|
|
76
|
-
`];
|
|
77
|
-
const widgetConfig = getWidgetConfig(WIDGET_URIS.SEARCH_ACTORS);
|
|
78
|
-
return buildMCPResponse({
|
|
79
|
-
texts,
|
|
80
|
-
structuredContent,
|
|
81
|
-
// Response-level meta; only returned in apps mode (this handler is apps-only)
|
|
82
|
-
_meta: {
|
|
83
|
-
...widgetConfig === null || widgetConfig === void 0 ? void 0 : widgetConfig.meta,
|
|
84
|
-
'openai/widgetDescription': `Interactive actor search results showing ${actors.length} actors from Apify Store`,
|
|
85
|
-
},
|
|
86
|
-
});
|
|
87
|
-
},
|
|
88
|
-
});
|
|
89
|
-
//# 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,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,8BAA8B,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAExJ;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAc,MAAM,CAAC,MAAM,CAAC;IACrD,GAAG,oBAAoB;IACvB,IAAI,EAAE,KAAK,EAAE,QAA0B,EAAE,EAAE;QACvC,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,kBAAkB,EAAE,cAAc,EAAE,GAAG,QAAQ,CAAC;QACvF,MAAM,MAAM,GAAG,sBAAsB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAClD,+EAA+E;QAC/E,uCAAuC;QACvC,MAAM,CAAC,MAAM,EAAE,EAAE,YAAY,EAAE,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YACjD,qBAAqB,CAAC;gBAClB,QAAQ,EAAE,MAAM,CAAC,QAAQ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