* Bump setup.py versions for 1.1 * PoC MCP server (#419) * Very initial MCP server PoC for TrustGraph * Put service on port 8000 * Add MCP container and packages to buildout * Update docs for API/CLI changes in 1.0 (#421) * Update some API basics for the 0.23/1.0 API change * Add MCP container push (#425) * Add command args to the MCP server (#426) * Host and port parameters * Added websocket arg * More docs * MCP client support (#427) - MCP client service - Tool request/response schema - API gateway support for mcp-tool - Message translation for tool request & response - Make mcp-tool using configuration service for information about where the MCP services are. * Feature/react call mcp (#428) Key Features - MCP Tool Integration: Added core MCP tool support with ToolClientSpec and ToolClient classes - API Enhancement: New mcp_tool method for flow-specific tool invocation - CLI Tooling: New tg-invoke-mcp-tool command for testing MCP integration - React Agent Enhancement: Fixed and improved multi-tool invocation capabilities - Tool Management: Enhanced CLI for tool configuration and management Changes - Added MCP tool invocation to API with flow-specific integration - Implemented ToolClientSpec and ToolClient for tool call handling - Updated agent-manager-react to invoke MCP tools with configurable types - Enhanced CLI with new commands and improved help text - Added comprehensive documentation for new CLI commands - Improved tool configuration management Testing - Added tg-invoke-mcp-tool CLI command for isolated MCP integration testing - Enhanced agent capability to invoke multiple tools simultaneously * Test suite executed from CI pipeline (#433) * Test strategy & test cases * Unit tests * Integration tests * Extending test coverage (#434) * Contract tests * Testing embeedings * Agent unit tests * Knowledge pipeline tests * Turn on contract tests * Increase storage test coverage (#435) * Fixing storage and adding tests * PR pipeline only runs quick tests * Empty configuration is returned as empty list, previously was not in response (#436) * Update config util to take files as well as command-line text (#437) * 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 * Update Python deps to 1.2 * Update to enable knowledge extraction using the agent framework (#439) * Implement KG extraction agent (kg-extract-agent) * Using ReAct framework (agent-manager-react) * ReAct manager had an issue when emitting JSON, which conflicts which ReAct manager's own JSON messages, so refactored ReAct manager to use traditional ReAct messages, non-JSON structure. * Minor refactor to take the prompt template client out of prompt-template so it can be more readily used by other modules. kg-extract-agent uses this framework. * Migrate from setup.py to pyproject.toml (#440) * Converted setup.py to pyproject.toml * Modern package infrastructure as recommended by py docs * Install missing build deps (#441) * Install missing build deps (#442) * Implement logging strategy (#444) * Logging strategy and convert all prints() to logging invocations * Fix/startup failure (#445) * Fix loggin startup problems * Fix logging startup problems (#446) * Fix logging startup problems (#447) * Fixed Mistral OCR to use current API (#448) * Fixed Mistral OCR to use current API * Added PDF decoder tests * Fix Mistral OCR ident to be standard pdf-decoder (#450) * Fix Mistral OCR ident to be standard pdf-decoder * Correct test * Schema structure refactor (#451) * Write schema refactor spec * Implemented schema refactor spec * Structure data mvp (#452) * Structured data tech spec * Architecture principles * New schemas * Updated schemas and specs * Object extractor * Add .coveragerc * New tests * Cassandra object storage * Trying to object extraction working, issues exist * Validate librarian collection (#453) * Fix token chunker, broken API invocation (#454) * Fix token chunker, broken API invocation (#455) * Knowledge load utility CLI (#456) * Knowledge loader * More tests
7.3 KiB
tg-delete-tool
Synopsis
tg-delete-tool [OPTIONS] --id ID
Description
The tg-delete-tool command deletes tools from the TrustGraph system. It removes tool configurations by ID from the agent configuration and updates the tool index accordingly. Once deleted, tools are no longer available for agent use.
This command is useful for:
- Removing obsolete or deprecated tools
- Cleaning up tool configurations
- Managing tool registry maintenance
- Updating tool deployments by removing old versions
The command removes both the tool from the tool index and deletes the complete tool configuration from the TrustGraph API.
Options
-
-u, --api-url URL- TrustGraph API URL for configuration management
- Default:
http://localhost:8088/(orTRUSTGRAPH_URLenvironment variable) - Should point to a running TrustGraph API instance
-
--id ID- Required. Tool ID to delete
- Must match an existing tool ID in the registry
- Tool will be completely removed from the system
-
-h, --help- Show help message and exit
Examples
Basic Tool Deletion
Delete a weather tool:
tg-delete-tool --id weather
Calculator Tool Deletion
Delete a calculator tool:
tg-delete-tool --id calculator
Custom API URL
Delete a tool from a specific TrustGraph instance:
tg-delete-tool --api-url http://trustgraph.example.com:8088/ --id custom-tool
Batch Tool Deletion
Delete multiple tools in a script:
#!/bin/bash
# Delete obsolete tools
tg-delete-tool --id old-search
tg-delete-tool --id deprecated-calc
tg-delete-tool --id unused-tool
Conditional Deletion
Delete a tool only if it exists:
#!/bin/bash
# Check if tool exists before deletion
if tg-show-tools | grep -q "test-tool"; then
tg-delete-tool --id test-tool
echo "Tool deleted"
else
echo "Tool not found"
fi
Deletion Process
The deletion process involves two steps:
- Index Update: Remove the tool ID from the tool index
- Configuration Removal: Delete the tool configuration data
Both operations must succeed for the deletion to be complete.
Error Handling
The command handles various error conditions:
- Tool not found: If the specified tool ID doesn't exist
- Missing configuration: If tool is in index but configuration is missing
- API connection errors: If the TrustGraph API is unavailable
- Partial deletion: If index update or configuration removal fails
Common error scenarios:
# Tool not found
tg-delete-tool --id nonexistent-tool
# Output: Tool 'nonexistent-tool' not found in tool index.
# Missing required field
tg-delete-tool
# Output: Exception: Must specify --id for tool to delete
# API connection error
tg-delete-tool --api-url http://invalid-host:8088/ --id tool1
# Output: Exception: [Connection error details]
Verification
The command provides feedback on the deletion process:
- Success:
Tool 'tool-id' deleted successfully. - Not found:
Tool 'tool-id' not found in tool index. - Configuration missing:
Tool configuration for 'tool-id' not found. - Error:
Error deleting tool 'tool-id': [error details]
Advanced Usage
Safe Deletion with Verification
Verify tool exists before deletion:
#!/bin/bash
TOOL_ID="weather"
# Check if tool exists
if tg-show-tools | grep -q "^$TOOL_ID:"; then
echo "Deleting tool: $TOOL_ID"
tg-delete-tool --id "$TOOL_ID"
# Verify deletion
if ! tg-show-tools | grep -q "^$TOOL_ID:"; then
echo "Tool successfully deleted"
else
echo "Tool deletion failed"
fi
else
echo "Tool $TOOL_ID not found"
fi
Backup Before Deletion
Backup tool configuration before deletion:
#!/bin/bash
TOOL_ID="important-tool"
# Export tool configuration
echo "Backing up tool configuration..."
tg-show-tools | grep -A 20 "^$TOOL_ID:" > "${TOOL_ID}_backup.txt"
# Delete tool
echo "Deleting tool..."
tg-delete-tool --id "$TOOL_ID"
echo "Tool deleted, backup saved to ${TOOL_ID}_backup.txt"
Cleanup Script
Clean up multiple tools based on patterns:
#!/bin/bash
# Delete all test tools
echo "Cleaning up test tools..."
# Get list of test tools
TEST_TOOLS=$(tg-show-tools | grep "^test-" | cut -d: -f1)
for tool in $TEST_TOOLS; do
echo "Deleting $tool..."
tg-delete-tool --id "$tool"
done
echo "Cleanup complete"
Environment-Specific Deletion
Delete tools from specific environments:
#!/bin/bash
# Delete development tools from production
export TRUSTGRAPH_URL="http://prod.trustgraph.com:8088/"
DEV_TOOLS=("dev-tool" "debug-tool" "test-helper")
for tool in "${DEV_TOOLS[@]}"; do
echo "Removing development tool: $tool"
tg-delete-tool --id "$tool"
done
Integration with Other Commands
With Tool Management
List and delete tools:
# List all tools
tg-show-tools
# Delete specific tool
tg-delete-tool --id unwanted-tool
# Verify deletion
tg-show-tools | grep unwanted-tool
With Configuration Management
Manage tool configurations:
# View current configuration
tg-show-config
# Delete tool
tg-delete-tool --id old-tool
# View updated configuration
tg-show-config
With Agent Workflows
Ensure agents don't use deleted tools:
# Delete tool
tg-delete-tool --id deprecated-tool
# Check agent configuration
tg-show-config | grep deprecated-tool
Best Practices
- Verification: Always verify tool exists before deletion
- Backup: Backup important tool configurations before deletion
- Dependencies: Check for tool dependencies before deletion
- Testing: Test system functionality after tool deletion
- Documentation: Document reasons for tool deletion
- Gradual Removal: Remove tools gradually in production environments
- Monitoring: Monitor for errors after tool deletion
Troubleshooting
Tool Not Found
If tool deletion reports "not found":
- Verify the tool ID is correct
- Check tool exists with
tg-show-tools - Ensure you're connected to the correct TrustGraph instance
- Check for case sensitivity in tool ID
Partial Deletion
If deletion partially fails:
- Check TrustGraph API connectivity
- Verify API permissions
- Check for configuration corruption
- Retry the deletion operation
- Manual cleanup may be required
Permission Errors
If deletion fails due to permissions:
- Verify API access credentials
- Check TrustGraph API permissions
- Ensure proper authentication
- Contact system administrator if needed
Recovery
Restore Deleted Tool
If a tool was accidentally deleted:
- Use backup configuration if available
- Re-register the tool with
tg-set-tool - Restore from version control if tool definitions are tracked
- Contact system administrator for recovery options
Verify System State
After deletion, verify system state:
# Check tool index consistency
tg-show-tools
# Verify no orphaned configurations
tg-show-config | grep "tool\."
# Test agent functionality
tg-invoke-agent --prompt "Test prompt"
Related Commands
tg-show-tools- Display registered toolstg-set-tool- Configure and register toolstg-delete-mcp-tool- Delete MCP toolstg-show-config- View system configuration
See Also
- TrustGraph Tool Management Guide
- Agent Configuration Documentation
- System Administration Manual