@apify/actors-mcp-server 0.11.5-beta.9 → 0.11.6-beta.0
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 +40 -25
- package/dist/const.d.ts.map +1 -1
- package/dist/const.js +39 -26
- package/dist/const.js.map +1 -1
- package/dist/index_internals.d.ts +30 -3
- package/dist/index_internals.d.ts.map +1 -1
- package/dist/index_internals.js +5 -3
- package/dist/index_internals.js.map +1 -1
- package/dist/mcp/proxy.js +1 -1
- package/dist/mcp/proxy.js.map +1 -1
- package/dist/mcp/server.d.ts +2 -2
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +26 -22
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/utils.d.ts +2 -2
- package/dist/mcp/utils.d.ts.map +1 -1
- package/dist/mcp/utils.js +2 -2
- package/dist/mcp/utils.js.map +1 -1
- package/dist/payments/const.d.ts +2 -2
- package/dist/payments/const.d.ts.map +1 -1
- package/dist/payments/const.js +11 -11
- package/dist/payments/const.js.map +1 -1
- package/dist/resources/resource_service.d.ts +2 -2
- package/dist/resources/resource_service.d.ts.map +1 -1
- package/dist/resources/resource_service.js +3 -3
- package/dist/resources/resource_service.js.map +1 -1
- package/dist/tools/{utils.d.ts → actor_input_schema.d.ts} +2 -17
- package/dist/tools/actor_input_schema.d.ts.map +1 -0
- package/dist/tools/{utils.js → actor_input_schema.js} +2 -49
- package/dist/tools/actor_input_schema.js.map +1 -0
- package/dist/tools/actor_tool_naming.d.ts +17 -0
- package/dist/tools/actor_tool_naming.d.ts.map +1 -0
- package/dist/tools/actor_tool_naming.js +49 -0
- package/dist/tools/actor_tool_naming.js.map +1 -0
- package/dist/tools/actors/actor_executor.js +1 -1
- package/dist/tools/actors/actor_executor.js.map +1 -1
- package/dist/tools/actors/actor_run_response.d.ts +2 -2
- package/dist/tools/actors/actor_run_response.d.ts.map +1 -1
- package/dist/tools/actors/actor_run_response.js +10 -15
- package/dist/tools/actors/actor_run_response.js.map +1 -1
- package/dist/tools/actors/actor_tools_factory.d.ts +1 -1
- package/dist/tools/actors/actor_tools_factory.d.ts.map +1 -1
- package/dist/tools/actors/actor_tools_factory.js +6 -5
- package/dist/tools/actors/actor_tools_factory.js.map +1 -1
- package/dist/tools/actors/add_actor.d.ts.map +1 -1
- package/dist/tools/actors/add_actor.js +8 -17
- package/dist/tools/actors/add_actor.js.map +1 -1
- package/dist/tools/actors/call_actor.d.ts +131 -1
- package/dist/tools/actors/call_actor.d.ts.map +1 -1
- package/dist/tools/actors/call_actor.js +484 -3
- package/dist/tools/actors/call_actor.js.map +1 -1
- package/dist/tools/actors/fetch_actor_details.d.ts +88 -1
- package/dist/tools/actors/fetch_actor_details.d.ts.map +1 -1
- package/dist/tools/actors/fetch_actor_details.js +229 -1
- package/dist/tools/actors/fetch_actor_details.js.map +1 -1
- package/dist/tools/actors/search_actors.d.ts +22 -1
- package/dist/tools/actors/search_actors.d.ts.map +1 -1
- package/dist/tools/actors/search_actors.js +123 -8
- package/dist/tools/actors/search_actors.js.map +1 -1
- package/dist/tools/docs/fetch_apify_docs.d.ts.map +1 -1
- package/dist/tools/docs/fetch_apify_docs.js +11 -33
- package/dist/tools/docs/fetch_apify_docs.js.map +1 -1
- package/dist/tools/docs/search_apify_docs.js +6 -6
- package/dist/tools/docs/search_apify_docs.js.map +1 -1
- package/dist/tools/index.d.ts +2 -2
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +8 -8
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/registry.d.ts +6 -6
- package/dist/tools/registry.d.ts.map +1 -1
- package/dist/tools/registry.js +9 -9
- package/dist/tools/registry.js.map +1 -1
- package/dist/tools/runs/abort_actor_run.d.ts.map +1 -1
- package/dist/tools/runs/abort_actor_run.js +4 -7
- package/dist/tools/runs/abort_actor_run.js.map +1 -1
- package/dist/tools/runs/get_actor_run.d.ts +28 -1
- package/dist/tools/runs/get_actor_run.d.ts.map +1 -1
- package/dist/tools/runs/get_actor_run.js +99 -2
- package/dist/tools/runs/get_actor_run.js.map +1 -1
- package/dist/tools/runs/get_actor_run_list.js +2 -2
- package/dist/tools/runs/get_actor_run_list.js.map +1 -1
- package/dist/tools/runs/get_actor_run_log.js +2 -2
- package/dist/tools/runs/get_actor_run_log.js.map +1 -1
- package/dist/tools/storage/get_dataset.d.ts.map +1 -1
- package/dist/tools/storage/get_dataset.js +7 -6
- package/dist/tools/storage/get_dataset.js.map +1 -1
- package/dist/tools/storage/get_dataset_items.d.ts.map +1 -1
- package/dist/tools/storage/get_dataset_items.js +6 -5
- package/dist/tools/storage/get_dataset_items.js.map +1 -1
- package/dist/tools/storage/get_dataset_list.js +4 -4
- package/dist/tools/storage/get_dataset_list.js.map +1 -1
- package/dist/tools/storage/get_dataset_schema.d.ts.map +1 -1
- package/dist/tools/storage/get_dataset_schema.js +9 -13
- package/dist/tools/storage/get_dataset_schema.js.map +1 -1
- package/dist/tools/storage/get_key_value_store.d.ts.map +1 -1
- package/dist/tools/storage/get_key_value_store.js +6 -5
- package/dist/tools/storage/get_key_value_store.js.map +1 -1
- package/dist/tools/storage/get_key_value_store_keys.d.ts.map +1 -1
- package/dist/tools/storage/get_key_value_store_keys.js +5 -4
- package/dist/tools/storage/get_key_value_store_keys.js.map +1 -1
- package/dist/tools/storage/get_key_value_store_list.js +4 -4
- package/dist/tools/storage/get_key_value_store_list.js.map +1 -1
- package/dist/tools/storage/get_key_value_store_record.d.ts.map +1 -1
- package/dist/tools/storage/get_key_value_store_record.js +5 -4
- package/dist/tools/storage/get_key_value_store_record.js.map +1 -1
- package/dist/tools/storage/storage_helpers.d.ts +0 -15
- package/dist/tools/storage/storage_helpers.d.ts.map +1 -1
- package/dist/tools/storage/storage_helpers.js +9 -22
- package/dist/tools/storage/storage_helpers.js.map +1 -1
- package/dist/tools/widgets/call_actor_widget.d.ts.map +1 -1
- package/dist/tools/widgets/call_actor_widget.js +14 -17
- package/dist/tools/widgets/call_actor_widget.js.map +1 -1
- package/dist/tools/widgets/fetch_actor_details_widget.d.ts.map +1 -1
- package/dist/tools/widgets/fetch_actor_details_widget.js +8 -9
- package/dist/tools/widgets/fetch_actor_details_widget.js.map +1 -1
- package/dist/tools/widgets/get_actor_run_widget.js +4 -4
- package/dist/tools/widgets/get_actor_run_widget.js.map +1 -1
- package/dist/tools/widgets/search_actors_widget.d.ts.map +1 -1
- package/dist/tools/widgets/search_actors_widget.js +8 -10
- package/dist/tools/widgets/search_actors_widget.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +6 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -2
- package/dist/types.js.map +1 -1
- package/dist/utils/actor_details.js +1 -1
- package/dist/utils/actor_details.js.map +1 -1
- package/dist/utils/apify_docs.d.ts.map +1 -1
- package/dist/utils/apify_docs.js +16 -3
- package/dist/utils/apify_docs.js.map +1 -1
- package/dist/utils/mcp.d.ts +56 -9
- package/dist/utils/mcp.d.ts.map +1 -1
- package/dist/utils/mcp.js +80 -16
- package/dist/utils/mcp.js.map +1 -1
- package/dist/utils/payment_errors.js +2 -2
- package/dist/utils/payment_errors.js.map +1 -1
- package/dist/utils/server-instructions/index.d.ts +2 -2
- package/dist/utils/server-instructions/index.d.ts.map +1 -1
- package/dist/utils/server-instructions/index.js +19 -19
- package/dist/utils/server-instructions/index.js.map +1 -1
- package/dist/utils/server_mode.d.ts +5 -5
- package/dist/utils/server_mode.d.ts.map +1 -1
- package/dist/utils/server_mode.js +10 -10
- package/dist/utils/server_mode.js.map +1 -1
- package/dist/utils/tool_categories_helpers.d.ts +2 -2
- package/dist/utils/tool_categories_helpers.d.ts.map +1 -1
- package/dist/utils/tool_categories_helpers.js.map +1 -1
- package/dist/utils/tools.d.ts +2 -2
- package/dist/utils/tools.d.ts.map +1 -1
- package/dist/utils/tools.js +2 -2
- package/dist/utils/tools.js.map +1 -1
- package/dist/utils/tools_loader.d.ts +3 -3
- package/dist/utils/tools_loader.d.ts.map +1 -1
- package/dist/utils/tools_loader.js +12 -12
- package/dist/utils/tools_loader.js.map +1 -1
- package/manifest.json +1 -1
- package/package.json +1 -1
- package/server.json +1 -1
- package/dist/tools/actors/call_actor_common.d.ts +0 -132
- package/dist/tools/actors/call_actor_common.d.ts.map +0 -1
- package/dist/tools/actors/call_actor_common.js +0 -554
- package/dist/tools/actors/call_actor_common.js.map +0 -1
- package/dist/tools/actors/fetch_actor_details_common.d.ts +0 -89
- package/dist/tools/actors/fetch_actor_details_common.d.ts.map +0 -1
- package/dist/tools/actors/fetch_actor_details_common.js +0 -235
- package/dist/tools/actors/fetch_actor_details_common.js.map +0 -1
- package/dist/tools/actors/search_actors_common.d.ts +0 -25
- package/dist/tools/actors/search_actors_common.d.ts.map +0 -1
- package/dist/tools/actors/search_actors_common.js +0 -125
- package/dist/tools/actors/search_actors_common.js.map +0 -1
- package/dist/tools/runs/get_actor_run_common.d.ts +0 -29
- package/dist/tools/runs/get_actor_run_common.d.ts.map +0 -1
- package/dist/tools/runs/get_actor_run_common.js +0 -111
- package/dist/tools/runs/get_actor_run_common.js.map +0 -1
- package/dist/tools/utils.d.ts.map +0 -1
- package/dist/tools/utils.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HELPER_TOOLS } from '../../const.js';
|
|
2
2
|
import { VERBATIM_LINKS_NUDGE } from '../../utils/console_link.js';
|
|
3
3
|
import { encodeToon } from '../../utils/encode_text.js';
|
|
4
4
|
import { QUOTE_WRAPPER_CHARS } from '../../utils/generic.js';
|
|
5
|
-
import {
|
|
5
|
+
import { respondOk } from '../../utils/mcp.js';
|
|
6
6
|
function suggestTool(toolName, loadedToolNames) {
|
|
7
7
|
return loadedToolNames.includes(toolName) ? toolName : undefined;
|
|
8
8
|
}
|
|
@@ -23,18 +23,6 @@ export function buildConsoleLinkContent(apifyConsoleUrl) {
|
|
|
23
23
|
const text = apifyConsoleLinkText(apifyConsoleUrl);
|
|
24
24
|
return text ? [{ type: 'text', text }] : [];
|
|
25
25
|
}
|
|
26
|
-
/**
|
|
27
|
-
* Soft-fail not-found response for storage tools. Centralizes
|
|
28
|
-
* `isError: true` + SOFT_FAIL/INVALID_INPUT telemetry so call sites
|
|
29
|
-
* only supply the message.
|
|
30
|
-
*/
|
|
31
|
-
export function buildStorageNotFound(text) {
|
|
32
|
-
return buildMCPResponse({
|
|
33
|
-
texts: [text],
|
|
34
|
-
isError: true,
|
|
35
|
-
telemetry: { toolStatus: TOOL_STATUS.SOFT_FAIL, failureCategory: FAILURE_CATEGORY.INVALID_INPUT },
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
26
|
/**
|
|
39
27
|
* Build a storage tool response, mirroring `actor_run_response.ts`:
|
|
40
28
|
* `structuredContent` carries the data plus `summary` (and `nextStep` unless terminal).
|
|
@@ -53,8 +41,7 @@ export function buildStorageResponse(params) {
|
|
|
53
41
|
const summaryText = nextStep !== undefined ? `${summary}\n${nextStep}` : summary;
|
|
54
42
|
const dataText = toon ? encodeToon(structuredContent) : JSON.stringify(structuredContent);
|
|
55
43
|
const consoleLinkText = apifyConsoleLinkText(apifyConsoleUrl);
|
|
56
|
-
return
|
|
57
|
-
texts: [dataText, summaryText, ...(consoleLinkText ? [consoleLinkText] : [])],
|
|
44
|
+
return respondOk([dataText, summaryText, ...(consoleLinkText ? [consoleLinkText] : [])], {
|
|
58
45
|
structuredContent: full,
|
|
59
46
|
});
|
|
60
47
|
}
|
|
@@ -80,7 +67,7 @@ export function buildDatasetItemsSummaryNextStep(params) {
|
|
|
80
67
|
if (offset + itemCount < totalItemCount) {
|
|
81
68
|
return {
|
|
82
69
|
summary: `Fetched ${itemCount} of ${totalItemCount} items (offset=${offset}).`,
|
|
83
|
-
nextStep: `Call ${
|
|
70
|
+
nextStep: `Call ${HELPER_TOOLS.DATASET_GET_ITEMS} again with offset=${offset + itemCount} to fetch the next page.`,
|
|
84
71
|
};
|
|
85
72
|
}
|
|
86
73
|
const summary = offset === 0 && itemCount === totalItemCount
|
|
@@ -88,8 +75,8 @@ export function buildDatasetItemsSummaryNextStep(params) {
|
|
|
88
75
|
: `Fetched ${itemCount} of ${totalItemCount} items (offset=${offset}); no more pages.`;
|
|
89
76
|
return {
|
|
90
77
|
summary,
|
|
91
|
-
nextStep: suggestTool(
|
|
92
|
-
? `Use ${
|
|
78
|
+
nextStep: suggestTool(HELPER_TOOLS.DATASET_GET, loadedToolNames)
|
|
79
|
+
? `Use ${HELPER_TOOLS.DATASET_GET} with datasetId=${datasetId} to see the field list if you need the data structure.`
|
|
93
80
|
: `No more pages. Inspect the returned items directly.`,
|
|
94
81
|
};
|
|
95
82
|
}
|
|
@@ -104,14 +91,14 @@ export function buildKvsKeysSummaryNextStep(params) {
|
|
|
104
91
|
if (isTruncated && nextExclusiveStartKey) {
|
|
105
92
|
return {
|
|
106
93
|
summary,
|
|
107
|
-
nextStep: `Call ${
|
|
94
|
+
nextStep: `Call ${HELPER_TOOLS.KEY_VALUE_STORE_KEYS_GET} again with exclusiveStartKey=${nextExclusiveStartKey} to fetch the next page.`,
|
|
108
95
|
};
|
|
109
96
|
}
|
|
110
97
|
return {
|
|
111
98
|
summary,
|
|
112
99
|
nextStep: firstKey
|
|
113
|
-
? `Use ${
|
|
114
|
-
: `Use ${
|
|
100
|
+
? `Use ${HELPER_TOOLS.KEY_VALUE_STORE_RECORD_GET} with keyValueStoreId=${keyValueStoreId} and recordKey=${firstKey} to read a value.`
|
|
101
|
+
: `Use ${HELPER_TOOLS.KEY_VALUE_STORE_GET} with keyValueStoreId=${keyValueStoreId} to inspect the store.`,
|
|
115
102
|
};
|
|
116
103
|
}
|
|
117
104
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage_helpers.js","sourceRoot":"","sources":["../../../src/tools/storage/storage_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"storage_helpers.js","sourceRoot":"","sources":["../../../src/t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E,GAAG,CAAC,CAAC;AAC5G,MAAM,UAAU,kBAAkB,CAAC,GAAW;IAC1C,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,0BAA0B,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;AACrE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"call_actor_widget.d.ts","sourceRoot":"","sources":["../../../src/tools/widgets/call_actor_widget.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAoB,SAAS,EAAmB,MAAM,gBAAgB,CAAC;AA2DnF,eAAO,MAAM,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"call_actor_widget.d.ts","sourceRoot":"","sources":["../../../src/tools/widgets/call_actor_widget.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAoB,SAAS,EAAmB,MAAM,gBAAgB,CAAC;AA2DnF,eAAO,MAAM,eAAe,EAAE,SAuEnB,CAAC"}
|
|
@@ -2,14 +2,14 @@ var _a;
|
|
|
2
2
|
import dedent from 'dedent';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import log from '@apify/log';
|
|
5
|
-
import {
|
|
5
|
+
import { HELPER_TOOLS } from '../../const.js';
|
|
6
6
|
import { getWidgetConfig, WIDGET_URIS } from '../../resources/widgets.js';
|
|
7
7
|
import { TOOL_TYPE } from '../../types.js';
|
|
8
8
|
import { compileSchema } from '../../utils/ajv.js';
|
|
9
|
-
import {
|
|
9
|
+
import { respondServerError } from '../../utils/mcp.js';
|
|
10
10
|
import { extractActorId } from '../../utils/tools.js';
|
|
11
11
|
import { buildStartRunResponse } from '../actors/actor_run_response.js';
|
|
12
|
-
import { buildCallActorErrorResponse, callActorPreExecute, callOptionsSchema, resolveAndValidateActor, } from '../actors/
|
|
12
|
+
import { buildCallActorErrorResponse, callActorPreExecute, callOptionsSchema, resolveAndValidateActor, } from '../actors/call_actor.js';
|
|
13
13
|
import { actorRunOutputSchema } from '../structured_output_schemas.js';
|
|
14
14
|
/**
|
|
15
15
|
* Widget-only input: `actor` + `input` + optional `callOptions`.
|
|
@@ -41,20 +41,20 @@ const CALL_ACTOR_WIDGET_DESCRIPTION = dedent `
|
|
|
41
41
|
completion — do NOT poll or call any other tool after this.
|
|
42
42
|
|
|
43
43
|
For silent async starts where no UI is needed (e.g., "start this in the background",
|
|
44
|
-
or when your next step is to fetch results via ${
|
|
45
|
-
${
|
|
44
|
+
or when your next step is to fetch results via ${HELPER_TOOLS.DATASET_GET_ITEMS}), use
|
|
45
|
+
${HELPER_TOOLS.ACTOR_CALL} instead — it returns the same runId without rendering a widget.
|
|
46
46
|
|
|
47
47
|
WORKFLOW:
|
|
48
|
-
1. Use ${
|
|
48
|
+
1. Use ${HELPER_TOOLS.ACTOR_GET_DETAILS} to get the Actor's input schema
|
|
49
49
|
2. Call this tool with the actor name and proper input based on the schema
|
|
50
50
|
|
|
51
|
-
If the actor name is not in "username/name" format, use ${
|
|
51
|
+
If the actor name is not in "username/name" format, use ${HELPER_TOOLS.STORE_SEARCH} to resolve the correct Actor first.
|
|
52
52
|
|
|
53
53
|
Input: actor name and input JSON; callOptions (memory, timeout) are optional.
|
|
54
54
|
`;
|
|
55
55
|
export const callActorWidget = Object.freeze({
|
|
56
56
|
type: TOOL_TYPE.INTERNAL,
|
|
57
|
-
name:
|
|
57
|
+
name: HELPER_TOOLS.ACTOR_CALL_WIDGET,
|
|
58
58
|
title: 'Call Actor (widget)',
|
|
59
59
|
description: CALL_ACTOR_WIDGET_DESCRIPTION,
|
|
60
60
|
inputSchema: z.toJSONSchema(callActorWidgetArgsSchema),
|
|
@@ -74,15 +74,12 @@ export const callActorWidget = Object.freeze({
|
|
|
74
74
|
var _a;
|
|
75
75
|
const rawActor = (_a = toolArgs.args) === null || _a === void 0 ? void 0 : _a.actor;
|
|
76
76
|
if (typeof rawActor === 'string' && rawActor.includes(':')) {
|
|
77
|
-
return
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
],
|
|
82
|
-
isError: true,
|
|
83
|
-
});
|
|
77
|
+
return respondServerError([
|
|
78
|
+
`${HELPER_TOOLS.ACTOR_CALL_WIDGET} does not render widgets for MCP tool calls.`,
|
|
79
|
+
`Use ${HELPER_TOOLS.ACTOR_CALL} for the "actorName:toolName" syntax.`,
|
|
80
|
+
]);
|
|
84
81
|
}
|
|
85
|
-
const preResult = await callActorPreExecute(toolArgs, { route:
|
|
82
|
+
const preResult = await callActorPreExecute(toolArgs, { route: HELPER_TOOLS.ACTOR_CALL_WIDGET });
|
|
86
83
|
if ('earlyResponse' in preResult) {
|
|
87
84
|
return preResult.earlyResponse;
|
|
88
85
|
}
|
|
@@ -119,7 +116,7 @@ export const callActorWidget = Object.freeze({
|
|
|
119
116
|
error,
|
|
120
117
|
actorId: resolvedActorId,
|
|
121
118
|
mcpSessionId: toolArgs.mcpSessionId,
|
|
122
|
-
actorGetDetailsTool:
|
|
119
|
+
actorGetDetailsTool: HELPER_TOOLS.ACTOR_GET_DETAILS,
|
|
123
120
|
});
|
|
124
121
|
}
|
|
125
122
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"call_actor_widget.js","sourceRoot":"","sources":["../../../src/tools/widgets/call_actor_widget.ts"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,GAAG,MAAM,YAAY,CAAC;AAE7B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"call_actor_widget.js","sourceRoot":"","sources":["../../../src/tools/widgets/call_actor_widget.ts"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,GAAG,MAAM,YAAY,CAAC;AAE7B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,WAAW,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AE,CAAC;gBACxB,OAAO,UAAU,CAAC,KAAK,CAAC;YAC5B,CAAC;YAED,eAAe,GAAG,cAAc,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YACnD,MAAM,EAAE,WAAW,EAAE,GAAG,QAAQ,CAAC;YAEjC,MAAM,WAAW,GAAG,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;YACrD,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;YAC7D,GAAG,CAAC,KAAK,CAAC,4BAA4B,EAAE;gBACpC,SAAS,EAAE,aAAa;gBACxB,KAAK,EAAE,QAAQ,CAAC,EAAE;gBAClB,YAAY,EAAE,QAAQ,CAAC,YAAY;aACtC,CAAC,CAAC;YACH,MAAM,QAAQ,GAAG,qBAAqB,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;YAC7F,OAAO;gBACH,GAAG,QAAQ;gBACX,aAAa,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE;aAC9C,CAAC;QACN,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,OAAO,2BAA2B,CAAC;gBAC/B,SAAS,EAAE,aAAa;gBACxB,KAAK;gBACL,OAAO,EAAE,eAAe;gBACxB,YAAY,EAAE,QAAQ,CAAC,YAAY;gBACnC,mBAAmB,EAAE,YAAY,CAAC,iBAAiB;aACtD,CAAC,CAAC;QACP,CAAC;IACL,CAAC;CACK,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch_actor_details_widget.d.ts","sourceRoot":"","sources":["../../../src/tools/widgets/fetch_actor_details_widget.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAoB,SAAS,EAAmB,MAAM,gBAAgB,CAAC;AAyCnF,eAAO,MAAM,uBAAuB,EAAE,
|
|
1
|
+
{"version":3,"file":"fetch_actor_details_widget.d.ts","sourceRoot":"","sources":["../../../src/tools/widgets/fetch_actor_details_widget.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAoB,SAAS,EAAmB,MAAM,gBAAgB,CAAC;AAyCnF,eAAO,MAAM,uBAAuB,EAAE,SA8D3B,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import dedent from 'dedent';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import {
|
|
3
|
+
import { HELPER_TOOLS } from '../../const.js';
|
|
4
4
|
import { getWidgetConfig, WIDGET_URIS } from '../../resources/widgets.js';
|
|
5
5
|
import { TOOL_TYPE } from '../../types.js';
|
|
6
6
|
import { buildActorDetailsForWidget, buildCardOptions, fetchActorDetails } from '../../utils/actor_details.js';
|
|
7
7
|
import { compileSchema } from '../../utils/ajv.js';
|
|
8
|
-
import {
|
|
8
|
+
import { respondOk } from '../../utils/mcp.js';
|
|
9
9
|
import { getUserInfoCached } from '../../utils/userid_cache.js';
|
|
10
10
|
import { fixActorNameInputAndLog } from '../actors/actor_tools_factory.js';
|
|
11
|
-
import { actorDetailsOutputDefaults, buildActorNotFoundResponse } from '../actors/
|
|
11
|
+
import { actorDetailsOutputDefaults, buildActorNotFoundResponse } from '../actors/fetch_actor_details.js';
|
|
12
12
|
import { actorDetailsWidgetOutputSchema } from '../structured_output_schemas.js';
|
|
13
13
|
const widgetConfig = getWidgetConfig(WIDGET_URIS.SEARCH_ACTORS);
|
|
14
14
|
/**
|
|
@@ -33,14 +33,14 @@ const FETCH_ACTOR_DETAILS_WIDGET_DESCRIPTION = dedent `
|
|
|
33
33
|
The response renders as an interactive widget the user can view directly.
|
|
34
34
|
|
|
35
35
|
For silent data lookups (e.g., fetching the input schema before calling an Actor, inspecting README
|
|
36
|
-
for decision making), use ${
|
|
36
|
+
for decision making), use ${HELPER_TOOLS.ACTOR_GET_DETAILS} instead — it returns the same data
|
|
37
37
|
without rendering a widget.
|
|
38
38
|
|
|
39
39
|
Input: the Actor ID or full name only. Output fields are fixed by the widget contract.
|
|
40
40
|
`;
|
|
41
41
|
export const fetchActorDetailsWidget = Object.freeze({
|
|
42
42
|
type: TOOL_TYPE.INTERNAL,
|
|
43
|
-
name:
|
|
43
|
+
name: HELPER_TOOLS.ACTOR_GET_DETAILS_WIDGET,
|
|
44
44
|
title: 'Fetch Actor details (widget)',
|
|
45
45
|
description: FETCH_ACTOR_DETAILS_WIDGET_DESCRIPTION,
|
|
46
46
|
inputSchema: z.toJSONSchema(fetchActorDetailsWidgetArgsSchema),
|
|
@@ -62,7 +62,7 @@ export const fetchActorDetailsWidget = Object.freeze({
|
|
|
62
62
|
const parsed = fetchActorDetailsWidgetArgsSchema.parse(toolArgs.args);
|
|
63
63
|
const actorName = fixActorNameInputAndLog(parsed.actor, {
|
|
64
64
|
mcpSessionId,
|
|
65
|
-
route:
|
|
65
|
+
route: HELPER_TOOLS.ACTOR_GET_DETAILS_WIDGET,
|
|
66
66
|
});
|
|
67
67
|
const { userPlanTier } = await getUserInfoCached(apifyToken, apifyClient);
|
|
68
68
|
const cardOptions = { ...buildCardOptions(actorDetailsOutputDefaults), userTier: userPlanTier };
|
|
@@ -87,11 +87,10 @@ export const fetchActorDetailsWidget = Object.freeze({
|
|
|
87
87
|
An interactive widget has been rendered with detailed Actor information.
|
|
88
88
|
`,
|
|
89
89
|
];
|
|
90
|
-
return
|
|
91
|
-
texts,
|
|
90
|
+
return respondOk(texts, {
|
|
92
91
|
structuredContent,
|
|
93
92
|
// Response-level meta; only returned in apps mode (this handler is apps-only).
|
|
94
|
-
|
|
93
|
+
meta: {
|
|
95
94
|
...widgetConfig === null || widgetConfig === void 0 ? void 0 : widgetConfig.meta,
|
|
96
95
|
'openai/widgetDescription': `Actor details for ${actorName} from Apify Store`,
|
|
97
96
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch_actor_details_widget.js","sourceRoot":"","sources":["../../../src/tools/widgets/fetch_actor_details_widget.ts"],"names":[],"mappings":"AAAA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,OAAO,EAAE,CAAC;YACX,OAAO,0BAA0B,CAAC,SAAS,CAAC,CAAC;QACjD,CAAC;QAED,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,0BAA0B,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QACrF,MAAM,iBAAiB,GAAG;YACtB,YAAY,EAAE;gBACV,SAAS,EAAE,YAAY,CAAC,SAAS;gBACjC,SAAS,EAAE,YAAY,CAAC,SAAS;gBACjC,MAAM,EAAE,YAAY,CAAC,MAAM;aAC9B;SACJ,CAAC;QAEF,MAAM,KAAK,GAAG;YACV,MAAM,CAAA;;2BAES,SAAS;yBACX,QAAQ;;;SAGxB;SACA,CAAC;QAEF,OAAO,SAAS,CAAC,KAAK,EAAE;YACpB,iBAAiB;YACjB,+EAA+E;YAC/E,IAAI,EAAE;gBACF,GAAG,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,IAAI;gBACrB,0BAA0B,EAAE,qBAAqB,SAAS,mBAAmB;aAChF;SACJ,CAAC,CAAC;IACP,CAAC;CACK,CAAC,CAAC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
var _a;
|
|
2
2
|
import dedent from 'dedent';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import {
|
|
4
|
+
import { HELPER_TOOLS } from '../../const.js';
|
|
5
5
|
import { getWidgetConfig, WIDGET_URIS } from '../../resources/widgets.js';
|
|
6
6
|
import { TOOL_TYPE } from '../../types.js';
|
|
7
7
|
import { compileSchema } from '../../utils/ajv.js';
|
|
8
8
|
import { logHttpError } from '../../utils/logging.js';
|
|
9
9
|
import { fetchActorRunData } from '../actors/actor_run_response.js';
|
|
10
|
-
import { buildGetActorRunError, buildGetActorRunSuccessResponse } from '../runs/
|
|
10
|
+
import { buildGetActorRunError, buildGetActorRunSuccessResponse } from '../runs/get_actor_run.js';
|
|
11
11
|
import { actorRunOutputSchema } from '../structured_output_schemas.js';
|
|
12
12
|
/**
|
|
13
13
|
* Widget input is `runId` only. The tool always returns immediately so the widget can render
|
|
@@ -29,11 +29,11 @@ const GET_ACTOR_RUN_WIDGET_DESCRIPTION = dedent `
|
|
|
29
29
|
(e.g., "show progress for run y2h7sK3Wc", "display the status of that run").
|
|
30
30
|
|
|
31
31
|
For silent data lookups (run status, dataset IDs, stats, resource IDs), use
|
|
32
|
-
${
|
|
32
|
+
${HELPER_TOOLS.ACTOR_RUNS_GET} instead — it returns the same data without rendering a widget.
|
|
33
33
|
`;
|
|
34
34
|
export const getActorRunWidget = Object.freeze({
|
|
35
35
|
type: TOOL_TYPE.INTERNAL,
|
|
36
|
-
name:
|
|
36
|
+
name: HELPER_TOOLS.ACTOR_RUNS_GET_WIDGET,
|
|
37
37
|
title: 'Get Actor run (widget)',
|
|
38
38
|
description: GET_ACTOR_RUN_WIDGET_DESCRIPTION,
|
|
39
39
|
inputSchema: z.toJSONSchema(getActorRunWidgetArgsSchema),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get_actor_run_widget.js","sourceRoot":"","sources":["../../../src/tools/widgets/get_actor_run_widget.ts"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"get_actor_run_widget.js","sourceRoot":"","sources":["../../../src/tools/widgets/get_actor_run_widget.ts"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE1E,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAA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AC7D,MAAM,MAAM,GAAG,2BAA2B,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAEvD,IAAI,CAAC;YACD,MAAM,WAAW,GAAG,MAAM,iBAAiB,CAAC;gBACxC,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,QAAQ,EAAE,CAAC;gBACX,MAAM;gBACN,YAAY;aACf,CAAC,CAAC;YAEH,oFAAoF;YACpF,8DAA8D;YAC9D,IAAI,SAAS,IAAI,WAAW;gBAAE,OAAO,EAAE,CAAC;YACxC,IAAI,OAAO,IAAI,WAAW;gBAAE,OAAO,WAAW,CAAC,KAAK,CAAC;YAErD,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,kCAAkC,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;YACjF,OAAO,qBAAqB,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACtD,CAAC;IACL,CAAC;CACK,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search_actors_widget.d.ts","sourceRoot":"","sources":["../../../src/tools/widgets/search_actors_widget.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAoB,SAAS,EAAmB,MAAM,gBAAgB,CAAC;AAgCnF,eAAO,MAAM,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"search_actors_widget.d.ts","sourceRoot":"","sources":["../../../src/tools/widgets/search_actors_widget.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAoB,SAAS,EAAmB,MAAM,gBAAgB,CAAC;AAgCnF,eAAO,MAAM,kBAAkB,EAAE,SAoFtB,CAAC"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
var _a;
|
|
2
2
|
import dedent from 'dedent';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import {
|
|
4
|
+
import { HELPER_TOOLS } from '../../const.js';
|
|
5
5
|
import { getWidgetConfig, WIDGET_URIS } from '../../resources/widgets.js';
|
|
6
6
|
import { TOOL_TYPE } from '../../types.js';
|
|
7
7
|
import { formatActorForWidget } from '../../utils/actor_card.js';
|
|
8
8
|
import { searchAgentSafeActors } from '../../utils/actor_search.js';
|
|
9
9
|
import { compileSchema } from '../../utils/ajv.js';
|
|
10
|
-
import {
|
|
10
|
+
import { respondOk } from '../../utils/mcp.js';
|
|
11
11
|
import { getUserInfoCached } from '../../utils/userid_cache.js';
|
|
12
|
-
import { buildSearchActorsResult, searchActorsBaseArgsSchema } from '../actors/
|
|
12
|
+
import { buildSearchActorsResult, searchActorsBaseArgsSchema } from '../actors/search_actors.js';
|
|
13
13
|
import { actorSearchWidgetOutputSchema } from '../structured_output_schemas.js';
|
|
14
14
|
/**
|
|
15
15
|
* Widget-only input: mirrors the base tool's keywords/limit/offset. `.strict()`
|
|
@@ -26,14 +26,14 @@ const SEARCH_ACTORS_WIDGET_DESCRIPTION = dedent `
|
|
|
26
26
|
The response renders as an interactive widget the user can view directly.
|
|
27
27
|
|
|
28
28
|
For silent name resolution before running an Actor (e.g., "scrape google maps" — you need to
|
|
29
|
-
find the right Actor first, then fetch its schema and call it), use ${
|
|
29
|
+
find the right Actor first, then fetch its schema and call it), use ${HELPER_TOOLS.STORE_SEARCH}
|
|
30
30
|
instead — it returns the same data without rendering a widget.
|
|
31
31
|
|
|
32
32
|
Input: keywords (plus optional limit/offset). Output fields are fixed by the widget contract.
|
|
33
33
|
`;
|
|
34
34
|
export const searchActorsWidget = Object.freeze({
|
|
35
35
|
type: TOOL_TYPE.INTERNAL,
|
|
36
|
-
name:
|
|
36
|
+
name: HELPER_TOOLS.STORE_SEARCH_WIDGET,
|
|
37
37
|
title: 'Search Actors (widget)',
|
|
38
38
|
description: SEARCH_ACTORS_WIDGET_DESCRIPTION,
|
|
39
39
|
inputSchema: z.toJSONSchema(searchActorsWidgetArgsSchema),
|
|
@@ -73,8 +73,7 @@ export const searchActorsWidget = Object.freeze({
|
|
|
73
73
|
You MUST retry with broader, more generic keywords - use just the platform name
|
|
74
74
|
(e.g., "TikTok" instead of "TikTok posts") before concluding no Actor exists.
|
|
75
75
|
`;
|
|
76
|
-
return
|
|
77
|
-
texts: [instructions],
|
|
76
|
+
return respondOk(instructions, {
|
|
78
77
|
structuredContent: {
|
|
79
78
|
actors: [],
|
|
80
79
|
query: parsed.keywords,
|
|
@@ -103,11 +102,10 @@ export const searchActorsWidget = Object.freeze({
|
|
|
103
102
|
`,
|
|
104
103
|
];
|
|
105
104
|
const widgetConfig = getWidgetConfig(WIDGET_URIS.SEARCH_ACTORS);
|
|
106
|
-
return
|
|
107
|
-
texts,
|
|
105
|
+
return respondOk(texts, {
|
|
108
106
|
structuredContent,
|
|
109
107
|
// Response-level meta; only returned in apps mode (this handler is apps-only).
|
|
110
|
-
|
|
108
|
+
meta: {
|
|
111
109
|
...widgetConfig === null || widgetConfig === void 0 ? void 0 : widgetConfig.meta,
|
|
112
110
|
'openai/widgetDescription': `Interactive actor search results showing ${actors.length} ${actors.length === 1 ? 'actor' : 'actors'} from Apify Store`,
|
|
113
111
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search_actors_widget.js","sourceRoot":"","sources":["../../../src/tools/widgets/search_actors_widget.ts"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"search_actors_widget.js","sourceRoot":"","sources":["../../../src/tools/widgets/search_actors_widget.ts"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,C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