From dad23e21b682074500f4de710fa0f8c9ee3e90cd Mon Sep 17 00:00:00 2001 From: Cyber MacGeddon Date: Wed, 16 Jul 2025 21:23:15 +0100 Subject: [PATCH] CLI anomalies --- trustgraph-cli/scripts/tg-delete-tool | 2 +- trustgraph-cli/scripts/tg-set-mcp-tool | 27 +++++++++++++-------- trustgraph-cli/scripts/tg-set-tool | 30 ++++++++++++++---------- trustgraph-cli/scripts/tg-show-mcp-tools | 2 +- trustgraph-cli/scripts/tg-show-tools | 8 ++++++- 5 files changed, 44 insertions(+), 25 deletions(-) mode change 100644 => 100755 trustgraph-cli/scripts/tg-set-mcp-tool diff --git a/trustgraph-cli/scripts/tg-delete-tool b/trustgraph-cli/scripts/tg-delete-tool index bfdcd2f3..63b73815 100644 --- a/trustgraph-cli/scripts/tg-delete-tool +++ b/trustgraph-cli/scripts/tg-delete-tool @@ -40,7 +40,7 @@ def delete_tool( # Delete the tool configuration api.delete([ - ConfigKey(type="agent", key=id) + ConfigKey(type="tool", key=id) ]) print(f"Tool '{id}' deleted successfully.") diff --git a/trustgraph-cli/scripts/tg-set-mcp-tool b/trustgraph-cli/scripts/tg-set-mcp-tool old mode 100644 new mode 100755 index dfeecc55..26991d60 --- a/trustgraph-cli/scripts/tg-set-mcp-tool +++ b/trustgraph-cli/scripts/tg-set-mcp-tool @@ -1,10 +1,17 @@ #!/usr/bin/env python3 """ -Configures and registers MCP (Model Control Protocol) tools in the -TrustGraph system. Allows defining MCP tool configurations with name and -URL. Tools are stored in the 'mcp' configuration group for discovery and -execution. +Configures and registers MCP (Model Context Protocol) tools in the +TrustGraph system. + +MCP tools are external services that follow the Model Context Protocol +specification. This script stores MCP tool configurations with: +- id: Unique identifier for the tool +- remote-name: Name used by the MCP server (defaults to id) +- url: MCP server endpoint URL + +Configurations are stored in the 'mcp' configuration group and can be +referenced by agent tools using the 'mcp-tool' type. """ import argparse @@ -44,8 +51,8 @@ def main(): to the MCP server endpoint that provides the tool functionality. Examples: - %(prog)s --name weather --tool-url "http://localhost:3000/weather" - %(prog)s --name calculator --tool-url "http://mcp-tools.example.com/calc" + %(prog)s --id weather --tool-url "http://localhost:3000/weather" + %(prog)s --id calculator --tool-url "http://mcp-tools.example.com/calc" ''').strip(), formatter_class=argparse.RawDescriptionHelpFormatter ) @@ -59,13 +66,13 @@ def main(): parser.add_argument( '-i', '--id', required=True, - help='MCP tool name', + help='MCP tool identifier', ) parser.add_argument( '-r', '--remote-name', required=False, - help='MCP tool name', + help='Remote MCP tool name (defaults to --id if not specified)', ) parser.add_argument( @@ -79,10 +86,10 @@ def main(): try: if not args.id: - raise RuntimeError("Must specify --name for MCP tool") + raise RuntimeError("Must specify --id for MCP tool") if not args.tool_url: - raise RuntimeError("Must specify --url for MCP tool") + raise RuntimeError("Must specify --tool-url for MCP tool") if args.remote_name: remote_name = args.remote_name diff --git a/trustgraph-cli/scripts/tg-set-tool b/trustgraph-cli/scripts/tg-set-tool index 2883d3a0..a4c17527 100755 --- a/trustgraph-cli/scripts/tg-set-tool +++ b/trustgraph-cli/scripts/tg-set-tool @@ -2,9 +2,15 @@ """ Configures and registers tools in the TrustGraph system. -Allows defining tool metadata including ID, name, description, type, -and argument specifications. Tools are stored in the agent configuration -and indexed for discovery and execution. + +This script allows you to define agent tools with various types including: +- knowledge-query: Query knowledge bases +- text-completion: Text generation +- mcp-tool: Reference to MCP (Model Context Protocol) tools +- prompt: Prompt template execution + +Tools are stored in the 'tool' configuration group and can include +argument specifications for parameterized execution. """ from typing import List @@ -131,17 +137,17 @@ def main(): parser.add_argument( '--id', - help=f'Tool ID', + help=f'Unique tool identifier', ) parser.add_argument( '--name', - help=f'Tool name', + help=f'Human-readable tool name', ) parser.add_argument( '--description', - help=f'Tool description', + help=f'Detailed description of what the tool does', ) parser.add_argument( @@ -151,23 +157,23 @@ def main(): parser.add_argument( '--mcp-tool', - help=f'For MCP, ID of MCP tool, as defined in TrustGraph config', + help=f'For MCP type: ID of MCP tool configuration (as defined by tg-set-mcp-tool)', ) parser.add_argument( '--collection', - help=f'For knowledge query, collection to use', + help=f'For knowledge-query type: collection to query', ) parser.add_argument( '--template', - help=f'For prompt, template to use', + help=f'For prompt type: template ID to use', ) parser.add_argument( '--argument', nargs="*", - help=f'For prompts, arguments in the form: name:type:description', + help=f'Tool arguments in the form: name:type:description (can specify multiple)', ) args = parser.parse_args() @@ -179,10 +185,10 @@ def main(): ] if args.id is None: - raise RuntimeError("Must specify --id for prompt") + raise RuntimeError("Must specify --id for tool") if args.name is None: - raise RuntimeError("Must specify --name for prompt") + raise RuntimeError("Must specify --name for tool") if args.type: if args.type not in valid_types: diff --git a/trustgraph-cli/scripts/tg-show-mcp-tools b/trustgraph-cli/scripts/tg-show-mcp-tools index a62cf0ea..587aeee7 100755 --- a/trustgraph-cli/scripts/tg-show-mcp-tools +++ b/trustgraph-cli/scripts/tg-show-mcp-tools @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """ -Dumps out the current agent tool configuration +Displays the current MCP (Model Context Protocol) tool configuration """ import argparse diff --git a/trustgraph-cli/scripts/tg-show-tools b/trustgraph-cli/scripts/tg-show-tools index a72e0d10..fa48f2e1 100755 --- a/trustgraph-cli/scripts/tg-show-tools +++ b/trustgraph-cli/scripts/tg-show-tools @@ -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