mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-22 19:51:02 +02:00
CLI anomalies
This commit is contained in:
parent
6c2a1824f5
commit
dad23e21b6
5 changed files with 44 additions and 25 deletions
|
|
@ -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.")
|
||||
|
|
|
|||
27
trustgraph-cli/scripts/tg-set-mcp-tool
Normal file → Executable file
27
trustgraph-cli/scripts/tg-set-mcp-tool
Normal file → Executable file
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue