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