trustgraph-cli 0.21.0__tar.gz → 1.5.7__tar.gz

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.
Files changed (85) hide show
  1. trustgraph_cli-1.5.7/PKG-INFO +20 -0
  2. trustgraph_cli-1.5.7/pyproject.toml +98 -0
  3. trustgraph_cli-1.5.7/trustgraph/cli/__init__.py +1 -0
  4. trustgraph_cli-1.5.7/trustgraph/cli/add_library_document.py +204 -0
  5. trustgraph_cli-1.5.7/trustgraph/cli/delete_collection.py +72 -0
  6. trustgraph_cli-1.5.7/trustgraph/cli/delete_config_item.py +61 -0
  7. trustgraph_cli-1.5.7/trustgraph/cli/delete_flow_class.py +51 -0
  8. trustgraph_cli-1.5.7/trustgraph/cli/delete_kg_core.py +59 -0
  9. trustgraph_cli-1.5.7/trustgraph/cli/delete_mcp_tool.py +93 -0
  10. trustgraph_cli-1.5.7/trustgraph/cli/delete_tool.py +98 -0
  11. trustgraph-cli-0.21.0/scripts/tg-dump-msgpack → trustgraph_cli-1.5.7/trustgraph/cli/dump_msgpack.py +2 -4
  12. trustgraph_cli-1.5.7/trustgraph/cli/get_config_item.py +78 -0
  13. trustgraph_cli-1.5.7/trustgraph/cli/get_flow_class.py +54 -0
  14. trustgraph_cli-1.5.7/trustgraph/cli/get_kg_core.py +159 -0
  15. trustgraph-cli-0.21.0/scripts/tg-graph-to-turtle → trustgraph_cli-1.5.7/trustgraph/cli/graph_to_turtle.py +15 -10
  16. trustgraph-cli-0.21.0/scripts/tg-init-pulsar-manager → trustgraph_cli-1.5.7/trustgraph/cli/init_pulsar_manager.py +0 -0
  17. trustgraph_cli-1.5.7/trustgraph/cli/init_trustgraph.py +239 -0
  18. trustgraph-cli-0.21.0/scripts/tg-invoke-agent → trustgraph_cli-1.5.7/trustgraph/cli/invoke_agent.py +41 -16
  19. trustgraph-cli-0.21.0/scripts/tg-invoke-document-rag → trustgraph_cli-1.5.7/trustgraph/cli/invoke_document_rag.py +24 -9
  20. trustgraph_cli-1.5.7/trustgraph/cli/invoke_graph_rag.py +115 -0
  21. trustgraph-cli-0.21.0/scripts/tg-invoke-llm → trustgraph_cli-1.5.7/trustgraph/cli/invoke_llm.py +11 -6
  22. trustgraph_cli-1.5.7/trustgraph/cli/invoke_mcp_tool.py +78 -0
  23. trustgraph_cli-1.5.7/trustgraph/cli/invoke_nlp_query.py +111 -0
  24. trustgraph_cli-1.5.7/trustgraph/cli/invoke_objects_query.py +201 -0
  25. trustgraph-cli-0.21.0/scripts/tg-invoke-prompt → trustgraph_cli-1.5.7/trustgraph/cli/invoke_prompt.py +11 -6
  26. trustgraph_cli-1.5.7/trustgraph/cli/invoke_structured_query.py +173 -0
  27. trustgraph_cli-1.5.7/trustgraph/cli/list_collections.py +86 -0
  28. trustgraph_cli-1.5.7/trustgraph/cli/list_config_items.py +65 -0
  29. trustgraph-cli-0.21.0/scripts/tg-load-doc-embeds → trustgraph_cli-1.5.7/trustgraph/cli/load_doc_embeds.py +17 -8
  30. trustgraph_cli-1.5.7/trustgraph/cli/load_kg_core.py +78 -0
  31. trustgraph_cli-1.5.7/trustgraph/cli/load_knowledge.py +202 -0
  32. trustgraph-cli-0.21.0/scripts/tg-load-pdf → trustgraph_cli-1.5.7/trustgraph/cli/load_pdf.py +51 -51
  33. trustgraph_cli-1.5.7/trustgraph/cli/load_sample_documents.py +739 -0
  34. trustgraph_cli-1.5.7/trustgraph/cli/load_structured_data.py +1097 -0
  35. trustgraph-cli-0.21.0/scripts/tg-load-text → trustgraph_cli-1.5.7/trustgraph/cli/load_text.py +52 -47
  36. trustgraph_cli-1.5.7/trustgraph/cli/load_turtle.py +159 -0
  37. trustgraph_cli-1.5.7/trustgraph/cli/put_config_item.py +80 -0
  38. trustgraph_cli-1.5.7/trustgraph/cli/put_flow_class.py +57 -0
  39. trustgraph_cli-1.5.7/trustgraph/cli/put_kg_core.py +181 -0
  40. trustgraph-cli-0.21.0/scripts/tg-invoke-graph-rag → trustgraph_cli-1.5.7/trustgraph/cli/remove_library_document.py +13 -27
  41. trustgraph-cli-0.21.0/scripts/tg-save-doc-embeds → trustgraph_cli-1.5.7/trustgraph/cli/save_doc_embeds.py +16 -11
  42. trustgraph_cli-1.5.7/trustgraph/cli/set_collection.py +103 -0
  43. trustgraph_cli-1.5.7/trustgraph/cli/set_mcp_tool.py +127 -0
  44. trustgraph_cli-1.5.7/trustgraph/cli/set_prompt.py +141 -0
  45. trustgraph_cli-1.5.7/trustgraph/cli/set_token_costs.py +109 -0
  46. trustgraph_cli-1.5.7/trustgraph/cli/set_tool.py +267 -0
  47. trustgraph_cli-1.5.7/trustgraph/cli/show_config.py +47 -0
  48. trustgraph_cli-1.5.7/trustgraph/cli/show_flow_classes.py +122 -0
  49. trustgraph_cli-1.5.7/trustgraph/cli/show_flow_state.py +91 -0
  50. trustgraph_cli-1.5.7/trustgraph/cli/show_flows.py +215 -0
  51. trustgraph-cli-0.21.0/scripts/tg-graph-show → trustgraph_cli-1.5.7/trustgraph/cli/show_graph.py +16 -11
  52. trustgraph_cli-1.5.7/trustgraph/cli/show_kg_cores.py +57 -0
  53. trustgraph_cli-1.5.7/trustgraph/cli/show_library_documents.py +74 -0
  54. trustgraph_cli-1.5.7/trustgraph/cli/show_library_processing.py +73 -0
  55. trustgraph_cli-1.5.7/trustgraph/cli/show_mcp_tools.py +73 -0
  56. trustgraph_cli-1.5.7/trustgraph/cli/show_parameter_types.py +210 -0
  57. trustgraph_cli-1.5.7/trustgraph/cli/show_processor_state.py +53 -0
  58. trustgraph_cli-1.5.7/trustgraph/cli/show_prompts.py +94 -0
  59. trustgraph_cli-1.5.7/trustgraph/cli/show_token_costs.py +77 -0
  60. trustgraph_cli-1.5.7/trustgraph/cli/show_token_rate.py +107 -0
  61. trustgraph_cli-1.5.7/trustgraph/cli/show_tools.py +116 -0
  62. trustgraph_cli-1.5.7/trustgraph/cli/start_flow.py +122 -0
  63. trustgraph_cli-1.5.7/trustgraph/cli/start_library_processing.py +101 -0
  64. trustgraph_cli-1.5.7/trustgraph/cli/stop_flow.py +52 -0
  65. trustgraph_cli-1.5.7/trustgraph/cli/stop_library_processing.py +63 -0
  66. trustgraph_cli-1.5.7/trustgraph/cli/unload_kg_core.py +70 -0
  67. trustgraph_cli-1.5.7/trustgraph/cli_version.py +1 -0
  68. trustgraph_cli-1.5.7/trustgraph_cli.egg-info/PKG-INFO +20 -0
  69. trustgraph_cli-1.5.7/trustgraph_cli.egg-info/SOURCES.txt +73 -0
  70. trustgraph_cli-1.5.7/trustgraph_cli.egg-info/entry_points.txt +63 -0
  71. {trustgraph-cli-0.21.0 → trustgraph_cli-1.5.7}/trustgraph_cli.egg-info/requires.txt +4 -4
  72. {trustgraph-cli-0.21.0 → trustgraph_cli-1.5.7}/trustgraph_cli.egg-info/top_level.txt +0 -1
  73. trustgraph-cli-0.21.0/PKG-INFO +0 -15
  74. trustgraph-cli-0.21.0/scripts/tg-init-pulsar +0 -119
  75. trustgraph-cli-0.21.0/scripts/tg-load-kg-core +0 -291
  76. trustgraph-cli-0.21.0/scripts/tg-load-turtle +0 -160
  77. trustgraph-cli-0.21.0/scripts/tg-processor-state +0 -59
  78. trustgraph-cli-0.21.0/scripts/tg-save-kg-core +0 -250
  79. trustgraph-cli-0.21.0/setup.py +0 -66
  80. trustgraph-cli-0.21.0/trustgraph/cli_version.py +0 -1
  81. trustgraph-cli-0.21.0/trustgraph_cli.egg-info/PKG-INFO +0 -15
  82. trustgraph-cli-0.21.0/trustgraph_cli.egg-info/SOURCES.txt +0 -26
  83. {trustgraph-cli-0.21.0 → trustgraph_cli-1.5.7}/README.md +0 -0
  84. {trustgraph-cli-0.21.0 → trustgraph_cli-1.5.7}/setup.cfg +0 -0
  85. {trustgraph-cli-0.21.0 → trustgraph_cli-1.5.7}/trustgraph_cli.egg-info/dependency_links.txt +0 -0
@@ -0,0 +1,20 @@
1
+ Metadata-Version: 2.4
2
+ Name: trustgraph-cli
3
+ Version: 1.5.7
4
+ Summary: TrustGraph provides a means to run a pipeline of flexible AI processing components in a flexible means to achieve a processing pipeline.
5
+ Author-email: "trustgraph.ai" <security@trustgraph.ai>
6
+ Project-URL: Homepage, https://github.com/trustgraph-ai/trustgraph
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Operating System :: OS Independent
9
+ Requires-Python: >=3.8
10
+ Description-Content-Type: text/markdown
11
+ Requires-Dist: trustgraph-base<1.6,>=1.5
12
+ Requires-Dist: requests
13
+ Requires-Dist: pulsar-client
14
+ Requires-Dist: aiohttp
15
+ Requires-Dist: rdflib
16
+ Requires-Dist: tabulate
17
+ Requires-Dist: msgpack
18
+ Requires-Dist: websockets
19
+
20
+ See https://trustgraph.ai/
@@ -0,0 +1,98 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "trustgraph-cli"
7
+ dynamic = ["version"]
8
+ authors = [{name = "trustgraph.ai", email = "security@trustgraph.ai"}]
9
+ description = "TrustGraph provides a means to run a pipeline of flexible AI processing components in a flexible means to achieve a processing pipeline."
10
+ readme = "README.md"
11
+ requires-python = ">=3.8"
12
+ dependencies = [
13
+ "trustgraph-base>=1.5,<1.6",
14
+ "requests",
15
+ "pulsar-client",
16
+ "aiohttp",
17
+ "rdflib",
18
+ "tabulate",
19
+ "msgpack",
20
+ "websockets",
21
+ ]
22
+ classifiers = [
23
+ "Programming Language :: Python :: 3",
24
+ "Operating System :: OS Independent",
25
+ ]
26
+
27
+ [project.urls]
28
+ Homepage = "https://github.com/trustgraph-ai/trustgraph"
29
+
30
+ [project.scripts]
31
+ tg-add-library-document = "trustgraph.cli.add_library_document:main"
32
+ tg-delete-flow-class = "trustgraph.cli.delete_flow_class:main"
33
+ tg-delete-mcp-tool = "trustgraph.cli.delete_mcp_tool:main"
34
+ tg-delete-kg-core = "trustgraph.cli.delete_kg_core:main"
35
+ tg-delete-tool = "trustgraph.cli.delete_tool:main"
36
+ tg-dump-msgpack = "trustgraph.cli.dump_msgpack:main"
37
+ tg-get-flow-class = "trustgraph.cli.get_flow_class:main"
38
+ tg-get-kg-core = "trustgraph.cli.get_kg_core:main"
39
+ tg-graph-to-turtle = "trustgraph.cli.graph_to_turtle:main"
40
+ tg-init-trustgraph = "trustgraph.cli.init_trustgraph:main"
41
+ tg-invoke-agent = "trustgraph.cli.invoke_agent:main"
42
+ tg-invoke-document-rag = "trustgraph.cli.invoke_document_rag:main"
43
+ tg-invoke-graph-rag = "trustgraph.cli.invoke_graph_rag:main"
44
+ tg-invoke-llm = "trustgraph.cli.invoke_llm:main"
45
+ tg-invoke-mcp-tool = "trustgraph.cli.invoke_mcp_tool:main"
46
+ tg-invoke-nlp-query = "trustgraph.cli.invoke_nlp_query:main"
47
+ tg-invoke-objects-query = "trustgraph.cli.invoke_objects_query:main"
48
+ tg-invoke-prompt = "trustgraph.cli.invoke_prompt:main"
49
+ tg-invoke-structured-query = "trustgraph.cli.invoke_structured_query:main"
50
+ tg-load-doc-embeds = "trustgraph.cli.load_doc_embeds:main"
51
+ tg-load-kg-core = "trustgraph.cli.load_kg_core:main"
52
+ tg-load-pdf = "trustgraph.cli.load_pdf:main"
53
+ tg-load-sample-documents = "trustgraph.cli.load_sample_documents:main"
54
+ tg-load-text = "trustgraph.cli.load_text:main"
55
+ tg-load-turtle = "trustgraph.cli.load_turtle:main"
56
+ tg-load-knowledge = "trustgraph.cli.load_knowledge:main"
57
+ tg-load-structured-data = "trustgraph.cli.load_structured_data:main"
58
+ tg-put-flow-class = "trustgraph.cli.put_flow_class:main"
59
+ tg-put-kg-core = "trustgraph.cli.put_kg_core:main"
60
+ tg-remove-library-document = "trustgraph.cli.remove_library_document:main"
61
+ tg-save-doc-embeds = "trustgraph.cli.save_doc_embeds:main"
62
+ tg-set-mcp-tool = "trustgraph.cli.set_mcp_tool:main"
63
+ tg-set-prompt = "trustgraph.cli.set_prompt:main"
64
+ tg-set-token-costs = "trustgraph.cli.set_token_costs:main"
65
+ tg-set-tool = "trustgraph.cli.set_tool:main"
66
+ tg-show-config = "trustgraph.cli.show_config:main"
67
+ tg-show-flow-classes = "trustgraph.cli.show_flow_classes:main"
68
+ tg-show-flow-state = "trustgraph.cli.show_flow_state:main"
69
+ tg-show-flows = "trustgraph.cli.show_flows:main"
70
+ tg-show-graph = "trustgraph.cli.show_graph:main"
71
+ tg-show-kg-cores = "trustgraph.cli.show_kg_cores:main"
72
+ tg-show-library-documents = "trustgraph.cli.show_library_documents:main"
73
+ tg-show-library-processing = "trustgraph.cli.show_library_processing:main"
74
+ tg-show-mcp-tools = "trustgraph.cli.show_mcp_tools:main"
75
+ tg-show-parameter-types = "trustgraph.cli.show_parameter_types:main"
76
+ tg-show-processor-state = "trustgraph.cli.show_processor_state:main"
77
+ tg-show-prompts = "trustgraph.cli.show_prompts:main"
78
+ tg-show-token-costs = "trustgraph.cli.show_token_costs:main"
79
+ tg-show-token-rate = "trustgraph.cli.show_token_rate:main"
80
+ tg-show-tools = "trustgraph.cli.show_tools:main"
81
+ tg-start-flow = "trustgraph.cli.start_flow:main"
82
+ tg-unload-kg-core = "trustgraph.cli.unload_kg_core:main"
83
+ tg-start-library-processing = "trustgraph.cli.start_library_processing:main"
84
+ tg-stop-flow = "trustgraph.cli.stop_flow:main"
85
+ tg-stop-library-processing = "trustgraph.cli.stop_library_processing:main"
86
+ tg-list-config-items = "trustgraph.cli.list_config_items:main"
87
+ tg-get-config-item = "trustgraph.cli.get_config_item:main"
88
+ tg-put-config-item = "trustgraph.cli.put_config_item:main"
89
+ tg-delete-config-item = "trustgraph.cli.delete_config_item:main"
90
+ tg-list-collections = "trustgraph.cli.list_collections:main"
91
+ tg-set-collection = "trustgraph.cli.set_collection:main"
92
+ tg-delete-collection = "trustgraph.cli.delete_collection:main"
93
+
94
+ [tool.setuptools.packages.find]
95
+ include = ["trustgraph*"]
96
+
97
+ [tool.setuptools.dynamic]
98
+ version = {attr = "trustgraph.cli_version.__version__"}
@@ -0,0 +1 @@
1
+ # TrustGraph CLI modules
@@ -0,0 +1,204 @@
1
+ """
2
+ Loads a document into the library
3
+ """
4
+
5
+ import hashlib
6
+ import argparse
7
+ import os
8
+ import time
9
+ import uuid
10
+
11
+ from trustgraph.api import Api
12
+ from trustgraph.knowledge import hash, to_uri
13
+ from trustgraph.knowledge import PREF_PUBEV, PREF_DOC, PREF_ORG
14
+ from trustgraph.knowledge import Organization, PublicationEvent
15
+ from trustgraph.knowledge import DigitalDocument
16
+
17
+ default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8088/')
18
+ default_user = 'trustgraph'
19
+
20
+ class Loader:
21
+
22
+ def __init__(
23
+ self, id, url, user, metadata, title, comments, kind, tags
24
+ ):
25
+
26
+ self.api = Api(url).library()
27
+
28
+ self.user = user
29
+ self.metadata = metadata
30
+ self.title = title
31
+ self.comments = comments
32
+ self.kind = kind
33
+ self.identifier = id
34
+
35
+ if tags:
36
+ self.tags = tags.split(",")
37
+ else:
38
+ self.tags = []
39
+
40
+ def load(self, files):
41
+
42
+ for file in files:
43
+ self.load_file(file)
44
+
45
+ def load_file(self, file):
46
+
47
+ try:
48
+
49
+ path = file
50
+ data = open(path, "rb").read()
51
+
52
+ # Create a SHA256 hash from the data
53
+ if self.identifier:
54
+ id = self.identifier
55
+ else:
56
+ id = hash(data)
57
+ id = to_uri(PREF_DOC, id)
58
+
59
+
60
+ self.metadata.id = id
61
+
62
+ self.api.add_document(
63
+ document=data, id=id, metadata=self.metadata,
64
+ user=self.user, kind=self.kind, title=self.title,
65
+ comments=self.comments, tags=self.tags
66
+ )
67
+
68
+ print(f"{file}: Loaded successfully.")
69
+
70
+ except Exception as e:
71
+ print(f"{file}: Failed: {str(e)}", flush=True)
72
+ raise e
73
+
74
+ def main():
75
+
76
+ parser = argparse.ArgumentParser(
77
+ prog='tg-add-library-document',
78
+ description=__doc__,
79
+ )
80
+
81
+ parser.add_argument(
82
+ '-u', '--url',
83
+ default=default_url,
84
+ help=f'API URL (default: {default_url})',
85
+ )
86
+
87
+ parser.add_argument(
88
+ '-U', '--user',
89
+ default=default_user,
90
+ help=f'User ID (default: {default_user})'
91
+ )
92
+
93
+ parser.add_argument(
94
+ '--name', help=f'Document name'
95
+ )
96
+
97
+ parser.add_argument(
98
+ '--description', help=f'Document description'
99
+ )
100
+
101
+ parser.add_argument(
102
+ '--copyright-notice', help=f'Copyright notice'
103
+ )
104
+
105
+ parser.add_argument(
106
+ '--copyright-holder', help=f'Copyright holder'
107
+ )
108
+
109
+ parser.add_argument(
110
+ '--copyright-year', help=f'Copyright year'
111
+ )
112
+
113
+ parser.add_argument(
114
+ '--license', help=f'Copyright license'
115
+ )
116
+
117
+ parser.add_argument(
118
+ '--publication-organization', help=f'Publication organization'
119
+ )
120
+
121
+ parser.add_argument(
122
+ '--publication-description', help=f'Publication description'
123
+ )
124
+
125
+ parser.add_argument(
126
+ '--publication-date', help=f'Publication date'
127
+ )
128
+
129
+ parser.add_argument(
130
+ '--document-url', help=f'Document URL'
131
+ )
132
+
133
+ parser.add_argument(
134
+ '--keyword', nargs='+', help=f'Keyword'
135
+ )
136
+
137
+ parser.add_argument(
138
+ '--identifier', '--id', help=f'Document ID'
139
+ )
140
+
141
+ parser.add_argument(
142
+ '-k', '--kind',
143
+ required=True,
144
+ help=f'Document MIME type'
145
+ )
146
+
147
+ parser.add_argument(
148
+ '--tags',
149
+ help=f'Tags, command separated'
150
+ )
151
+
152
+ parser.add_argument(
153
+ 'files', nargs='+',
154
+ help=f'File to load'
155
+ )
156
+
157
+ args = parser.parse_args()
158
+
159
+ try:
160
+
161
+ document = DigitalDocument(
162
+ args.identifier,
163
+ name=args.name,
164
+ description=args.description,
165
+ copyright_notice=args.copyright_notice,
166
+ copyright_holder=args.copyright_holder,
167
+ copyright_year=args.copyright_year,
168
+ license=args.license,
169
+ url=args.document_url,
170
+ keywords=args.keyword,
171
+ )
172
+
173
+ if args.publication_organization:
174
+ org = Organization(
175
+ id=to_uri(PREF_ORG, hash(args.publication_organization)),
176
+ name=args.publication_organization,
177
+ )
178
+ document.publication = PublicationEvent(
179
+ id = to_uri(PREF_PUBEV, str(uuid.uuid4())),
180
+ organization=org,
181
+ description=args.publication_description,
182
+ start_date=args.publication_date,
183
+ end_date=args.publication_date,
184
+ )
185
+
186
+ p = Loader(
187
+ id=args.identifier,
188
+ url=args.url,
189
+ user=args.user,
190
+ metadata=document,
191
+ title=args.name,
192
+ comments=args.description,
193
+ kind=args.kind,
194
+ tags=args.tags,
195
+ )
196
+
197
+ p.load(args.files)
198
+
199
+ except Exception as e:
200
+
201
+ print("Exception:", e, flush=True)
202
+
203
+ if __name__ == "__main__":
204
+ main()
@@ -0,0 +1,72 @@
1
+ """
2
+ Delete a collection and all its data
3
+ """
4
+
5
+ import argparse
6
+ import os
7
+ from trustgraph.api import Api
8
+
9
+ default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8088/')
10
+ default_user = "trustgraph"
11
+
12
+ def delete_collection(url, user, collection, confirm):
13
+
14
+ if not confirm:
15
+ response = input(f"Are you sure you want to delete collection '{collection}' and all its data? (y/N): ")
16
+ if response.lower() not in ['y', 'yes']:
17
+ print("Operation cancelled.")
18
+ return
19
+
20
+ api = Api(url).collection()
21
+
22
+ api.delete_collection(user=user, collection=collection)
23
+
24
+ print(f"Collection '{collection}' deleted successfully.")
25
+
26
+ def main():
27
+
28
+ parser = argparse.ArgumentParser(
29
+ prog='tg-delete-collection',
30
+ description=__doc__,
31
+ )
32
+
33
+ parser.add_argument(
34
+ 'collection',
35
+ help='Collection ID to delete'
36
+ )
37
+
38
+ parser.add_argument(
39
+ '-u', '--api-url',
40
+ default=default_url,
41
+ help=f'API URL (default: {default_url})',
42
+ )
43
+
44
+ parser.add_argument(
45
+ '-U', '--user',
46
+ default=default_user,
47
+ help=f'User ID (default: {default_user})'
48
+ )
49
+
50
+ parser.add_argument(
51
+ '-y', '--yes',
52
+ action='store_true',
53
+ help='Skip confirmation prompt'
54
+ )
55
+
56
+ args = parser.parse_args()
57
+
58
+ try:
59
+
60
+ delete_collection(
61
+ url = args.api_url,
62
+ user = args.user,
63
+ collection = args.collection,
64
+ confirm = args.yes
65
+ )
66
+
67
+ except Exception as e:
68
+
69
+ print("Exception:", e, flush=True)
70
+
71
+ if __name__ == "__main__":
72
+ main()
@@ -0,0 +1,61 @@
1
+ """
2
+ Deletes a configuration item
3
+ """
4
+
5
+ import argparse
6
+ import os
7
+ from trustgraph.api import Api
8
+ from trustgraph.api.types import ConfigKey
9
+
10
+ default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8088/')
11
+
12
+ def delete_config_item(url, config_type, key):
13
+
14
+ api = Api(url).config()
15
+
16
+ config_key = ConfigKey(type=config_type, key=key)
17
+ api.delete([config_key])
18
+
19
+ print(f"Configuration item deleted: {config_type}/{key}")
20
+
21
+ def main():
22
+
23
+ parser = argparse.ArgumentParser(
24
+ prog='tg-delete-config-item',
25
+ description=__doc__,
26
+ )
27
+
28
+ parser.add_argument(
29
+ '--type',
30
+ required=True,
31
+ help='Configuration type',
32
+ )
33
+
34
+ parser.add_argument(
35
+ '--key',
36
+ required=True,
37
+ help='Configuration key',
38
+ )
39
+
40
+ parser.add_argument(
41
+ '-u', '--api-url',
42
+ default=default_url,
43
+ help=f'API URL (default: {default_url})',
44
+ )
45
+
46
+ args = parser.parse_args()
47
+
48
+ try:
49
+
50
+ delete_config_item(
51
+ url=args.api_url,
52
+ config_type=args.type,
53
+ key=args.key,
54
+ )
55
+
56
+ except Exception as e:
57
+
58
+ print("Exception:", e, flush=True)
59
+
60
+ if __name__ == "__main__":
61
+ main()
@@ -0,0 +1,51 @@
1
+ """
2
+ Deletes a flow class
3
+ """
4
+
5
+ import argparse
6
+ import os
7
+ import tabulate
8
+ from trustgraph.api import Api
9
+ import json
10
+
11
+ default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8088/')
12
+
13
+ def delete_flow_class(url, class_name):
14
+
15
+ api = Api(url).flow()
16
+
17
+ class_names = api.delete_class(class_name)
18
+
19
+ def main():
20
+
21
+ parser = argparse.ArgumentParser(
22
+ prog='tg-delete-flow-class',
23
+ description=__doc__,
24
+ )
25
+
26
+ parser.add_argument(
27
+ '-u', '--api-url',
28
+ default=default_url,
29
+ help=f'API URL (default: {default_url})',
30
+ )
31
+
32
+ parser.add_argument(
33
+ '-n', '--class-name',
34
+ help=f'Flow class name',
35
+ )
36
+
37
+ args = parser.parse_args()
38
+
39
+ try:
40
+
41
+ delete_flow_class(
42
+ url=args.api_url,
43
+ class_name=args.class_name,
44
+ )
45
+
46
+ except Exception as e:
47
+
48
+ print("Exception:", e, flush=True)
49
+
50
+ if __name__ == "__main__":
51
+ main()
@@ -0,0 +1,59 @@
1
+ """
2
+ Deletes a flow class
3
+ """
4
+
5
+ import argparse
6
+ import os
7
+ import tabulate
8
+ from trustgraph.api import Api
9
+ import json
10
+
11
+ default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8088/')
12
+
13
+ def delete_kg_core(url, user, id):
14
+
15
+ api = Api(url).knowledge()
16
+
17
+ class_names = api.delete_kg_core(user = user, id = id)
18
+
19
+ def main():
20
+
21
+ parser = argparse.ArgumentParser(
22
+ prog='tg-delete-kg-core',
23
+ description=__doc__,
24
+ )
25
+
26
+ parser.add_argument(
27
+ '-u', '--api-url',
28
+ default=default_url,
29
+ help=f'API URL (default: {default_url})',
30
+ )
31
+
32
+ parser.add_argument(
33
+ '-U', '--user',
34
+ default="trustgraph",
35
+ help='API URL (default: trustgraph)',
36
+ )
37
+
38
+ parser.add_argument(
39
+ '--id', '--identifier',
40
+ required=True,
41
+ help=f'Knowledge core ID',
42
+ )
43
+
44
+ args = parser.parse_args()
45
+
46
+ try:
47
+
48
+ delete_kg_core(
49
+ url=args.api_url,
50
+ user=args.user,
51
+ id=args.id,
52
+ )
53
+
54
+ except Exception as e:
55
+
56
+ print("Exception:", e, flush=True)
57
+
58
+ if __name__ == "__main__":
59
+ main()
@@ -0,0 +1,93 @@
1
+ """
2
+ Deletes MCP (Model Control Protocol) tools from the TrustGraph system.
3
+ Removes MCP tool configurations by ID from the 'mcp' configuration group.
4
+ """
5
+
6
+ import argparse
7
+ import os
8
+ from trustgraph.api import Api, ConfigKey
9
+ import textwrap
10
+
11
+ default_url = os.getenv("TRUSTGRAPH_URL", 'http://localhost:8088/')
12
+
13
+ def delete_mcp_tool(
14
+ url : str,
15
+ id : str,
16
+ ):
17
+
18
+ api = Api(url).config()
19
+
20
+ # Check if the tool exists first
21
+ try:
22
+ values = api.get([
23
+ ConfigKey(type="mcp", key=id)
24
+ ])
25
+
26
+ if not values or not values[0].value:
27
+ print(f"MCP tool '{id}' not found.")
28
+ return False
29
+
30
+ except Exception as e:
31
+ print(f"MCP tool '{id}' not found.")
32
+ return False
33
+
34
+ # Delete the MCP tool configuration from the 'mcp' group
35
+ try:
36
+ api.delete([
37
+ ConfigKey(type="mcp", key=id)
38
+ ])
39
+
40
+ print(f"MCP tool '{id}' deleted successfully.")
41
+ return True
42
+
43
+ except Exception as e:
44
+ print(f"Error deleting MCP tool '{id}': {e}")
45
+ return False
46
+
47
+ def main():
48
+
49
+ parser = argparse.ArgumentParser(
50
+ prog='tg-delete-mcp-tool',
51
+ description=__doc__,
52
+ epilog=textwrap.dedent('''
53
+ This utility removes MCP tool configurations from the TrustGraph system.
54
+ Once deleted, the tool will no longer be available for use.
55
+
56
+ Examples:
57
+ %(prog)s --id weather
58
+ %(prog)s --id calculator
59
+ %(prog)s --api-url http://localhost:9000/ --id file-reader
60
+ ''').strip(),
61
+ formatter_class=argparse.RawDescriptionHelpFormatter
62
+ )
63
+
64
+ parser.add_argument(
65
+ '-u', '--api-url',
66
+ default=default_url,
67
+ help=f'API URL (default: {default_url})',
68
+ )
69
+
70
+ parser.add_argument(
71
+ '--id',
72
+ required=True,
73
+ help='MCP tool ID to delete',
74
+ )
75
+
76
+ args = parser.parse_args()
77
+
78
+ try:
79
+
80
+ if not args.id:
81
+ raise RuntimeError("Must specify --id for MCP tool to delete")
82
+
83
+ delete_mcp_tool(
84
+ url=args.api_url,
85
+ id=args.id
86
+ )
87
+
88
+ except Exception as e:
89
+
90
+ print("Exception:", e, flush=True)
91
+
92
+ if __name__ == "__main__":
93
+ main()