@apify/actors-mcp-server 0.3.9 → 0.4.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/README.md +88 -22
- package/dist/actor/server.d.ts +1 -5
- package/dist/actor/server.d.ts.map +1 -1
- package/dist/actor/server.js +7 -24
- package/dist/actor/server.js.map +1 -1
- package/dist/const.d.ts +1 -1
- package/dist/const.d.ts.map +1 -1
- package/dist/const.js +1 -1
- package/dist/const.js.map +1 -1
- package/dist/index-internals.d.ts +6 -4
- package/dist/index-internals.d.ts.map +1 -1
- package/dist/index-internals.js +6 -4
- package/dist/index-internals.js.map +1 -1
- package/dist/input.d.ts +11 -3
- package/dist/input.d.ts.map +1 -1
- package/dist/input.js +64 -20
- package/dist/input.js.map +1 -1
- package/dist/main.js +3 -15
- package/dist/main.js.map +1 -1
- package/dist/mcp/server.d.ts +6 -30
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +14 -82
- package/dist/mcp/server.js.map +1 -1
- package/dist/stdio.js +25 -25
- package/dist/stdio.js.map +1 -1
- package/dist/tools/actor.d.ts.map +1 -1
- package/dist/tools/actor.js +75 -40
- package/dist/tools/actor.js.map +1 -1
- package/dist/tools/fetch-actor-details.d.ts +3 -0
- package/dist/tools/fetch-actor-details.d.ts.map +1 -0
- package/dist/tools/fetch-actor-details.js +45 -0
- package/dist/tools/fetch-actor-details.js.map +1 -0
- package/dist/tools/helpers.d.ts.map +1 -1
- package/dist/tools/helpers.js +3 -5
- package/dist/tools/helpers.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 +12 -13
- package/dist/tools/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +17 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/actor-details.d.ts +11 -0
- package/dist/utils/actor-details.d.ts.map +1 -0
- package/dist/utils/actor-details.js +27 -0
- package/dist/utils/actor-details.js.map +1 -0
- package/dist/utils/tools-loader.d.ts +1 -2
- package/dist/utils/tools-loader.d.ts.map +1 -1
- package/dist/utils/tools-loader.js +98 -24
- package/dist/utils/tools-loader.js.map +1 -1
- package/dist/utils/tools.d.ts +9 -1
- package/dist/utils/tools.d.ts.map +1 -1
- package/dist/utils/tools.js +14 -0
- package/dist/utils/tools.js.map +1 -1
- package/package.json +5 -5
- package/dist/examples/clientSse.d.ts +0 -18
- package/dist/examples/clientSse.d.ts.map +0 -1
- package/dist/examples/clientSse.js +0 -85
- package/dist/examples/clientSse.js.map +0 -1
- package/dist/examples/clientStdio.d.ts +0 -8
- package/dist/examples/clientStdio.d.ts.map +0 -1
- package/dist/examples/clientStdio.js +0 -68
- package/dist/examples/clientStdio.js.map +0 -1
- package/dist/examples/clientStdioChat.d.ts +0 -23
- package/dist/examples/clientStdioChat.d.ts.map +0 -1
- package/dist/examples/clientStdioChat.js +0 -216
- package/dist/examples/clientStdioChat.js.map +0 -1
- package/dist/examples/clientStreamableHttp.d.ts +0 -2
- package/dist/examples/clientStreamableHttp.d.ts.map +0 -1
- package/dist/examples/clientStreamableHttp.js +0 -96
- package/dist/examples/clientStreamableHttp.js.map +0 -1
- package/dist/tools/get-actor-details.d.ts +0 -3
- package/dist/tools/get-actor-details.d.ts.map +0 -1
- package/dist/tools/get-actor-details.js +0 -59
- package/dist/tools/get-actor-details.js.map +0 -1
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
/**
|
|
3
|
-
* Create a simple chat client that connects to the Model Context Protocol server using the stdio transport.
|
|
4
|
-
* Based on the user input, the client sends a query to the MCP server, retrieves results and processes them.
|
|
5
|
-
*
|
|
6
|
-
* You can expect the following output:
|
|
7
|
-
*
|
|
8
|
-
* MCP Client Started!
|
|
9
|
-
* Type your queries or 'quit|q|exit' to exit.
|
|
10
|
-
* You: Find to articles about AI agent and return URLs
|
|
11
|
-
* [internal] Received response from Claude: [{"type":"text","text":"I'll search for information about AI agents
|
|
12
|
-
* and provide you with a summary."},{"type":"tool_use","id":"tool_01He9TkzQfh2979bbeuxWVqM","name":"search",
|
|
13
|
-
* "input":{"query":"what are AI agents definition capabilities applications","maxResults":2}}]
|
|
14
|
-
* [internal] Calling tool: {"name":"search","arguments":{"query":"what are AI agents definition ...
|
|
15
|
-
* I can help analyze the provided content about AI agents.
|
|
16
|
-
* This appears to be crawled content from AWS and IBM websites explaining what AI agents are.
|
|
17
|
-
* Let me summarize the key points:
|
|
18
|
-
*/
|
|
19
|
-
import { execSync } from 'node:child_process';
|
|
20
|
-
import path from 'node:path';
|
|
21
|
-
import * as readline from 'node:readline';
|
|
22
|
-
import { fileURLToPath } from 'node:url';
|
|
23
|
-
import { Anthropic } from '@anthropic-ai/sdk'; // eslint-disable-line import/no-extraneous-dependencies
|
|
24
|
-
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
25
|
-
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
26
|
-
import { CallToolResultSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
27
|
-
import dotenv from 'dotenv'; // eslint-disable-line import/no-extraneous-dependencies
|
|
28
|
-
const filename = fileURLToPath(import.meta.url);
|
|
29
|
-
const dirname = path.dirname(filename);
|
|
30
|
-
dotenv.config({ path: path.resolve(dirname, '../../.env') });
|
|
31
|
-
const REQUEST_TIMEOUT = 120000; // 2 minutes
|
|
32
|
-
const MAX_TOKENS = 2048; // Maximum tokens for Claude response
|
|
33
|
-
// const CLAUDE_MODEL = 'claude-3-5-sonnet-20241022'; // the most intelligent model
|
|
34
|
-
// const CLAUDE_MODEL = 'claude-3-5-haiku-20241022'; // a fastest model
|
|
35
|
-
const CLAUDE_MODEL = 'claude-3-haiku-20240307'; // a fastest and most compact model for near-instant responsiveness
|
|
36
|
-
const DEBUG = true;
|
|
37
|
-
const DEBUG_SERVER_PATH = path.resolve(dirname, '../../dist/stdio.js');
|
|
38
|
-
const NODE_PATH = execSync('which node').toString().trim();
|
|
39
|
-
dotenv.config(); // Load environment variables from .env
|
|
40
|
-
class MCPClient {
|
|
41
|
-
constructor() {
|
|
42
|
-
Object.defineProperty(this, "anthropic", {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
configurable: true,
|
|
45
|
-
writable: true,
|
|
46
|
-
value: void 0
|
|
47
|
-
});
|
|
48
|
-
Object.defineProperty(this, "client", {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
configurable: true,
|
|
51
|
-
writable: true,
|
|
52
|
-
value: new Client({
|
|
53
|
-
name: 'example-client',
|
|
54
|
-
version: '0.1.0',
|
|
55
|
-
}, {
|
|
56
|
-
capabilities: {}, // Optional capabilities
|
|
57
|
-
})
|
|
58
|
-
});
|
|
59
|
-
Object.defineProperty(this, "tools", {
|
|
60
|
-
enumerable: true,
|
|
61
|
-
configurable: true,
|
|
62
|
-
writable: true,
|
|
63
|
-
value: []
|
|
64
|
-
});
|
|
65
|
-
this.anthropic = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY });
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Start the server using node and provided server script path.
|
|
69
|
-
* Connect to the server using stdio transport and list available tools.
|
|
70
|
-
*/
|
|
71
|
-
async connectToServer(serverArgs) {
|
|
72
|
-
const transport = new StdioClientTransport({
|
|
73
|
-
command: NODE_PATH,
|
|
74
|
-
args: serverArgs,
|
|
75
|
-
env: { APIFY_TOKEN: process.env.APIFY_TOKEN || '' },
|
|
76
|
-
});
|
|
77
|
-
await this.client.connect(transport);
|
|
78
|
-
const response = await this.client.listTools();
|
|
79
|
-
this.tools = response.tools.map((x) => ({
|
|
80
|
-
name: x.name,
|
|
81
|
-
description: x.description,
|
|
82
|
-
input_schema: x.inputSchema,
|
|
83
|
-
}));
|
|
84
|
-
console.log('Connected to server with tools:', this.tools.map((x) => x.name));
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Process LLM response and check whether it contains any tool calls.
|
|
88
|
-
* If a tool call is found, call the tool and return the response and save the results to messages with type: user.
|
|
89
|
-
* If the tools response is too large, truncate it to the limit.
|
|
90
|
-
*/
|
|
91
|
-
async processMsg(response, messages) {
|
|
92
|
-
for (const content of response.content) {
|
|
93
|
-
if (content.type === 'text') {
|
|
94
|
-
messages.push({ role: 'assistant', content: content.text });
|
|
95
|
-
}
|
|
96
|
-
else if (content.type === 'tool_use') {
|
|
97
|
-
await this.handleToolCall(content, messages);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return messages;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Call the tool and return the response.
|
|
104
|
-
*/
|
|
105
|
-
async handleToolCall(content, messages, toolCallCount = 0) {
|
|
106
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
107
|
-
const params = { name: content.name, arguments: content.input };
|
|
108
|
-
console.log(`[internal] Calling tool (count: ${toolCallCount}): ${JSON.stringify(params)}`);
|
|
109
|
-
let results;
|
|
110
|
-
try {
|
|
111
|
-
results = await this.client.callTool(params, CallToolResultSchema, { timeout: REQUEST_TIMEOUT });
|
|
112
|
-
if (results.content instanceof Array && results.content.length !== 0) {
|
|
113
|
-
const text = results.content.map((x) => x.text);
|
|
114
|
-
messages.push({ role: 'user', content: `Tool result: ${text.join('\n\n')}` });
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
messages.push({ role: 'user', content: `No results retrieved from ${params.name}` });
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
catch (error) {
|
|
121
|
-
messages.push({ role: 'user', content: `Error calling tool: ${params.name}, error: ${error}` });
|
|
122
|
-
}
|
|
123
|
-
// Get next response from Claude
|
|
124
|
-
const nextResponse = await this.anthropic.messages.create({
|
|
125
|
-
model: CLAUDE_MODEL,
|
|
126
|
-
max_tokens: MAX_TOKENS,
|
|
127
|
-
messages,
|
|
128
|
-
tools: this.tools, // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
129
|
-
});
|
|
130
|
-
for (const c of nextResponse.content) {
|
|
131
|
-
if (c.type === 'text') {
|
|
132
|
-
messages.push({ role: 'assistant', content: c.text });
|
|
133
|
-
}
|
|
134
|
-
else if (c.type === 'tool_use' && toolCallCount < 3) {
|
|
135
|
-
return await this.handleToolCall(c, messages, toolCallCount + 1);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
return messages;
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Process user query by sending it to the server and returning the response.
|
|
142
|
-
* Also, process any tool calls.
|
|
143
|
-
*/
|
|
144
|
-
async processQuery(query, messages) {
|
|
145
|
-
messages.push({ role: 'user', content: query });
|
|
146
|
-
const response = await this.anthropic.messages.create({
|
|
147
|
-
model: CLAUDE_MODEL,
|
|
148
|
-
max_tokens: MAX_TOKENS,
|
|
149
|
-
messages,
|
|
150
|
-
tools: this.tools, // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
151
|
-
});
|
|
152
|
-
console.log('[internal] Received response from Claude:', JSON.stringify(response.content));
|
|
153
|
-
return await this.processMsg(response, messages);
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Create a chat loop that reads user input from the console and sends it to the server for processing.
|
|
157
|
-
*/
|
|
158
|
-
async chatLoop() {
|
|
159
|
-
const rl = readline.createInterface({
|
|
160
|
-
input: process.stdin,
|
|
161
|
-
output: process.stdout,
|
|
162
|
-
prompt: 'You: ',
|
|
163
|
-
});
|
|
164
|
-
console.log("MCP Client Started!\nType your queries or 'quit|q|exit' to exit.");
|
|
165
|
-
rl.prompt();
|
|
166
|
-
let lastPrintMessage = 0;
|
|
167
|
-
const messages = [];
|
|
168
|
-
rl.on('line', async (input) => {
|
|
169
|
-
const v = input.trim().toLowerCase();
|
|
170
|
-
if (v === 'quit' || v === 'q' || v === 'exit') {
|
|
171
|
-
rl.close();
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
try {
|
|
175
|
-
await this.processQuery(input, messages);
|
|
176
|
-
for (let i = lastPrintMessage + 1; i < messages.length; i++) {
|
|
177
|
-
if (messages[i].role === 'assistant') {
|
|
178
|
-
console.log('CLAUDE:', messages[i].content);
|
|
179
|
-
}
|
|
180
|
-
else if (messages[i].role === 'user') {
|
|
181
|
-
console.log('USER:', messages[i].content.slice(0, 500), '...');
|
|
182
|
-
}
|
|
183
|
-
else {
|
|
184
|
-
console.log('CLAUDE[thinking]:', messages[i].content);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
lastPrintMessage += messages.length;
|
|
188
|
-
}
|
|
189
|
-
catch (error) {
|
|
190
|
-
console.error('Error processing query:', error);
|
|
191
|
-
}
|
|
192
|
-
rl.prompt();
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
async function main() {
|
|
197
|
-
const client = new MCPClient();
|
|
198
|
-
if (process.argv.length < 3) {
|
|
199
|
-
if (DEBUG) {
|
|
200
|
-
process.argv.push(DEBUG_SERVER_PATH);
|
|
201
|
-
}
|
|
202
|
-
else {
|
|
203
|
-
console.error('Usage: node <path_to_server_script>');
|
|
204
|
-
process.exit(1);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
try {
|
|
208
|
-
await client.connectToServer(process.argv.slice(2));
|
|
209
|
-
await client.chatLoop();
|
|
210
|
-
}
|
|
211
|
-
catch (error) {
|
|
212
|
-
console.error('Error:', error);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
main().catch(console.error);
|
|
216
|
-
//# sourceMappingURL=clientStdioChat.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clientStdioChat.js","sourceRoot":"","sources":["../../src/examples/clientStdioChat.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,KAAK,QAAQ,MAAM,eAAe,C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AAQ,EAAE,KAAK,CAAC,CAAC;IACnC,CAAC;AACL,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clientStreamableHttp.d.ts","sourceRoot":"","sources":["../../src/examples/clientStreamableHttp.ts"],"names":[],"mappings":""}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
2
|
-
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
3
|
-
import { CallToolResultSchema, ListToolsResultSchema, LoggingMessageNotificationSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
4
|
-
import log from '@apify/log';
|
|
5
|
-
import { HelperTools } from '../const.js';
|
|
6
|
-
log.setLevel(log.LEVELS.DEBUG);
|
|
7
|
-
async function main() {
|
|
8
|
-
// Create a new client with streamable HTTP transport
|
|
9
|
-
const client = new Client({
|
|
10
|
-
name: 'example-client',
|
|
11
|
-
version: '1.0.0',
|
|
12
|
-
});
|
|
13
|
-
const transport = new StreamableHTTPClientTransport(new URL('http://localhost:3000/mcp'));
|
|
14
|
-
// Connect the client using the transport and initialize the server
|
|
15
|
-
await client.connect(transport);
|
|
16
|
-
log.debug('Connected to MCP server');
|
|
17
|
-
// Set up notification handlers for server-initiated messages
|
|
18
|
-
client.setNotificationHandler(LoggingMessageNotificationSchema, (notification) => {
|
|
19
|
-
log.debug('Notification received', { level: notification.params.level, data: notification.params.data });
|
|
20
|
-
});
|
|
21
|
-
// List and call tools
|
|
22
|
-
await listTools(client);
|
|
23
|
-
await callSearchTool(client);
|
|
24
|
-
await callActor(client);
|
|
25
|
-
// Keep the connection open to receive notifications
|
|
26
|
-
log.debug('\nKeeping connection open to receive notifications. Press Ctrl+C to exit.');
|
|
27
|
-
}
|
|
28
|
-
async function listTools(client) {
|
|
29
|
-
try {
|
|
30
|
-
const toolsRequest = {
|
|
31
|
-
method: 'tools/list',
|
|
32
|
-
params: {},
|
|
33
|
-
};
|
|
34
|
-
const toolsResult = await client.request(toolsRequest, ListToolsResultSchema);
|
|
35
|
-
log.debug('Tools available', { itemCount: toolsResult.tools.length });
|
|
36
|
-
for (const tool of toolsResult.tools) {
|
|
37
|
-
log.debug('Tool detail', { toolName: tool.name, description: tool.description });
|
|
38
|
-
}
|
|
39
|
-
if (toolsResult.tools.length === 0) {
|
|
40
|
-
log.debug('No tools available from the server');
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
catch (error) {
|
|
44
|
-
log.error('Tools not supported by this server', { error });
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
async function callSearchTool(client) {
|
|
48
|
-
try {
|
|
49
|
-
const searchRequest = {
|
|
50
|
-
method: 'tools/call',
|
|
51
|
-
params: {
|
|
52
|
-
name: HelperTools.STORE_SEARCH,
|
|
53
|
-
arguments: { search: 'rag web browser', limit: 1 },
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
const searchResult = await client.request(searchRequest, CallToolResultSchema);
|
|
57
|
-
log.debug('Search result:');
|
|
58
|
-
const resultContent = searchResult.content || [];
|
|
59
|
-
resultContent.forEach((item) => {
|
|
60
|
-
if (item.type === 'text') {
|
|
61
|
-
log.debug('Search result item', { text: item.text });
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
66
|
-
log.error('Error calling greet tool', { error });
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
async function callActor(client) {
|
|
70
|
-
try {
|
|
71
|
-
log.debug('\nCalling Actor...');
|
|
72
|
-
const actorRequest = {
|
|
73
|
-
method: 'tools/call',
|
|
74
|
-
params: {
|
|
75
|
-
name: 'apify/rag-web-browser',
|
|
76
|
-
arguments: { query: 'apify mcp server' },
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
const actorResult = await client.request(actorRequest, CallToolResultSchema);
|
|
80
|
-
log.debug('Actor results:');
|
|
81
|
-
const resultContent = actorResult.content || [];
|
|
82
|
-
resultContent.forEach((item) => {
|
|
83
|
-
if (item.type === 'text') {
|
|
84
|
-
log.debug('Actor result item', { text: item.text });
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
catch (error) {
|
|
89
|
-
log.error('Error calling Actor', { error });
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
main().catch((error) => {
|
|
93
|
-
log.error('Error running MCP client', { error: error });
|
|
94
|
-
process.exit(1);
|
|
95
|
-
});
|
|
96
|
-
//# sourceMappingURL=clientStreamableHttp.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clientStreamableHttp.js","sourceRoot":"","sources":["../../src/examples/clientStreamableHttp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AAEnG,OAAO,EACH,oBAAoB,EACpB,qBAAqB,EACrB,gCAAgC,GACnC,MAAM,oCAAoC,CAAC;AAE5C,OAAO,GAAG,MAAM,YAAY,CAAC;AAE7B,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAE/B,KAAK,UAAU,IAAI;IACf,qDAAqD;IACrD,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC;QACtB,IAAI,EAAE,gBAAgB;QACtB,OAAO,EAAE,OAAO;KACnB,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,IAAI,6BAA6B,CAC/C,IAAI,GAAG,CAAC,2BAA2B,CAAC,CACvC,CAAC;IAEF,mEAAmE;IACnE,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,GAAG,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;IA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AoB,CAAC,CAAC;QAC7E,GAAG,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QAC5B,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,IAAI,EAAE,CAAC;QAChD,aAAa,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YAC3B,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;gBACvB,GAAG,CAAC,KAAK,CAAC,mBAAmB,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;YACxD,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,GAAG,CAAC,KAAK,CAAC,qBAAqB,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IAChD,CAAC;AACL,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IAC5B,GAAG,CAAC,KAAK,CAAC,0BAA0B,EAAE,EAAE,KAAK,EAAE,KAAc,EAAE,CAAC,CAAC;IACjE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-actor-details.d.ts","sourceRoot":"","sources":["../../src/tools/get-actor-details.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAmC,SAAS,EAAE,MAAM,aAAa,CAAC;AAW9E,eAAO,MAAM,mBAAmB,EAAE,SAmDjC,CAAC"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import zodToJsonSchema from 'zod-to-json-schema';
|
|
3
|
-
import { ApifyClient } from '../apify-client.js';
|
|
4
|
-
import { HelperTools } from '../const.js';
|
|
5
|
-
import { formatActorToActorCard } from '../utils/actor-card.js';
|
|
6
|
-
import { ajv } from '../utils/ajv.js';
|
|
7
|
-
import { filterSchemaProperties, shortenProperties } from './utils.js';
|
|
8
|
-
const getActorDetailsToolArgsSchema = 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
|
-
});
|
|
13
|
-
export const getActorDetailsTool = {
|
|
14
|
-
type: 'internal',
|
|
15
|
-
tool: {
|
|
16
|
-
name: HelperTools.ACTOR_GET_DETAILS,
|
|
17
|
-
description: `Get detailed information about an Actor by its ID or full name.\n`
|
|
18
|
-
+ `This tool returns title, description, URL, README (Actor's documentation), input schema, and usage statistics. \n`
|
|
19
|
-
+ `The Actor name is always composed of "username/name", for example, "apify/rag-web-browser".\n`
|
|
20
|
-
+ `Present Actor information in user-friendly format as an Actor card.\n`
|
|
21
|
-
+ `USAGE:\n`
|
|
22
|
-
+ `- Use when user asks about an Actor its details, description, input schema, etc.\n`
|
|
23
|
-
+ `EXAMPLES:\n`
|
|
24
|
-
+ `- user_input: How to use apify/rag-web-browser\n`
|
|
25
|
-
+ `- user_input: What is the input schema for apify/rag-web-browser`,
|
|
26
|
-
inputSchema: zodToJsonSchema(getActorDetailsToolArgsSchema),
|
|
27
|
-
ajvValidate: ajv.compile(zodToJsonSchema(getActorDetailsToolArgsSchema)),
|
|
28
|
-
call: async (toolArgs) => {
|
|
29
|
-
const { args, apifyToken } = toolArgs;
|
|
30
|
-
const parsed = getActorDetailsToolArgsSchema.parse(args);
|
|
31
|
-
const client = new ApifyClient({ token: apifyToken });
|
|
32
|
-
const [actorInfo, buildInfo] = await Promise.all([
|
|
33
|
-
client.actor(parsed.actor).get(),
|
|
34
|
-
client.actor(parsed.actor).defaultBuild().then(async (build) => build.get()),
|
|
35
|
-
]);
|
|
36
|
-
if (!actorInfo || !buildInfo || !buildInfo.actorDefinition) {
|
|
37
|
-
return {
|
|
38
|
-
content: [{ type: 'text', text: `Actor information for '${parsed.actor}' was not found. Please check the Actor ID or name and ensure the Actor exists.` }],
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
const inputSchema = (buildInfo.actorDefinition.input || {
|
|
42
|
-
type: 'object',
|
|
43
|
-
properties: {},
|
|
44
|
-
});
|
|
45
|
-
inputSchema.properties = filterSchemaProperties(inputSchema.properties);
|
|
46
|
-
inputSchema.properties = shortenProperties(inputSchema.properties);
|
|
47
|
-
// Use the actor formatter to get the main actor details
|
|
48
|
-
const actorCard = formatActorToActorCard(actorInfo);
|
|
49
|
-
return {
|
|
50
|
-
content: [
|
|
51
|
-
{ type: 'text', text: `**Actor card**:\n${actorCard}` },
|
|
52
|
-
{ type: 'text', text: `**README:**\n${buildInfo.actorDefinition.readme || 'No README provided.'}` },
|
|
53
|
-
{ type: 'text', text: `**Input Schema:**\n${JSON.stringify(inputSchema, null, 0)}` },
|
|
54
|
-
],
|
|
55
|
-
};
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
//# sourceMappingURL=get-actor-details.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-actor-details.js","sourceRoot":"","sources":["../../src/tools/get-actor-details.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,eAAe,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEvE,MAAM,6BAA6B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;SACZ,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,qFAAqF,CAAC;CACvG,CAAC,CAAC;AAEH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