mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-04-27 09:26:22 +02:00
Updated CLI invocation and config model for tools and mcp (#438)
* Updated CLI invocation and config model for tools and mcp * CLI anomalies * Tweaked the MCP tool implementation for new model * Update agent implementation to match the new model * Fix agent tools, now all tested * Fixed integration tests * Fix MCP delete tool params
This commit is contained in:
parent
a96d02da5d
commit
81c7c1181b
11 changed files with 270 additions and 183 deletions
|
|
@ -1,7 +1,13 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
"""
|
||||
Dumps out the current agent tool configuration
|
||||
Displays the current agent tool configurations
|
||||
|
||||
Shows all configured tools including their types:
|
||||
- knowledge-query: Tools that query knowledge bases
|
||||
- text-completion: Tools for text generation
|
||||
- mcp-tool: References to MCP (Model Context Protocol) tools
|
||||
- prompt: Tools that execute prompt templates
|
||||
"""
|
||||
|
||||
import argparse
|
||||
|
|
@ -17,37 +23,37 @@ def show_config(url):
|
|||
|
||||
api = Api(url).config()
|
||||
|
||||
values = api.get([
|
||||
ConfigKey(type="agent", key="tool-index")
|
||||
])
|
||||
values = api.get_values(type="tool")
|
||||
|
||||
ix = json.loads(values[0].value)
|
||||
for item in values:
|
||||
|
||||
values = api.get([
|
||||
ConfigKey(type="agent", key=f"tool.{v}")
|
||||
for v in ix
|
||||
])
|
||||
id = item.key
|
||||
data = json.loads(item.value)
|
||||
|
||||
for n, key in enumerate(ix):
|
||||
|
||||
data = json.loads(values[n].value)
|
||||
tp = data["type"]
|
||||
|
||||
table = []
|
||||
|
||||
table.append(("id", data["id"]))
|
||||
table.append(("id", id))
|
||||
table.append(("name", data["name"]))
|
||||
table.append(("description", data["description"]))
|
||||
table.append(("type", data["type"]))
|
||||
table.append(("type", tp))
|
||||
|
||||
for n, arg in enumerate(data["arguments"]):
|
||||
table.append((
|
||||
f"arg {n}",
|
||||
f"{arg['name']}: {arg['type']}\n{arg['description']}"
|
||||
))
|
||||
|
||||
if tp == "mcp-tool":
|
||||
table.append(("mcp-tool", data["mcp-tool"]))
|
||||
|
||||
if tp == "knowledge-query":
|
||||
table.append(("collection", data["collection"]))
|
||||
|
||||
if tp == "prompt":
|
||||
table.append(("template", data["template"]))
|
||||
for n, arg in enumerate(data["arguments"]):
|
||||
table.append((
|
||||
f"arg {n}",
|
||||
f"{arg['name']}: {arg['type']}\n{arg['description']}"
|
||||
))
|
||||
|
||||
print()
|
||||
print(key + ":")
|
||||
|
||||
print(tabulate.tabulate(
|
||||
table,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue