@apify/actors-mcp-server 0.9.18-beta.1 → 0.9.18-beta.11
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/README.md +124 -87
- package/dist/dev_server.js +1 -1
- package/dist/dev_server.js.map +1 -1
- package/dist/mcp/server.d.ts +3 -9
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +68 -47
- package/dist/mcp/server.js.map +1 -1
- package/dist/payments/helpers.d.ts +7 -7
- package/dist/payments/helpers.d.ts.map +1 -1
- package/dist/payments/helpers.js +9 -9
- package/dist/payments/helpers.js.map +1 -1
- package/dist/tools/core/actor_execution.d.ts.map +1 -1
- package/dist/tools/core/actor_execution.js +37 -13
- package/dist/tools/core/actor_execution.js.map +1 -1
- package/dist/tools/core/actor_tools_factory.d.ts +13 -0
- package/dist/tools/core/actor_tools_factory.d.ts.map +1 -1
- package/dist/tools/core/actor_tools_factory.js +52 -7
- package/dist/tools/core/actor_tools_factory.js.map +1 -1
- package/dist/tools/core/call_actor_common.d.ts +4 -0
- package/dist/tools/core/call_actor_common.d.ts.map +1 -1
- package/dist/tools/core/call_actor_common.js +8 -2
- package/dist/tools/core/call_actor_common.js.map +1 -1
- package/dist/tools/core/search_actors_common.d.ts +1 -1
- package/dist/tools/core/search_actors_common.d.ts.map +1 -1
- package/dist/tools/core/search_actors_common.js +18 -18
- package/dist/tools/core/search_actors_common.js.map +1 -1
- package/dist/tools/default/fetch_actor_details.d.ts.map +1 -1
- package/dist/tools/default/fetch_actor_details.js +8 -6
- package/dist/tools/default/fetch_actor_details.js.map +1 -1
- package/dist/tools/default/get_actor_run.d.ts.map +1 -1
- package/dist/tools/default/get_actor_run.js +1 -3
- package/dist/tools/default/get_actor_run.js.map +1 -1
- package/dist/tools/default/search_actors.d.ts +1 -1
- package/dist/tools/default/search_actors.d.ts.map +1 -1
- package/dist/tools/default/search_actors.js +30 -19
- package/dist/tools/default/search_actors.js.map +1 -1
- package/dist/tools/openai/fetch_actor_details.d.ts.map +1 -1
- package/dist/tools/openai/fetch_actor_details.js +7 -5
- package/dist/tools/openai/fetch_actor_details.js.map +1 -1
- package/dist/tools/openai/fetch_actor_details_internal.d.ts.map +1 -1
- package/dist/tools/openai/fetch_actor_details_internal.js +6 -4
- package/dist/tools/openai/fetch_actor_details_internal.js.map +1 -1
- package/dist/tools/openai/search_actors.d.ts.map +1 -1
- package/dist/tools/openai/search_actors.js +37 -17
- package/dist/tools/openai/search_actors.js.map +1 -1
- package/dist/tools/openai/search_actors_internal.d.ts.map +1 -1
- package/dist/tools/openai/search_actors_internal.js +11 -10
- package/dist/tools/openai/search_actors_internal.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/ajv.d.ts +10 -1
- package/dist/utils/ajv.d.ts.map +1 -1
- package/dist/utils/ajv.js +11 -2
- package/dist/utils/ajv.js.map +1 -1
- package/dist/utils/mcp.d.ts +2 -0
- package/dist/utils/mcp.d.ts.map +1 -1
- package/dist/utils/mcp.js +13 -0
- package/dist/utils/mcp.js.map +1 -1
- package/dist/utils/payment_errors.d.ts.map +1 -1
- package/dist/utils/payment_errors.js +9 -4
- package/dist/utils/payment_errors.js.map +1 -1
- package/dist/web/dist/actor-detail-widget.js +236 -236
- package/dist/web/dist/actor-run-widget.js +236 -236
- package/dist/web/dist/search-actors-widget.js +216 -216
- package/manifest.json +1 -1
- package/package.json +2 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import dedent from 'dedent';
|
|
1
2
|
import { HelperTools } from '../../const.js';
|
|
2
3
|
import { formatActorToActorCard, formatActorToStructuredCard } from '../../utils/actor_card.js';
|
|
3
4
|
import { searchAndFilterActors } from '../../utils/actor_search.js';
|
|
4
5
|
import { buildMCPResponse } from '../../utils/mcp.js';
|
|
5
|
-
import { searchActorsArgsSchema, searchActorsMetadata
|
|
6
|
+
import { searchActorsArgsSchema, searchActorsMetadata } from '../core/search_actors_common.js';
|
|
6
7
|
/**
|
|
7
8
|
* Default mode search-actors tool.
|
|
8
|
-
* Returns text-based
|
|
9
|
+
* Returns text-based Actor cards without widget metadata.
|
|
9
10
|
*/
|
|
10
11
|
export const defaultSearchActors = Object.freeze({
|
|
11
12
|
...searchActorsMetadata,
|
|
@@ -21,8 +22,11 @@ export const defaultSearchActors = Object.freeze({
|
|
|
21
22
|
userRentedActorIds,
|
|
22
23
|
});
|
|
23
24
|
if (actors.length === 0) {
|
|
24
|
-
const instructions = `
|
|
25
|
-
|
|
25
|
+
const instructions = dedent `
|
|
26
|
+
No Actors were found for the search query "${parsed.keywords}".
|
|
27
|
+
You MUST retry with broader, more generic keywords - use just the platform name
|
|
28
|
+
(e.g., "TikTok" instead of "TikTok posts") before concluding no Actor exists.
|
|
29
|
+
`;
|
|
26
30
|
const structuredContent = {
|
|
27
31
|
actors: [],
|
|
28
32
|
query: parsed.keywords,
|
|
@@ -36,27 +40,34 @@ You MUST retry with broader, more generic keywords - use just the platform name
|
|
|
36
40
|
actors: structuredActorCards,
|
|
37
41
|
query: parsed.keywords,
|
|
38
42
|
count: actors.length,
|
|
39
|
-
instructions: `
|
|
40
|
-
|
|
43
|
+
instructions: dedent `
|
|
44
|
+
If you need more detailed information about any of these Actors, including their
|
|
45
|
+
input schemas and usage instructions, please use the ${HelperTools.ACTOR_GET_DETAILS}
|
|
46
|
+
tool with the specific Actor name.
|
|
47
|
+
IMPORTANT: You MUST always do a second search with broader, more generic keywords
|
|
48
|
+
(e.g., just the platform name like "TikTok" instead of "TikTok posts") to make sure
|
|
49
|
+
you haven't missed a better Actor.
|
|
50
|
+
`,
|
|
41
51
|
};
|
|
42
52
|
const actorCards = actors.map((actor) => formatActorToActorCard(actor));
|
|
43
53
|
const actorsText = actorCards.join('\n\n');
|
|
44
|
-
const instructions = `
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
54
|
+
const instructions = dedent `
|
|
55
|
+
# Search results:
|
|
56
|
+
- **Search query:** ${parsed.keywords}
|
|
57
|
+
- **Number of Actors found:** ${actors.length}
|
|
48
58
|
|
|
49
|
-
|
|
59
|
+
# Actors:
|
|
50
60
|
|
|
51
|
-
|
|
61
|
+
${actorsText}
|
|
52
62
|
|
|
53
|
-
If you need more detailed information about any of these Actors, including their input
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
63
|
+
If you need more detailed information about any of these Actors, including their input
|
|
64
|
+
schemas and usage instructions, use the ${HelperTools.ACTOR_GET_DETAILS} tool with the
|
|
65
|
+
specific Actor name.
|
|
66
|
+
IMPORTANT: You MUST always do a second search with broader, more generic keywords
|
|
67
|
+
(e.g., just the platform name like "TikTok" instead of "TikTok posts") to make sure
|
|
68
|
+
you haven't missed a better Actor.
|
|
69
|
+
`;
|
|
70
|
+
return buildMCPResponse({ texts: [instructions], structuredContent });
|
|
60
71
|
},
|
|
61
72
|
});
|
|
62
73
|
//# sourceMappingURL=search_actors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search_actors.js","sourceRoot":"","sources":["../../../src/tools/default/search_actors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAChG,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,
|
|
1
|
+
{"version":3,"file":"search_actors.js","sourceRoot":"","sources":["../../../src/tools/default/search_actors.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAChG,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B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KAAK,EAAE,MAAM,CAAC,QAAQ;YACtB,KAAK,EAAE,MAAM,CAAC,MAAM;YACpB,YAAY,EAAE,MAAM,CAAA;;uEAEuC,WAAW,CAAC,iBAAiB;;;;;aAKvF;SACJ,CAAC;QAEF,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAC;QACxE,MAAM,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC3C,MAAM,YAAY,GAAG,MAAM,CAAA;;kCAED,MAAM,CAAC,QAAQ;4CACL,MAAM,CAAC,MAAM;;;;cAI3C,UAAU;;;sDAG8B,WAAW,CAAC,iBAAiB;;;;;SAK1E,CAAC;QACF,OAAO,gBAAgB,CAAC,EAAE,KAAK,EAAE,CAAC,YAAY,CAAC,EAAE,iBAAiB,EAAE,CAAC,CAAC;IAC1E,CAAC;CACK,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch_actor_details.d.ts","sourceRoot":"","sources":["../../../src/tools/openai/fetch_actor_details.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAoB,SAAS,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"fetch_actor_details.d.ts","sourceRoot":"","sources":["../../../src/tools/openai/fetch_actor_details.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAoB,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAelE;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,SA0C3B,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { ApifyClient } from '../../apify_client.js';
|
|
|
2
2
|
import { getWidgetConfig, WIDGET_URIS } from '../../resources/widgets.js';
|
|
3
3
|
import { buildActorNotFoundResponse, buildCardOptions, fetchActorDetails, processActorDetailsForResponse, resolveOutputOptions, } from '../../utils/actor_details.js';
|
|
4
4
|
import { buildMCPResponse } from '../../utils/mcp.js';
|
|
5
|
+
import { fixActorNameInputAndLog } from '../core/actor_tools_factory.js';
|
|
5
6
|
import { fetchActorDetailsMetadata, fetchActorDetailsToolArgsSchema, } from '../core/fetch_actor_details_common.js';
|
|
6
7
|
/**
|
|
7
8
|
* OpenAI mode fetch-actor-details tool.
|
|
@@ -10,14 +11,15 @@ import { fetchActorDetailsMetadata, fetchActorDetailsToolArgsSchema, } from '../
|
|
|
10
11
|
export const openaiFetchActorDetails = Object.freeze({
|
|
11
12
|
...fetchActorDetailsMetadata,
|
|
12
13
|
call: async (toolArgs) => {
|
|
13
|
-
const { args, apifyToken } = toolArgs;
|
|
14
|
+
const { args, apifyToken, mcpSessionId } = toolArgs;
|
|
14
15
|
const parsed = fetchActorDetailsToolArgsSchema.parse(args);
|
|
16
|
+
const actorName = fixActorNameInputAndLog(parsed.actor, { mcpSessionId, route: 'fetch-actor-details' });
|
|
15
17
|
const apifyClient = new ApifyClient({ token: apifyToken });
|
|
16
18
|
const resolvedOutput = resolveOutputOptions(parsed.output);
|
|
17
19
|
const cardOptions = buildCardOptions(resolvedOutput);
|
|
18
|
-
const details = await fetchActorDetails(apifyClient,
|
|
20
|
+
const details = await fetchActorDetails(apifyClient, actorName, cardOptions);
|
|
19
21
|
if (!details) {
|
|
20
|
-
return buildActorNotFoundResponse(
|
|
22
|
+
return buildActorNotFoundResponse(actorName);
|
|
21
23
|
}
|
|
22
24
|
const { structuredContent: processedStructuredContent, actorUrl } = processActorDetailsForResponse(details);
|
|
23
25
|
const structuredContent = {
|
|
@@ -27,7 +29,7 @@ export const openaiFetchActorDetails = Object.freeze({
|
|
|
27
29
|
};
|
|
28
30
|
const texts = [`
|
|
29
31
|
# Actor information:
|
|
30
|
-
- **Actor:** ${
|
|
32
|
+
- **Actor:** ${actorName}
|
|
31
33
|
- **URL:** ${actorUrl}
|
|
32
34
|
|
|
33
35
|
An interactive widget has been rendered with detailed Actor information.
|
|
@@ -39,7 +41,7 @@ An interactive widget has been rendered with detailed Actor information.
|
|
|
39
41
|
// Response-level meta; only returned in openai mode (this handler is openai-only)
|
|
40
42
|
_meta: {
|
|
41
43
|
...widgetConfig === null || widgetConfig === void 0 ? void 0 : widgetConfig.meta,
|
|
42
|
-
'openai/widgetDescription': `Actor details for ${
|
|
44
|
+
'openai/widgetDescription': `Actor details for ${actorName} from Apify Store`,
|
|
43
45
|
},
|
|
44
46
|
});
|
|
45
47
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch_actor_details.js","sourceRoot":"","sources":["../../../src/tools/openai/fetch_actor_details.ts"],"names":[],"mappings":"AAAA,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,EACjB,8BAA8B,EAC9B,oBAAoB,GACvB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACH,yBAAyB,EACzB,+BAA+B,GAClC,MAAM,uCAAuC,CAAC;AAE/C;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAc,MAAM,CAAC,MAAM,CAAC;IAC5D,GAAG,yBAAyB;IAC5B,IAAI,EAAE,KAAK,EAAE,QAA0B,EAAE,EAAE;QACvC,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"fetch_actor_details.js","sourceRoot":"","sources":["../../../src/tools/openai/fetch_actor_details.ts"],"names":[],"mappings":"AAAA,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,EACjB,8BAA8B,EAC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BAA0B,CAAC,YAAY;SACxD,CAAC;QAEF,MAAM,KAAK,GAAG,CAAC;;eAER,SAAS;aACX,QAAQ;;;CAGpB,CAAC,CAAC;QAEK,MAAM,YAAY,GAAG,eAAe,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;QAChE,OAAO,gBAAgB,CAAC;YACpB,KAAK;YACL,iBAAiB;YACjB,kFAAkF;YAClF,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch_actor_details_internal.d.ts","sourceRoot":"","sources":["../../../src/tools/openai/fetch_actor_details_internal.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAoB,SAAS,EAAmB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"fetch_actor_details_internal.d.ts","sourceRoot":"","sources":["../../../src/tools/openai/fetch_actor_details_internal.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAoB,SAAS,EAAmB,MAAM,gBAAgB,CAAC;AAsBnF,eAAO,MAAM,6BAA6B,EAAE,SA0DjC,CAAC"}
|
|
@@ -4,6 +4,7 @@ import { HelperTools } from '../../const.js';
|
|
|
4
4
|
import { actorDetailsOutputOptionsSchema, buildActorDetailsTextResponse, buildActorNotFoundResponse, buildCardOptions, fetchActorDetails, resolveOutputOptions, } from '../../utils/actor_details.js';
|
|
5
5
|
import { compileSchema } from '../../utils/ajv.js';
|
|
6
6
|
import { buildMCPResponse } from '../../utils/mcp.js';
|
|
7
|
+
import { fixActorNameInputAndLog } from '../core/actor_tools_factory.js';
|
|
7
8
|
import { actorDetailsOutputSchema } from '../structured_output_schemas.js';
|
|
8
9
|
const fetchActorDetailsInternalArgsSchema = z.object({
|
|
9
10
|
actor: z.string()
|
|
@@ -41,19 +42,20 @@ but the user did NOT explicitly ask for Actor details presentation.`,
|
|
|
41
42
|
var _a;
|
|
42
43
|
const { args, apifyToken, apifyMcpServer, mcpSessionId } = toolArgs;
|
|
43
44
|
const parsed = fetchActorDetailsInternalArgsSchema.parse(args);
|
|
45
|
+
const actorName = fixActorNameInputAndLog(parsed.actor, { mcpSessionId, route: 'fetch-actor-details-internal' });
|
|
44
46
|
const apifyClient = new ApifyClient({ token: apifyToken });
|
|
45
47
|
const resolvedOutput = resolveOutputOptions(parsed.output);
|
|
46
48
|
const cardOptions = buildCardOptions(resolvedOutput);
|
|
47
|
-
const details = await fetchActorDetails(apifyClient,
|
|
49
|
+
const details = await fetchActorDetails(apifyClient, actorName, cardOptions);
|
|
48
50
|
if (!details) {
|
|
49
|
-
return buildActorNotFoundResponse(
|
|
51
|
+
return buildActorNotFoundResponse(actorName);
|
|
50
52
|
}
|
|
51
53
|
// Fetch output schema from ActorStore if available and requested
|
|
52
54
|
const actorOutputSchema = resolvedOutput.outputSchema
|
|
53
|
-
? await ((_a = apifyMcpServer.actorStore) === null || _a === void 0 ? void 0 : _a.getActorOutputSchemaAsTypeObject(
|
|
55
|
+
? await ((_a = apifyMcpServer.actorStore) === null || _a === void 0 ? void 0 : _a.getActorOutputSchemaAsTypeObject(actorName).catch(() => null))
|
|
54
56
|
: undefined;
|
|
55
57
|
const { texts, structuredContent } = await buildActorDetailsTextResponse({
|
|
56
|
-
actorName
|
|
58
|
+
actorName,
|
|
57
59
|
details,
|
|
58
60
|
output: resolvedOutput,
|
|
59
61
|
cardOptions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch_actor_details_internal.js","sourceRoot":"","sources":["../../../src/tools/openai/fetch_actor_details_internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MA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QAC/D,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;QAE3D,MAAM,cAAc,GAAG,oBAAoB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC3D,MAAM,WAAW,GAAG,gBAAgB,CAAC,cAAc,CAAC,CAAC;QAErD,MAAM,OAAO,GAAG,MAAM,iBAAiB,CAAC,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"fetch_actor_details_internal.js","sourceRoot":"","sources":["../../../src/tools/openai/fetch_actor_details_internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EACH,+BAA+B,EAC/B,6BAA6B,EAC7B,0BAA0B,EAC1B,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,GACvB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAE3E,MAAM,mCAAmC,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;SACZ,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,qFAAqF,CAAC;IACpG,MAAM,EAAE,+BAA+B,CAAC,QAAQ,EAAE;SAC7C,QAAQ,CAAC,sEAAsE,CAAC;CACxF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,6BAA6B,GAAc,MAAM,CAAC,MAAM,CAAC;IAClE,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,WAAW,CAAC,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EAAE,CAAC,IAAI,CAAC,CAAA;YAChG,CAAC,CAAC,SAAS,CAAC;QAEhB,MAAM,EAAE,KAAK,EAAE,iBAAiB,EAAE,GAAG,MAAM,6BAA6B,CAAC;YACrE,SAAS;YACT,OAAO;YACP,MAAM,EAAE,cAAc;YACtB,WAAW;YACX,WAAW;YACX,UAAU;YACV,iBAAiB;YACjB,eAAe,EAAE,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,OAAO,CAAC,eAAe;YACxD,YAAY;SACf,CAAC,CAAC;QAEH,OAAO,gBAAgB,CAAC,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC,CAAC;IAC1D,CAAC;CACK,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search_actors.d.ts","sourceRoot":"","sources":["../../../src/tools/openai/search_actors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"search_actors.d.ts","sourceRoot":"","sources":["../../../src/tools/openai/search_actors.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAoB,SAAS,EAAE,MAAM,gBAAgB,CAAC;AASlE;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,SA8FtB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import dedent from 'dedent';
|
|
1
2
|
import { HelperTools } from '../../const.js';
|
|
2
3
|
import { getWidgetConfig, WIDGET_URIS } from '../../resources/widgets.js';
|
|
3
4
|
import { formatActorForWidget, formatActorToActorCard, formatActorToStructuredCard } from '../../utils/actor_card.js';
|
|
@@ -22,8 +23,11 @@ export const openaiSearchActors = Object.freeze({
|
|
|
22
23
|
userRentedActorIds,
|
|
23
24
|
});
|
|
24
25
|
if (actors.length === 0) {
|
|
25
|
-
const instructions = `
|
|
26
|
-
|
|
26
|
+
const instructions = dedent `
|
|
27
|
+
No Actors were found for the search query "${parsed.keywords}".
|
|
28
|
+
You MUST retry with broader, more generic keywords - use just the platform name
|
|
29
|
+
(e.g., "TikTok" instead of "TikTok posts") before concluding no Actor exists.
|
|
30
|
+
`;
|
|
27
31
|
const structuredContent = {
|
|
28
32
|
actors: [],
|
|
29
33
|
query: parsed.keywords,
|
|
@@ -37,35 +41,51 @@ You MUST retry with broader, more generic keywords - use just the platform name
|
|
|
37
41
|
actors: structuredActorCards,
|
|
38
42
|
query: parsed.keywords,
|
|
39
43
|
count: actors.length,
|
|
40
|
-
instructions: `
|
|
41
|
-
|
|
44
|
+
instructions: dedent `
|
|
45
|
+
Choosing the right details tool: Use ${HelperTools.ACTOR_GET_DETAILS} when the user
|
|
46
|
+
wants to browse or explore Actors (e.g., "show me", "find me").
|
|
47
|
+
Use ${HelperTools.ACTOR_GET_DETAILS_INTERNAL} when the user wants to execute a task and
|
|
48
|
+
you need the input schema (e.g., "scrape", "extract").
|
|
49
|
+
IMPORTANT: You MUST always do a second search with broader, more generic keywords
|
|
50
|
+
(e.g., just the platform name like "TikTok" instead of "TikTok posts") to make sure
|
|
51
|
+
you haven't missed a better Actor.
|
|
52
|
+
`,
|
|
42
53
|
};
|
|
43
54
|
// Add widget-formatted actors for the interactive UI
|
|
44
55
|
structuredContent.widgetActors = actors.map(formatActorForWidget);
|
|
45
56
|
const actorCards = actors.map((actor) => formatActorToActorCard(actor));
|
|
46
57
|
const actorsText = actorCards.join('\n\n');
|
|
47
|
-
const texts = [`
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
58
|
+
const texts = [dedent `
|
|
59
|
+
# Search results:
|
|
60
|
+
- **Search query:** ${parsed.keywords}
|
|
61
|
+
- **Number of Actors found:** ${actors.length}
|
|
51
62
|
|
|
52
|
-
An interactive widget has been rendered with the search results. The user can already see
|
|
63
|
+
An interactive widget has been rendered with the search results. The user can already see
|
|
64
|
+
the list of Actors visually in the widget, so do NOT print or summarize the Actor list
|
|
65
|
+
in your response.
|
|
53
66
|
|
|
54
|
-
|
|
67
|
+
# Actors:
|
|
55
68
|
|
|
56
|
-
|
|
69
|
+
${actorsText}
|
|
57
70
|
|
|
58
|
-
## Choosing the right details tool:
|
|
59
|
-
- Use ${HelperTools.ACTOR_GET_DETAILS} when the user wants to **browse or explore**
|
|
60
|
-
|
|
71
|
+
## Choosing the right details tool:
|
|
72
|
+
- Use ${HelperTools.ACTOR_GET_DETAILS} when the user wants to **browse or explore**
|
|
73
|
+
Actors (e.g., "show me Google Maps scrapers", "find me a TikTok scraper", "what Actors
|
|
74
|
+
exist for LinkedIn"). This renders an interactive widget for the user.
|
|
75
|
+
- Use ${HelperTools.ACTOR_GET_DETAILS_INTERNAL} when the user wants to **execute a task**
|
|
76
|
+
and you need the Actor's input schema to prepare the run (e.g., "scrape Google Maps for
|
|
77
|
+
restaurants", "extract emails from this website"). This is a silent lookup — no widget
|
|
78
|
+
is rendered.
|
|
61
79
|
|
|
62
|
-
IMPORTANT: You MUST always do a second search with broader, more generic keywords
|
|
63
|
-
|
|
80
|
+
IMPORTANT: You MUST always do a second search with broader, more generic keywords
|
|
81
|
+
(e.g., just the platform name like "TikTok" instead of "TikTok posts") to make sure
|
|
82
|
+
you haven't missed a better Actor.
|
|
83
|
+
`];
|
|
64
84
|
const widgetConfig = getWidgetConfig(WIDGET_URIS.SEARCH_ACTORS);
|
|
65
85
|
return buildMCPResponse({
|
|
66
86
|
texts,
|
|
67
87
|
structuredContent,
|
|
68
|
-
// Response-level meta; only returned in
|
|
88
|
+
// Response-level meta; only returned in OpenAI mode (this handler is openai-only)
|
|
69
89
|
_meta: {
|
|
70
90
|
...widgetConfig === null || widgetConfig === void 0 ? void 0 : widgetConfig.meta,
|
|
71
91
|
'openai/widgetDescription': `Interactive actor search results showing ${actors.length} actors from Apify Store`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search_actors.js","sourceRoot":"","sources":["../../../src/tools/openai/search_actors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM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MnB;YACA,MAAM,EAAE,oBAAoB;YAC5B,KAAK,EAAE,MAAM,CAAC,QAAQ;YACtB,KAAK,EAAE,MAAM,CAAC,MAAM;YACpB,YAAY,EAAE,MAAM,CAAA;uDACuB,WAAW,CAAC,iBAAiB;;sBAE9D,WAAW,CAAC,0BAA0B;;;;;aAK/C;SACJ,CAAC;QAEF,qDAAqD;QACrD,iBAAiB,CAAC,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QAElE,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAC;QACxE,MAAM,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC3C,MAAM,KAAK,GAAG,CAAC,MAAM,CAAA;;kCAEK,MAAM,CAAC,QAAQ;4CACL,MAAM,CAAC,MAAM;;;;;;;;cAQ3C,UAAU;;;oBAGJ,WAAW,CAAC,iBAAiB;;;oBAG7B,WAAW,CAAC,0BAA0B;;;;;;;;SAQjD,CAAC,CAAC;QAEH,MAAM,YAAY,GAAG,eAAe,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;QAChE,OAAO,gBAAgB,CAAC;YACpB,KAAK;YACL,iBAAiB;YACjB,kFAAkF;YAClF,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search_actors_internal.d.ts","sourceRoot":"","sources":["../../../src/tools/openai/search_actors_internal.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"search_actors_internal.d.ts","sourceRoot":"","sources":["../../../src/tools/openai/search_actors_internal.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAoB,SAAS,EAAmB,MAAM,gBAAgB,CAAC;AAuBnF,eAAO,MAAM,wBAAwB,EAAE,SAwDrC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import dedent from 'dedent';
|
|
1
2
|
import { z } from 'zod';
|
|
2
3
|
import { HelperTools } from '../../const.js';
|
|
3
4
|
import { searchAndFilterActors } from '../../utils/actor_search.js';
|
|
@@ -23,16 +24,18 @@ const searchActorsInternalArgsSchema = z.object({
|
|
|
23
24
|
export const searchActorsInternalTool = Object.freeze({
|
|
24
25
|
type: 'internal',
|
|
25
26
|
name: HelperTools.STORE_SEARCH_INTERNAL,
|
|
26
|
-
description: `
|
|
27
|
+
description: dedent `
|
|
28
|
+
Search Actors internally (UI mode internal tool).
|
|
27
29
|
|
|
28
|
-
This tool is available because the LLM is operating in UI mode. Use it for internal lookups
|
|
29
|
-
where data presentation to the user is NOT needed - this tool does NOT render a widget.
|
|
30
|
+
This tool is available because the LLM is operating in UI mode. Use it for internal lookups
|
|
31
|
+
where data presentation to the user is NOT needed - this tool does NOT render a widget.
|
|
30
32
|
|
|
31
|
-
Use this instead of ${HelperTools.STORE_SEARCH} when you need to find an Actor but the user
|
|
32
|
-
did NOT explicitly ask to search Actors. For example, when user says "scrape me google maps"
|
|
33
|
-
and you need to find the right Actor for the task, then fetch its schema and call it.
|
|
33
|
+
Use this instead of ${HelperTools.STORE_SEARCH} when you need to find an Actor but the user
|
|
34
|
+
did NOT explicitly ask to search Actors. For example, when user says "scrape me google maps"
|
|
35
|
+
and you need to find the right Actor for the task, then fetch its schema and call it.
|
|
34
36
|
|
|
35
|
-
Returns only minimal fields (fullName, title, description) needed for subsequent calls
|
|
37
|
+
Returns only minimal fields (fullName, title, description) needed for subsequent calls.
|
|
38
|
+
`,
|
|
36
39
|
inputSchema: z.toJSONSchema(searchActorsInternalArgsSchema),
|
|
37
40
|
outputSchema: actorSearchInternalOutputSchema,
|
|
38
41
|
ajvValidate: compileSchema(z.toJSONSchema(searchActorsInternalArgsSchema)),
|
|
@@ -62,10 +65,8 @@ Returns only minimal fields (fullName, title, description) needed for subsequent
|
|
|
62
65
|
return buildMCPResponse({
|
|
63
66
|
texts: [
|
|
64
67
|
`Found ${minimalActors.length} Actors for "${parsed.keywords}".`,
|
|
65
|
-
'',
|
|
66
68
|
`Query: ${parsed.keywords}`,
|
|
67
|
-
|
|
68
|
-
`Actors:\n\`\`\`json\n${JSON.stringify(minimalActors, null, 2)}\n\`\`\``,
|
|
69
|
+
`Actors:\n\`\`\`json\n${JSON.stringify(minimalActors)}\n\`\`\``,
|
|
69
70
|
],
|
|
70
71
|
structuredContent: {
|
|
71
72
|
actors: minimalActors,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search_actors_internal.js","sourceRoot":"","sources":["../../../src/tools/openai/search_actors_internal.ts"],"names":[],"mappings":"AAAA,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,+BAA+B,EAAE,MAAM,iCAAiC,CAAC;AAElF,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;SACZ,GAAG,EAAE;SACL,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,GAAG,CAAC;SACR,OAAO,CAAC,CAAC,CAAC;SACV,QAAQ,CAAC,sDAAsD,CAAC;IACrE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;SACb,GAAG,EAAE;SACL,GAAG,CAAC,CAAC,CAAC;SACN,OAAO,CAAC,CAAC,CAAC;SACV,QAAQ,CAAC,6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