@apify/actors-mcp-server 0.7.1 → 0.8.1
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 +12 -0
- package/dist/actor/server.d.ts.map +1 -1
- package/dist/actor/server.js +18 -10
- package/dist/actor/server.js.map +1 -1
- package/dist/apify-client.d.ts +12 -0
- package/dist/apify-client.d.ts.map +1 -1
- package/dist/apify-client.js +14 -0
- package/dist/apify-client.js.map +1 -1
- package/dist/const.d.ts +7 -1
- package/dist/const.d.ts.map +1 -1
- package/dist/const.js +19 -55
- package/dist/const.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +78 -143
- package/dist/mcp/server.js.map +1 -1
- package/dist/resources/resource_service.d.ts +23 -0
- package/dist/resources/resource_service.d.ts.map +1 -0
- package/dist/resources/resource_service.js +108 -0
- package/dist/resources/resource_service.js.map +1 -0
- package/dist/{utils → resources}/widgets.d.ts +19 -16
- package/dist/resources/widgets.d.ts.map +1 -0
- package/dist/resources/widgets.js.map +1 -0
- package/dist/tools/actor.d.ts +6 -2
- package/dist/tools/actor.d.ts.map +1 -1
- package/dist/tools/actor.js +47 -35
- package/dist/tools/actor.js.map +1 -1
- package/dist/tools/categories.d.ts +1 -0
- package/dist/tools/categories.d.ts.map +1 -1
- package/dist/tools/categories.js +8 -1
- package/dist/tools/categories.js.map +1 -1
- package/dist/tools/dataset.d.ts.map +1 -1
- package/dist/tools/dataset.js +34 -11
- package/dist/tools/dataset.js.map +1 -1
- package/dist/tools/fetch-actor-details-internal.d.ts +3 -0
- package/dist/tools/fetch-actor-details-internal.d.ts.map +1 -0
- package/dist/tools/fetch-actor-details-internal.js +63 -0
- package/dist/tools/fetch-actor-details-internal.js.map +1 -0
- package/dist/tools/fetch-actor-details.d.ts.map +1 -1
- package/dist/tools/fetch-actor-details.js +25 -108
- package/dist/tools/fetch-actor-details.js.map +1 -1
- package/dist/tools/get-actor-output.d.ts.map +1 -1
- package/dist/tools/get-actor-output.js +15 -22
- package/dist/tools/get-actor-output.js.map +1 -1
- package/dist/tools/key_value_store.d.ts.map +1 -1
- package/dist/tools/key_value_store.js +22 -10
- package/dist/tools/key_value_store.js.map +1 -1
- package/dist/tools/run.d.ts.map +1 -1
- package/dist/tools/run.js +39 -13
- package/dist/tools/run.js.map +1 -1
- package/dist/tools/search-actors-internal.d.ts +3 -0
- package/dist/tools/search-actors-internal.d.ts.map +1 -0
- package/dist/tools/search-actors-internal.js +81 -0
- package/dist/tools/search-actors-internal.js.map +1 -0
- package/dist/tools/store_collection.d.ts +13 -0
- package/dist/tools/store_collection.d.ts.map +1 -1
- package/dist/tools/store_collection.js +21 -13
- package/dist/tools/store_collection.js.map +1 -1
- package/dist/tools/structured-output-schemas.d.ts +189 -0
- package/dist/tools/structured-output-schemas.d.ts.map +1 -1
- package/dist/tools/structured-output-schemas.js +100 -0
- package/dist/tools/structured-output-schemas.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +14 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/actor-details.d.ts +96 -0
- package/dist/utils/actor-details.d.ts.map +1 -1
- package/dist/utils/actor-details.js +209 -0
- package/dist/utils/actor-details.js.map +1 -1
- package/dist/utils/actor-response.d.ts +21 -5
- package/dist/utils/actor-response.d.ts.map +1 -1
- package/dist/utils/actor-response.js +26 -5
- package/dist/utils/actor-response.js.map +1 -1
- package/dist/utils/actor-search.d.ts +23 -0
- package/dist/utils/actor-search.d.ts.map +1 -0
- package/dist/utils/actor-search.js +20 -0
- package/dist/utils/actor-search.js.map +1 -0
- package/dist/utils/generic.d.ts +0 -7
- package/dist/utils/generic.d.ts.map +1 -1
- package/dist/utils/generic.js +0 -28
- package/dist/utils/generic.js.map +1 -1
- package/dist/utils/server-instructions.d.ts +14 -0
- package/dist/utils/server-instructions.d.ts.map +1 -0
- package/dist/utils/server-instructions.js +87 -0
- package/dist/utils/server-instructions.js.map +1 -0
- package/dist/utils/skyfire.d.ts +12 -0
- package/dist/utils/skyfire.d.ts.map +1 -0
- package/dist/utils/skyfire.js +19 -0
- package/dist/utils/skyfire.js.map +1 -0
- package/dist/utils/tools-loader.d.ts.map +1 -1
- package/dist/utils/tools-loader.js +15 -2
- package/dist/utils/tools-loader.js.map +1 -1
- package/dist/web/dist/actor-run-widget.js +2765 -16
- package/dist/web/dist/search-actors-widget.js +2766 -17
- package/manifest.json +1 -1
- package/package.json +13 -11
- package/server.json +4 -5
- package/dist/utils/widgets.d.ts.map +0 -1
- package/dist/utils/widgets.js.map +0 -1
- /package/dist/{utils → resources}/widgets.js +0 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ApifyClient } from '../apify-client.js';
|
|
3
|
+
import { HelperTools } from '../const.js';
|
|
4
|
+
import { actorDetailsOutputOptionsSchema, buildActorDetailsTextResponse, buildActorNotFoundResponse, buildCardOptions, fetchActorDetails, resolveOutputOptions, } from '../utils/actor-details.js';
|
|
5
|
+
import { compileSchema } from '../utils/ajv.js';
|
|
6
|
+
import { buildMCPResponse } from '../utils/mcp.js';
|
|
7
|
+
import { actorDetailsOutputSchema } from './structured-output-schemas.js';
|
|
8
|
+
const fetchActorDetailsInternalArgsSchema = z.object({
|
|
9
|
+
actor: z.string()
|
|
10
|
+
.min(1)
|
|
11
|
+
.describe(`Actor ID or full name in the format "username/name", e.g., "apify/rag-web-browser".`),
|
|
12
|
+
output: actorDetailsOutputOptionsSchema.optional()
|
|
13
|
+
.describe('Specify which information to include in the response to save tokens.'),
|
|
14
|
+
});
|
|
15
|
+
export const fetchActorDetailsInternalTool = {
|
|
16
|
+
type: 'internal',
|
|
17
|
+
name: HelperTools.ACTOR_GET_DETAILS_INTERNAL,
|
|
18
|
+
openaiOnly: true,
|
|
19
|
+
description: `Fetch Actor details with flexible output options (UI mode internal tool).
|
|
20
|
+
|
|
21
|
+
This tool is available because the LLM is operating in UI mode. Use it for internal lookups
|
|
22
|
+
where data presentation to the user is NOT needed - this tool does NOT render a widget.
|
|
23
|
+
|
|
24
|
+
Use 'output' parameter with boolean flags to control returned information:
|
|
25
|
+
- Default: Fields: description, stats, pricing, rating, metadata, inputSchema, readme - excepts McpTools
|
|
26
|
+
- Selective: Set desired fields to true to save tokens (e.g., output: { inputSchema: true, readme: false })
|
|
27
|
+
- Common patterns: inputSchema only for execution prep, readme + inputSchema for documentation, etc.
|
|
28
|
+
|
|
29
|
+
Use this instead of fetch-actor-details when you need Actor information to prepare execution
|
|
30
|
+
but the user did NOT explicitly ask for Actor details presentation.`,
|
|
31
|
+
inputSchema: z.toJSONSchema(fetchActorDetailsInternalArgsSchema),
|
|
32
|
+
outputSchema: actorDetailsOutputSchema,
|
|
33
|
+
ajvValidate: compileSchema(z.toJSONSchema(fetchActorDetailsInternalArgsSchema)),
|
|
34
|
+
annotations: {
|
|
35
|
+
title: 'Fetch Actor details internal',
|
|
36
|
+
readOnlyHint: true,
|
|
37
|
+
idempotentHint: true,
|
|
38
|
+
openWorldHint: false,
|
|
39
|
+
},
|
|
40
|
+
call: async (toolArgs) => {
|
|
41
|
+
const { args, apifyToken, apifyMcpServer, actorOutputSchema } = toolArgs;
|
|
42
|
+
const parsed = fetchActorDetailsInternalArgsSchema.parse(args);
|
|
43
|
+
const apifyClient = new ApifyClient({ token: apifyToken });
|
|
44
|
+
const resolvedOutput = resolveOutputOptions(parsed.output);
|
|
45
|
+
const cardOptions = buildCardOptions(resolvedOutput);
|
|
46
|
+
const details = await fetchActorDetails(apifyClient, parsed.actor, cardOptions);
|
|
47
|
+
if (!details) {
|
|
48
|
+
return buildActorNotFoundResponse(parsed.actor);
|
|
49
|
+
}
|
|
50
|
+
const { texts, structuredContent } = await buildActorDetailsTextResponse({
|
|
51
|
+
actorName: parsed.actor,
|
|
52
|
+
details,
|
|
53
|
+
output: resolvedOutput,
|
|
54
|
+
cardOptions,
|
|
55
|
+
apifyClient,
|
|
56
|
+
apifyToken,
|
|
57
|
+
actorOutputSchema,
|
|
58
|
+
skyfireMode: apifyMcpServer === null || apifyMcpServer === void 0 ? void 0 : apifyMcpServer.options.skyfireMode,
|
|
59
|
+
});
|
|
60
|
+
return buildMCPResponse({ texts, structuredContent });
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=fetch-actor-details-internal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-actor-details-internal.js","sourceRoot":"","sources":["../../src/tools/fetch-actor-details-internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EACH,+BAA+B,EAC/B,6BAA6B,EAC7B,0BAA0B,EAC1B,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,GACvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAE1E,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;IACpD,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,WAAW,CAAC,0BAA0B;IAC5C,UAAU,EAAE,IAAI;IAChB,WAAW,EAAE;;;;;;;;;;;oEAWmD;IAChE,WAAW,EAAE,CAAC,CAAC,YAAY,CA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AAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-actor-details.d.ts","sourceRoot":"","sources":["../../src/tools/fetch-actor-details.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fetch-actor-details.d.ts","sourceRoot":"","sources":["../../src/tools/fetch-actor-details.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAoB,SAAS,EAAmB,MAAM,aAAa,CAAC;AAsBhF,eAAO,MAAM,qBAAqB,EAAE,SAuF1B,CAAC"}
|
|
@@ -1,69 +1,17 @@
|
|
|
1
1
|
var _a;
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { ApifyClient } from '../apify-client.js';
|
|
4
|
-
import { HelperTools
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { fetchActorDetails, processActorDetailsForResponse } from '../utils/actor-details.js';
|
|
4
|
+
import { HelperTools } from '../const.js';
|
|
5
|
+
import { getWidgetConfig, WIDGET_URIS } from '../resources/widgets.js';
|
|
6
|
+
import { actorDetailsOutputOptionsSchema, buildActorDetailsTextResponse, buildActorNotFoundResponse, buildCardOptions, fetchActorDetails, processActorDetailsForResponse, resolveOutputOptions, } from '../utils/actor-details.js';
|
|
8
7
|
import { compileSchema } from '../utils/ajv.js';
|
|
9
8
|
import { buildMCPResponse } from '../utils/mcp.js';
|
|
10
|
-
import { getWidgetConfig, WIDGET_URIS } from '../utils/widgets.js';
|
|
11
9
|
import { actorDetailsOutputSchema } from './structured-output-schemas.js';
|
|
12
|
-
/**
|
|
13
|
-
* Gets MCP tools information for an Actor.
|
|
14
|
-
* Returns a message about available tools, error, or that the Actor is not an MCP server.
|
|
15
|
-
*/
|
|
16
|
-
async function getMcpToolsMessage(actorName, apifyClient, apifyToken, apifyMcpServer) {
|
|
17
|
-
const mcpServerUrl = await getActorMcpUrlCached(actorName, apifyClient);
|
|
18
|
-
// Early return: not an MCP server
|
|
19
|
-
if (!mcpServerUrl || typeof mcpServerUrl !== 'string') {
|
|
20
|
-
return `Note: This Actor is not an MCP server and does not expose MCP tools.`;
|
|
21
|
-
}
|
|
22
|
-
// Early return: Skyfire mode restriction
|
|
23
|
-
if (apifyMcpServer.options.skyfireMode) {
|
|
24
|
-
return `This Actor is an MCP server and cannot be accessed in Skyfire mode.`;
|
|
25
|
-
}
|
|
26
|
-
// Connect and list tools
|
|
27
|
-
const client = await connectMCPClient(mcpServerUrl, apifyToken);
|
|
28
|
-
if (!client) {
|
|
29
|
-
return `Failed to connect to MCP server for Actor '${actorName}'.`;
|
|
30
|
-
}
|
|
31
|
-
try {
|
|
32
|
-
const toolsResponse = await client.listTools();
|
|
33
|
-
const mcpToolsInfo = toolsResponse.tools
|
|
34
|
-
.map((tool) => `**${tool.name}**\n${tool.description || 'No description'}\nInput schema:\n\`\`\`json\n${JSON.stringify(tool.inputSchema)}\n\`\`\``)
|
|
35
|
-
.join('\n\n');
|
|
36
|
-
return `# Available MCP Tools\nThis Actor is an MCP server with ${toolsResponse.tools.length} tools.\nTo call a tool, use: "${actorName}:{toolName}"\n\n${mcpToolsInfo}`;
|
|
37
|
-
}
|
|
38
|
-
finally {
|
|
39
|
-
await client.close();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
10
|
const fetchActorDetailsToolArgsSchema = z.object({
|
|
43
11
|
actor: z.string()
|
|
44
12
|
.min(1)
|
|
45
13
|
.describe(`Actor ID or full name in the format "username/name", e.g., "apify/rag-web-browser".`),
|
|
46
|
-
output:
|
|
47
|
-
description: z.boolean().default(true).optional().describe('Include Actor description text only.'),
|
|
48
|
-
stats: z.boolean().default(true).optional().describe('Include usage statistics (users, runs, success rate).'),
|
|
49
|
-
pricing: z.boolean().default(true).optional().describe('Include pricing model and costs.'),
|
|
50
|
-
rating: z.boolean().default(true).optional().describe('Include user rating (out of 5 stars).'),
|
|
51
|
-
metadata: z.boolean().default(true).optional().describe('Include developer, categories, last modified date, and deprecation status.'),
|
|
52
|
-
inputSchema: z.boolean().default(true).optional().describe('Include required input parameters schema.'),
|
|
53
|
-
readme: z.boolean().default(true).optional().describe('Include full README documentation.'),
|
|
54
|
-
mcpTools: z.boolean().default(false).optional().describe('List available tools (only for MCP server Actors).'),
|
|
55
|
-
})
|
|
56
|
-
.optional()
|
|
57
|
-
.default({
|
|
58
|
-
description: true,
|
|
59
|
-
stats: true,
|
|
60
|
-
pricing: true,
|
|
61
|
-
rating: true,
|
|
62
|
-
metadata: true,
|
|
63
|
-
inputSchema: true,
|
|
64
|
-
readme: true,
|
|
65
|
-
mcpTools: false,
|
|
66
|
-
})
|
|
14
|
+
output: actorDetailsOutputOptionsSchema.optional()
|
|
67
15
|
.describe('Specify which information to include in the response to save tokens.'),
|
|
68
16
|
});
|
|
69
17
|
export const fetchActorDetailsTool = {
|
|
@@ -95,34 +43,22 @@ EXAMPLES:
|
|
|
95
43
|
openWorldHint: false,
|
|
96
44
|
},
|
|
97
45
|
call: async (toolArgs) => {
|
|
98
|
-
const { args, apifyToken, apifyMcpServer } = toolArgs;
|
|
46
|
+
const { args, apifyToken, apifyMcpServer, actorOutputSchema } = toolArgs;
|
|
99
47
|
const parsed = fetchActorDetailsToolArgsSchema.parse(args);
|
|
100
48
|
const apifyClient = new ApifyClient({ token: apifyToken });
|
|
101
|
-
|
|
102
|
-
const cardOptions =
|
|
103
|
-
includeDescription: parsed.output.description,
|
|
104
|
-
includeStats: parsed.output.stats,
|
|
105
|
-
includePricing: parsed.output.pricing,
|
|
106
|
-
includeRating: parsed.output.rating,
|
|
107
|
-
includeMetadata: parsed.output.metadata,
|
|
108
|
-
};
|
|
49
|
+
const resolvedOutput = resolveOutputOptions(parsed.output);
|
|
50
|
+
const cardOptions = buildCardOptions(resolvedOutput);
|
|
109
51
|
const details = await fetchActorDetails(apifyClient, parsed.actor, cardOptions);
|
|
110
52
|
if (!details) {
|
|
111
|
-
return
|
|
112
|
-
texts: [`Actor information for '${parsed.actor}' was not found.
|
|
113
|
-
Please verify Actor ID or name format and ensure that the Actor exists.
|
|
114
|
-
You can search for available Actors using the tool: ${HelperTools.STORE_SEARCH}.`],
|
|
115
|
-
isError: true,
|
|
116
|
-
toolStatus: TOOL_STATUS.SOFT_FAIL,
|
|
117
|
-
});
|
|
53
|
+
return buildActorNotFoundResponse(parsed.actor);
|
|
118
54
|
}
|
|
119
|
-
const { structuredContent: processedStructuredContent, formattedReadme, actorUrl } = processActorDetailsForResponse(details);
|
|
120
|
-
const structuredContent = {
|
|
121
|
-
actorInfo: details.actorCardStructured,
|
|
122
|
-
readme: formattedReadme,
|
|
123
|
-
inputSchema: details.inputSchema,
|
|
124
|
-
};
|
|
125
55
|
if (apifyMcpServer.options.uiMode === 'openai') {
|
|
56
|
+
const { structuredContent: processedStructuredContent, formattedReadme, actorUrl } = processActorDetailsForResponse(details);
|
|
57
|
+
const structuredContent = {
|
|
58
|
+
actorInfo: details.actorCardStructured,
|
|
59
|
+
readme: formattedReadme,
|
|
60
|
+
inputSchema: details.inputSchema,
|
|
61
|
+
};
|
|
126
62
|
const widgetStructuredContent = {
|
|
127
63
|
...structuredContent,
|
|
128
64
|
actorDetails: processedStructuredContent.actorDetails,
|
|
@@ -132,7 +68,7 @@ You can search for available Actors using the tool: ${HelperTools.STORE_SEARCH}.
|
|
|
132
68
|
- **Actor:** ${parsed.actor}
|
|
133
69
|
- **URL:** ${actorUrl}
|
|
134
70
|
|
|
135
|
-
|
|
71
|
+
An interactive widget has been rendered with detailed Actor information.
|
|
136
72
|
`];
|
|
137
73
|
const widgetConfig = getWidgetConfig(WIDGET_URIS.SEARCH_ACTORS);
|
|
138
74
|
return buildMCPResponse({
|
|
@@ -144,37 +80,18 @@ View the interactive widget below for detailed Actor information.
|
|
|
144
80
|
},
|
|
145
81
|
});
|
|
146
82
|
}
|
|
147
|
-
const texts = [];
|
|
148
83
|
// NOTE: Data duplication between texts and structuredContent is intentional and required.
|
|
149
84
|
// Some MCP clients only read text content, while others only read structured content.
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
if (parsed.output.readme) {
|
|
161
|
-
texts.push(formattedReadme);
|
|
162
|
-
}
|
|
163
|
-
// Add input schema if requested
|
|
164
|
-
if (parsed.output.inputSchema) {
|
|
165
|
-
texts.push(`# [Input schema](${actorUrl}/input)\n\`\`\`json\n${JSON.stringify(details.inputSchema)}\n\`\`\``);
|
|
166
|
-
}
|
|
167
|
-
// Handle MCP tools
|
|
168
|
-
if (parsed.output.mcpTools) {
|
|
169
|
-
const message = await getMcpToolsMessage(parsed.actor, apifyClient, apifyToken, apifyMcpServer);
|
|
170
|
-
texts.push(message);
|
|
171
|
-
}
|
|
172
|
-
// Update structured output
|
|
173
|
-
const responseStructuredContent = {
|
|
174
|
-
actorInfo: needsCard ? details.actorCardStructured : undefined,
|
|
175
|
-
readme: parsed.output.readme ? formattedReadme : undefined,
|
|
176
|
-
inputSchema: parsed.output.inputSchema ? details.inputSchema : undefined,
|
|
177
|
-
};
|
|
85
|
+
const { texts, structuredContent: responseStructuredContent } = await buildActorDetailsTextResponse({
|
|
86
|
+
actorName: parsed.actor,
|
|
87
|
+
details,
|
|
88
|
+
output: resolvedOutput,
|
|
89
|
+
cardOptions,
|
|
90
|
+
apifyClient,
|
|
91
|
+
apifyToken,
|
|
92
|
+
actorOutputSchema,
|
|
93
|
+
skyfireMode: apifyMcpServer === null || apifyMcpServer === void 0 ? void 0 : apifyMcpServer.options.skyfireMode,
|
|
94
|
+
});
|
|
178
95
|
return buildMCPResponse({ texts, structuredContent: responseStructuredContent });
|
|
179
96
|
},
|
|
180
97
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-actor-details.js","sourceRoot":"","sources":["../../src/tools/fetch-actor-details.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,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AAK,GAAG,CAAC;;eAEZ,MAAM,CAAC,KAAK;aACd,QAAQ;;;CAGpB,CAAC,CAAC;YAES,MAAM,YAAY,GAAG,eAAe,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;YAChE,OAAO,gBAAgB,CAAC;gBACpB,KAAK;gBACL,iBAAiB,EAAE,uBAAuB;gBAC1C,KAAK,EAAE;oBACH,GAAG,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,IAAI;oBACrB,0BAA0B,EAAE,qBAAqB,MAAM,CAAC,KAAK,mBAAmB;iBACnF;aACJ,CAAC,CAAC;QACP,CAAC;QAED,0FAA0F;QAC1F,sFAAsF;QACtF,MAAM,EAAE,KAAK,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,GAAG,MAAM,6BAA6B,CAAC;YAChG,SAAS,EAAE,MAAM,CAAC,KAAK;YACvB,OAAO;YACP,MAAM,EAAE,cAAc;YACtB,WAAW;YACX,WAAW;YACX,UAAU;YACV,iBAAiB;YACjB,WAAW,EAAE,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,OAAO,CAAC,WAAW;SACnD,CAAC,CAAC;QAEH,OAAO,gBAAgB,CAAC,EAAE,KAAK,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,CAAC,CAAC;IACrF,CAAC;CACK,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-actor-output.d.ts","sourceRoot":"","sources":["../../src/tools/get-actor-output.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAoB,SAAS,EAAmB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"get-actor-output.d.ts","sourceRoot":"","sources":["../../src/tools/get-actor-output.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAoB,SAAS,EAAmB,MAAM,aAAa,CAAC;AA0BhF;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAyB1D;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,SA+FnB,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
import { HelperTools,
|
|
2
|
+
import { createApifyClientWithSkyfireSupport } from '../apify-client.js';
|
|
3
|
+
import { HelperTools, TOOL_MAX_OUTPUT_CHARS, TOOL_STATUS } from '../const.js';
|
|
4
4
|
import { compileSchema } from '../utils/ajv.js';
|
|
5
5
|
import { getValuesByDotKeys, parseCommaSeparatedList } from '../utils/generic.js';
|
|
6
6
|
import { buildMCPResponse } from '../utils/mcp.js';
|
|
7
|
+
import { datasetItemsOutputSchema } from './structured-output-schemas.js';
|
|
7
8
|
/**
|
|
8
9
|
* Zod schema for get-actor-output tool arguments
|
|
9
10
|
*/
|
|
@@ -75,10 +76,12 @@ USAGE EXAMPLES:
|
|
|
75
76
|
|
|
76
77
|
Note: This tool is automatically included if the Apify MCP Server is configured with any Actor tools (e.g., "apify-slash-rag-web-browser") or tools that can interact with Actors (e.g., "call-actor", "add-actor").`,
|
|
77
78
|
inputSchema: z.toJSONSchema(getActorOutputArgs),
|
|
79
|
+
outputSchema: datasetItemsOutputSchema,
|
|
78
80
|
/**
|
|
79
81
|
* Allow additional properties for Skyfire mode to pass `skyfire-pay-id`.
|
|
80
82
|
*/
|
|
81
83
|
ajvValidate: compileSchema({ ...z.toJSONSchema(getActorOutputArgs), additionalProperties: true }),
|
|
84
|
+
requiresSkyfirePayId: true,
|
|
82
85
|
annotations: {
|
|
83
86
|
title: 'Get Actor output',
|
|
84
87
|
readOnlyHint: true,
|
|
@@ -87,25 +90,7 @@ Note: This tool is automatically included if the Apify MCP Server is configured
|
|
|
87
90
|
},
|
|
88
91
|
call: async (toolArgs) => {
|
|
89
92
|
const { args, apifyToken, apifyMcpServer } = toolArgs;
|
|
90
|
-
|
|
91
|
-
* In Skyfire mode, we check for the presence of `skyfire-pay-id`.
|
|
92
|
-
* If it is missing, we return instructions to the LLM on how to create it and pass it to the tool.
|
|
93
|
-
*/
|
|
94
|
-
if (apifyMcpServer.options.skyfireMode
|
|
95
|
-
&& args['skyfire-pay-id'] === undefined) {
|
|
96
|
-
return {
|
|
97
|
-
content: [{
|
|
98
|
-
type: 'text',
|
|
99
|
-
text: SKYFIRE_TOOL_INSTRUCTIONS,
|
|
100
|
-
}],
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Create Apify token, for Skyfire mode use `skyfire-pay-id` and for normal mode use `apifyToken`.
|
|
105
|
-
*/
|
|
106
|
-
const apifyClient = apifyMcpServer.options.skyfireMode && typeof args['skyfire-pay-id'] === 'string'
|
|
107
|
-
? new ApifyClient({ skyfirePayId: args['skyfire-pay-id'] })
|
|
108
|
-
: new ApifyClient({ token: apifyToken });
|
|
93
|
+
const apifyClient = createApifyClientWithSkyfireSupport(apifyMcpServer, args, apifyToken);
|
|
109
94
|
const parsed = getActorOutputArgs.parse(args);
|
|
110
95
|
// Parse fields into array
|
|
111
96
|
const fieldsArray = parseCommaSeparatedList(parsed.fields);
|
|
@@ -146,7 +131,15 @@ Note: This tool is automatically included if the Apify MCP Server is configured
|
|
|
146
131
|
if (truncated) {
|
|
147
132
|
outputText += `\n\n[Output was truncated to ${TOOL_MAX_OUTPUT_CHARS} characters to comply with the tool output limits.]`;
|
|
148
133
|
}
|
|
149
|
-
|
|
134
|
+
const structuredContent = {
|
|
135
|
+
datasetId: parsed.datasetId,
|
|
136
|
+
items: cleanedItems,
|
|
137
|
+
itemCount: cleanedItems.length,
|
|
138
|
+
totalItemCount: response.count,
|
|
139
|
+
offset: parsed.offset,
|
|
140
|
+
limit: parsed.limit,
|
|
141
|
+
};
|
|
142
|
+
return { content: [{ type: 'text', text: outputText }], structuredContent };
|
|
150
143
|
},
|
|
151
144
|
};
|
|
152
145
|
//# sourceMappingURL=get-actor-output.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-actor-output.js","sourceRoot":"","sources":["../../src/tools/get-actor-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"get-actor-output.js","sourceRoot":"","sources":["../../src/tools/get-actor-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,mCAAmC,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE9E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAE1E;;GAEG;AACH,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;SAChB,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,2CAA2C,CAAC;IAC1D,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;SACb,QAAQ,EAAE;SACV,QAAQ,CAAC,0IAA0I,CAAC;IACzJ,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;SACb,QAAQ,EAAE;SACV,OAAO,CAAC,CAAC,CAAC;SACV,QAAQ,CAAC,uCAAuC,CAAC;IACtD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;SACZ,QAAQ,EAAE;SACV,OAAO,CAAC,GAAG,CAAC;SACZ,QAAQ,CAAC,mDAAmD,CAAC;CACrE,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAY;IAC7C,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,IAAI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U,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAChF,CAAC;CACK,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"key_value_store.d.ts","sourceRoot":"","sources":["../../src/tools/key_value_store.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAoB,SAAS,EAAmB,MAAM,aAAa,CAAC;AAShF;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"key_value_store.d.ts","sourceRoot":"","sources":["../../src/tools/key_value_store.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAoB,SAAS,EAAmB,MAAM,aAAa,CAAC;AAShF;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAgCrB,CAAC;AAeX;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,SAoCzB,CAAC;AAWX;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,SAgC3B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { createApifyClientWithSkyfireSupport } from '../apify-client.js';
|
|
3
3
|
import { HelperTools } from '../const.js';
|
|
4
4
|
import { compileSchema } from '../utils/ajv.js';
|
|
5
5
|
const getKeyValueStoreArgs = z.object({
|
|
@@ -23,7 +23,11 @@ USAGE EXAMPLES:
|
|
|
23
23
|
- user_input: Show info for key-value store username~my-store
|
|
24
24
|
- user_input: Get details for store adb123`,
|
|
25
25
|
inputSchema: z.toJSONSchema(getKeyValueStoreArgs),
|
|
26
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Allow additional properties for Skyfire mode to pass `skyfire-pay-id`.
|
|
28
|
+
*/
|
|
29
|
+
ajvValidate: compileSchema({ ...z.toJSONSchema(getKeyValueStoreArgs), additionalProperties: true }),
|
|
30
|
+
requiresSkyfirePayId: true,
|
|
27
31
|
annotations: {
|
|
28
32
|
title: 'Get key-value store',
|
|
29
33
|
readOnlyHint: true,
|
|
@@ -31,9 +35,9 @@ USAGE EXAMPLES:
|
|
|
31
35
|
openWorldHint: false,
|
|
32
36
|
},
|
|
33
37
|
call: async (toolArgs) => {
|
|
34
|
-
const { args, apifyToken } = toolArgs;
|
|
38
|
+
const { args, apifyToken, apifyMcpServer } = toolArgs;
|
|
35
39
|
const parsed = getKeyValueStoreArgs.parse(args);
|
|
36
|
-
const client =
|
|
40
|
+
const client = createApifyClientWithSkyfireSupport(apifyMcpServer, args, apifyToken);
|
|
37
41
|
const store = await client.keyValueStore(parsed.storeId).get();
|
|
38
42
|
return { content: [{ type: 'text', text: `\`\`\`json\n${JSON.stringify(store)}\n\`\`\`` }] };
|
|
39
43
|
},
|
|
@@ -67,7 +71,11 @@ USAGE EXAMPLES:
|
|
|
67
71
|
- user_input: List first 100 keys in store username~my-store
|
|
68
72
|
- user_input: Continue listing keys in store a123 from key data.json`,
|
|
69
73
|
inputSchema: z.toJSONSchema(getKeyValueStoreKeysArgs),
|
|
70
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Allow additional properties for Skyfire mode to pass `skyfire-pay-id`.
|
|
76
|
+
*/
|
|
77
|
+
ajvValidate: compileSchema({ ...z.toJSONSchema(getKeyValueStoreKeysArgs), additionalProperties: true }),
|
|
78
|
+
requiresSkyfirePayId: true,
|
|
71
79
|
annotations: {
|
|
72
80
|
title: 'Get key-value store keys',
|
|
73
81
|
readOnlyHint: true,
|
|
@@ -75,9 +83,9 @@ USAGE EXAMPLES:
|
|
|
75
83
|
openWorldHint: false,
|
|
76
84
|
},
|
|
77
85
|
call: async (toolArgs) => {
|
|
78
|
-
const { args, apifyToken } = toolArgs;
|
|
86
|
+
const { args, apifyToken, apifyMcpServer } = toolArgs;
|
|
79
87
|
const parsed = getKeyValueStoreKeysArgs.parse(args);
|
|
80
|
-
const client =
|
|
88
|
+
const client = createApifyClientWithSkyfireSupport(apifyMcpServer, args, apifyToken);
|
|
81
89
|
const keys = await client.keyValueStore(parsed.storeId).listKeys({
|
|
82
90
|
exclusiveStartKey: parsed.exclusiveStartKey,
|
|
83
91
|
limit: parsed.limit,
|
|
@@ -109,7 +117,11 @@ USAGE EXAMPLES:
|
|
|
109
117
|
- user_input: Get record INPUT from store abc123
|
|
110
118
|
- user_input: Get record data.json from store username~my-store`,
|
|
111
119
|
inputSchema: z.toJSONSchema(getKeyValueStoreRecordArgs),
|
|
112
|
-
|
|
120
|
+
/**
|
|
121
|
+
* Allow additional properties for Skyfire mode to pass `skyfire-pay-id`.
|
|
122
|
+
*/
|
|
123
|
+
ajvValidate: compileSchema({ ...z.toJSONSchema(getKeyValueStoreRecordArgs), additionalProperties: true }),
|
|
124
|
+
requiresSkyfirePayId: true,
|
|
113
125
|
annotations: {
|
|
114
126
|
title: 'Get key-value store record',
|
|
115
127
|
readOnlyHint: true,
|
|
@@ -117,9 +129,9 @@ USAGE EXAMPLES:
|
|
|
117
129
|
openWorldHint: false,
|
|
118
130
|
},
|
|
119
131
|
call: async (toolArgs) => {
|
|
120
|
-
const { args, apifyToken } = toolArgs;
|
|
132
|
+
const { args, apifyToken, apifyMcpServer } = toolArgs;
|
|
121
133
|
const parsed = getKeyValueStoreRecordArgs.parse(args);
|
|
122
|
-
const client =
|
|
134
|
+
const client = createApifyClientWithSkyfireSupport(apifyMcpServer, args, apifyToken);
|
|
123
135
|
const record = await client.keyValueStore(parsed.storeId).getRecord(parsed.recordKey);
|
|
124
136
|
return { content: [{ type: 'text', text: `\`\`\`json\n${JSON.stringify(record)}\n\`\`\`` }] };
|
|
125
137
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"key_value_store.js","sourceRoot":"","sources":["../../src/tools/key_value_store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"key_value_store.js","sourceRoot":"","sources":["../../src/tools/key_value_store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAA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,KAAK,EAAE,QAA0B,EAAE,EAAE;QACvC,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,cAAc,EAAE,GAAG,QAAQ,CAAC;QACtD,MAAM,MAAM,GAAG,0BAA0B,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAEtD,MAAM,MAAM,GAAG,mCAAmC,CAAC,cAAc,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;QACrF,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACtF,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;IAClG,CAAC;CACK,CAAC"}
|
package/dist/tools/run.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/tools/run.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/tools/run.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAoB,SAAS,EAAmB,MAAM,aAAa,CAAC;AAoBhF;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,SAsIhB,CAAC;AAUX;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,SAmCnB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,SAkClB,CAAC"}
|
package/dist/tools/run.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
var _a;
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import log from '@apify/log';
|
|
4
|
-
import {
|
|
4
|
+
import { createApifyClientWithSkyfireSupport } from '../apify-client.js';
|
|
5
5
|
import { HelperTools, TOOL_STATUS } from '../const.js';
|
|
6
|
+
import { getWidgetConfig, WIDGET_URIS } from '../resources/widgets.js';
|
|
6
7
|
import { compileSchema } from '../utils/ajv.js';
|
|
7
8
|
import { logHttpError } from '../utils/logging.js';
|
|
8
9
|
import { buildMCPResponse } from '../utils/mcp.js';
|
|
9
10
|
import { generateSchemaFromItems } from '../utils/schema-generation.js';
|
|
10
|
-
import {
|
|
11
|
+
import { getActorRunOutputSchema } from './structured-output-schemas.js';
|
|
11
12
|
const getActorRunArgs = z.object({
|
|
12
13
|
runId: z.string()
|
|
13
14
|
.min(1)
|
|
@@ -39,7 +40,12 @@ USAGE EXAMPLES:
|
|
|
39
40
|
- user_input: Show details of run y2h7sK3Wc (where y2h7sK3Wc is an existing run)
|
|
40
41
|
- user_input: What is the datasetId for run y2h7sK3Wc?`,
|
|
41
42
|
inputSchema: z.toJSONSchema(getActorRunArgs),
|
|
42
|
-
|
|
43
|
+
outputSchema: getActorRunOutputSchema,
|
|
44
|
+
/**
|
|
45
|
+
* Allow additional properties for Skyfire mode to pass `skyfire-pay-id`.
|
|
46
|
+
*/
|
|
47
|
+
ajvValidate: compileSchema({ ...z.toJSONSchema(getActorRunArgs), additionalProperties: true }),
|
|
48
|
+
requiresSkyfirePayId: true,
|
|
43
49
|
_meta: {
|
|
44
50
|
...(_a = getWidgetConfig(WIDGET_URIS.ACTOR_RUN)) === null || _a === void 0 ? void 0 : _a.meta,
|
|
45
51
|
},
|
|
@@ -53,7 +59,7 @@ USAGE EXAMPLES:
|
|
|
53
59
|
var _a, _b;
|
|
54
60
|
const { args, apifyToken, apifyMcpServer } = toolArgs;
|
|
55
61
|
const parsed = getActorRunArgs.parse(args);
|
|
56
|
-
const client =
|
|
62
|
+
const client = createApifyClientWithSkyfireSupport(apifyMcpServer, args, apifyToken);
|
|
57
63
|
try {
|
|
58
64
|
const run = await client.run(parsed.runId).get();
|
|
59
65
|
if (!run) {
|
|
@@ -64,8 +70,21 @@ USAGE EXAMPLES:
|
|
|
64
70
|
});
|
|
65
71
|
}
|
|
66
72
|
log.debug('Get actor run', { runId: parsed.runId, status: run.status });
|
|
73
|
+
let actorName;
|
|
74
|
+
if (run.actId) {
|
|
75
|
+
try {
|
|
76
|
+
const actor = await client.actor(run.actId).get();
|
|
77
|
+
if (actor) {
|
|
78
|
+
actorName = `${actor.username}/${actor.name}`;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
log.warning(`Failed to fetch actor name for run ${parsed.runId}`, { error });
|
|
83
|
+
}
|
|
84
|
+
}
|
|
67
85
|
const structuredContent = {
|
|
68
86
|
runId: run.id,
|
|
87
|
+
actorName,
|
|
69
88
|
status: run.status,
|
|
70
89
|
startedAt: ((_a = run.startedAt) === null || _a === void 0 ? void 0 : _a.toISOString()) || '',
|
|
71
90
|
finishedAt: (_b = run.finishedAt) === null || _b === void 0 ? void 0 : _b.toISOString(),
|
|
@@ -86,12 +105,11 @@ USAGE EXAMPLES:
|
|
|
86
105
|
previewItems: datasetItems.items,
|
|
87
106
|
};
|
|
88
107
|
}
|
|
89
|
-
// When UI mode is enabled, return minimal text with widget metadata
|
|
90
108
|
// When UI mode is disabled, return full text response without widget metadata
|
|
91
109
|
if (apifyMcpServer.options.uiMode === 'openai') {
|
|
92
110
|
const statusText = run.status === 'SUCCEEDED' && structuredContent.dataset
|
|
93
|
-
? `Actor run ${parsed.runId} completed successfully with ${structuredContent.dataset.itemCount} items.
|
|
94
|
-
: `Actor run ${parsed.runId} status: ${run.status}.
|
|
111
|
+
? `Actor run ${parsed.runId} completed successfully with ${structuredContent.dataset.itemCount} items. A widget has been rendered with the details.`
|
|
112
|
+
: `Actor run ${parsed.runId} status: ${run.status}. A progress widget has been rendered.`;
|
|
95
113
|
const widgetConfig = getWidgetConfig(WIDGET_URIS.ACTOR_RUN);
|
|
96
114
|
return buildMCPResponse({
|
|
97
115
|
texts: [statusText],
|
|
@@ -142,7 +160,11 @@ USAGE EXAMPLES:
|
|
|
142
160
|
- user_input: Get logs for run y2h7sK3Wc`,
|
|
143
161
|
inputSchema: z.toJSONSchema(GetRunLogArgs),
|
|
144
162
|
// It does not make sense to add structured output here since the log API just returns plain text
|
|
145
|
-
|
|
163
|
+
/**
|
|
164
|
+
* Allow additional properties for Skyfire mode to pass `skyfire-pay-id`.
|
|
165
|
+
*/
|
|
166
|
+
ajvValidate: compileSchema({ ...z.toJSONSchema(GetRunLogArgs), additionalProperties: true }),
|
|
167
|
+
requiresSkyfirePayId: true,
|
|
146
168
|
annotations: {
|
|
147
169
|
title: 'Get Actor run log',
|
|
148
170
|
readOnlyHint: true,
|
|
@@ -151,9 +173,9 @@ USAGE EXAMPLES:
|
|
|
151
173
|
},
|
|
152
174
|
call: async (toolArgs) => {
|
|
153
175
|
var _a;
|
|
154
|
-
const { args, apifyToken } = toolArgs;
|
|
176
|
+
const { args, apifyToken, apifyMcpServer } = toolArgs;
|
|
155
177
|
const parsed = GetRunLogArgs.parse(args);
|
|
156
|
-
const client =
|
|
178
|
+
const client = createApifyClientWithSkyfireSupport(apifyMcpServer, args, apifyToken);
|
|
157
179
|
const v = (_a = await client.run(parsed.runId).log().get()) !== null && _a !== void 0 ? _a : '';
|
|
158
180
|
const lines = v.split('\n');
|
|
159
181
|
const text = lines.slice(lines.length - parsed.lines - 1, lines.length).join('\n');
|
|
@@ -177,7 +199,11 @@ USAGE EXAMPLES:
|
|
|
177
199
|
- user_input: Abort run y2h7sK3Wc
|
|
178
200
|
- user_input: Gracefully abort run y2h7sK3Wc`,
|
|
179
201
|
inputSchema: z.toJSONSchema(abortRunArgs),
|
|
180
|
-
|
|
202
|
+
/**
|
|
203
|
+
* Allow additional properties for Skyfire mode to pass `skyfire-pay-id`.
|
|
204
|
+
*/
|
|
205
|
+
ajvValidate: compileSchema({ ...z.toJSONSchema(abortRunArgs), additionalProperties: true }),
|
|
206
|
+
requiresSkyfirePayId: true,
|
|
181
207
|
annotations: {
|
|
182
208
|
title: 'Abort Actor run',
|
|
183
209
|
readOnlyHint: false,
|
|
@@ -186,9 +212,9 @@ USAGE EXAMPLES:
|
|
|
186
212
|
openWorldHint: false,
|
|
187
213
|
},
|
|
188
214
|
call: async (toolArgs) => {
|
|
189
|
-
const { args, apifyToken } = toolArgs;
|
|
215
|
+
const { args, apifyToken, apifyMcpServer } = toolArgs;
|
|
190
216
|
const parsed = abortRunArgs.parse(args);
|
|
191
|
-
const client =
|
|
217
|
+
const client = createApifyClientWithSkyfireSupport(apifyMcpServer, args, apifyToken);
|
|
192
218
|
const v = await client.run(parsed.runId).abort({ gracefully: parsed.gracefully });
|
|
193
219
|
return { content: [{ type: 'text', text: `\`\`\`json\n${JSON.stringify(v)}\n\`\`\`` }] };
|
|
194
220
|
},
|