From 857bbed552450c357081c69f5a4656c1d9c477cf Mon Sep 17 00:00:00 2001 From: Cyber MacGeddon Date: Mon, 23 Feb 2026 19:59:57 +0000 Subject: [PATCH] Add new agent tool to CLI --- trustgraph-cli/trustgraph/cli/set_tool.py | 59 +++++++++++++++------ trustgraph-cli/trustgraph/cli/show_tools.py | 13 +++-- 2 files changed, 53 insertions(+), 19 deletions(-) diff --git a/trustgraph-cli/trustgraph/cli/set_tool.py b/trustgraph-cli/trustgraph/cli/set_tool.py index 36701a8e..a647d49d 100644 --- a/trustgraph-cli/trustgraph/cli/set_tool.py +++ b/trustgraph-cli/trustgraph/cli/set_tool.py @@ -2,8 +2,9 @@ Configures and registers tools in the TrustGraph system. This script allows you to define agent tools with various types including: -- knowledge-query: Query knowledge bases +- knowledge-query: Query knowledge bases - structured-query: Query structured data using natural language +- row-embeddings-query: Semantic search on structured data indexes - text-completion: Text generation - mcp-tool: Reference to MCP (Model Context Protocol) tools - prompt: Prompt template execution @@ -64,6 +65,8 @@ def set_tool( mcp_tool : str, collection : str, template : str, + schema_name : str, + index_name : str, arguments : List[Argument], group : List[str], state : str, @@ -89,6 +92,10 @@ def set_tool( if template: object["template"] = template + if schema_name: object["schema-name"] = schema_name + + if index_name: object["index-name"] = index_name + if arguments: object["arguments"] = [ { @@ -120,30 +127,37 @@ def main(): description=__doc__, epilog=textwrap.dedent(''' Valid tool types: - knowledge-query - Query knowledge bases (fixed args) - structured-query - Query structured data using natural language (fixed args) - text-completion - Text completion/generation (fixed args) - mcp-tool - Model Control Protocol tool (configurable args) - prompt - Prompt template query (configurable args) - - Note: Tools marked "(fixed args)" have predefined arguments and don't need + knowledge-query - Query knowledge bases (fixed args) + structured-query - Query structured data using natural language (fixed args) + row-embeddings-query - Semantic search on structured data indexes (fixed args) + text-completion - Text completion/generation (fixed args) + mcp-tool - Model Control Protocol tool (configurable args) + prompt - Prompt template query (configurable args) + + Note: Tools marked "(fixed args)" have predefined arguments and don't need --argument specified. Tools marked "(configurable args)" require --argument. - + Valid argument types: - string - String/text parameter + string - String/text parameter number - Numeric parameter - + Examples: %(prog)s --id weather_tool --name get_weather \\ --type knowledge-query \\ --description "Get weather information for a location" \\ --collection weather_data - + %(prog)s --id data_query_tool --name query_data \\ --type structured-query \\ --description "Query structured data using natural language" \\ --collection sales_data - + + %(prog)s --id customer_search --name find_customer \\ + --type row-embeddings-query \\ + --description "Find customers by name using semantic search" \\ + --schema-name customers --collection sales \\ + --index-name full_name + %(prog)s --id calc_tool --name calculate --type mcp-tool \\ --description "Perform mathematical calculations" \\ --mcp-tool calculator \\ @@ -181,7 +195,7 @@ def main(): parser.add_argument( '--type', - help=f'Tool type, one of: knowledge-query, structured-query, text-completion, mcp-tool, prompt', + help=f'Tool type, one of: knowledge-query, structured-query, row-embeddings-query, text-completion, mcp-tool, prompt', ) parser.add_argument( @@ -191,7 +205,17 @@ def main(): parser.add_argument( '--collection', - help=f'For knowledge-query and structured-query types: collection to query', + help=f'For knowledge-query, structured-query, and row-embeddings-query types: collection to query', + ) + + parser.add_argument( + '--schema-name', + help=f'For row-embeddings-query type: schema name to search within (required)', + ) + + parser.add_argument( + '--index-name', + help=f'For row-embeddings-query type: specific index to filter search (optional)', ) parser.add_argument( @@ -227,7 +251,8 @@ def main(): try: valid_types = [ - "knowledge-query", "structured-query", "text-completion", "mcp-tool", "prompt" + "knowledge-query", "structured-query", "row-embeddings-query", + "text-completion", "mcp-tool", "prompt" ] if args.id is None: @@ -261,6 +286,8 @@ def main(): mcp_tool=mcp_tool, collection=args.collection, template=args.template, + schema_name=args.schema_name, + index_name=args.index_name, arguments=arguments, group=args.group, state=args.state, diff --git a/trustgraph-cli/trustgraph/cli/show_tools.py b/trustgraph-cli/trustgraph/cli/show_tools.py index b8c9a012..42c79959 100644 --- a/trustgraph-cli/trustgraph/cli/show_tools.py +++ b/trustgraph-cli/trustgraph/cli/show_tools.py @@ -4,8 +4,9 @@ Displays the current agent tool configurations Shows all configured tools including their types: - knowledge-query: Tools that query knowledge bases - structured-query: Tools that query structured data using natural language +- row-embeddings-query: Tools for semantic search on structured data indexes - text-completion: Tools for text generation -- mcp-tool: References to MCP (Model Context Protocol) tools +- mcp-tool: References to MCP (Model Context Protocol) tools - prompt: Tools that execute prompt templates """ @@ -41,11 +42,17 @@ def show_config(url, token=None): if tp == "mcp-tool": table.append(("mcp-tool", data["mcp-tool"])) - - if tp == "knowledge-query" or tp == "structured-query": + + if tp in ("knowledge-query", "structured-query", "row-embeddings-query"): if "collection" in data: table.append(("collection", data["collection"])) + if tp == "row-embeddings-query": + if "schema-name" in data: + table.append(("schema-name", data["schema-name"])) + if "index-name" in data: + table.append(("index-name", data["index-name"])) + if tp == "prompt": table.append(("template", data["template"])) for n, arg in enumerate(data["arguments"]):