1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "toolsJson": `{
12 "tools": [
13 {
14 "name": "search_documents",
15 "description": "Search docs",
16 "inputSchema": {
17 "type": "object",
18 "properties": {
19 "query": { "type": "string", "description": "query" },
20 "limit": { "type": "integer" }
21 },
22 "required": ["query"]
23 }
24 },
25 {
26 "name": "find_document",
27 "description": "Find a document",
28 "inputSchema": {
29 "type": "object",
30 "properties": {
31 "query": { "type": "string" },
32 "limit": { "type": "integer" }
33 },
34 "required": ["query"]
35 }
36 },
37 {
38 "name": "delete_document",
39 "description": "Delete a document by id",
40 "inputSchema": {
41 "type": "object",
42 "properties": {
43 "documentId": { "type": "string" },
44 "confirm": { "type": "boolean", "description": "confirm deletion" }
45 },
46 "required": ["documentId", "confirm"]
47 }
48 }
49 ]
50}`,
51 "agentContext": "Knowledge-base agent with document search, retrieval, update, and deletion tools."
52};
53
54
55const run = await client.actor("trovevault/mcp-tool-description-optimizer").call(input);
56
57
58console.log('Results from dataset');
59console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
60const { items } = await client.dataset(run.defaultDatasetId).listItems();
61items.forEach((item) => {
62 console.dir(item);
63});
64
65