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
9.1 KiB
tg-delete-mcp-tool
Synopsis
tg-delete-mcp-tool [OPTIONS] --name NAME
Description
The tg-delete-mcp-tool command deletes MCP (Model Control Protocol) tools from the TrustGraph system. It removes MCP tool configurations by name from the 'mcp' configuration group. Once deleted, MCP tools are no longer available for agent use.
This command is useful for:
- Removing obsolete or deprecated MCP tools
- Cleaning up MCP tool configurations
- Managing MCP tool registry maintenance
- Updating MCP tool deployments by removing old versions
The command removes MCP tool configurations from the 'mcp' configuration group in 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
-
--name NAME- Required. MCP tool name to delete
- Must match an existing MCP tool name in the registry
- MCP tool will be completely removed from the system
-
-h, --help- Show help message and exit
Examples
Basic MCP Tool Deletion
Delete a weather MCP tool:
tg-delete-mcp-tool --name weather
Calculator MCP Tool Deletion
Delete a calculator MCP tool:
tg-delete-mcp-tool --name calculator
Custom API URL
Delete an MCP tool from a specific TrustGraph instance:
tg-delete-mcp-tool --api-url http://trustgraph.example.com:8088/ --name custom-mcp
Batch MCP Tool Deletion
Delete multiple MCP tools in a script:
#!/bin/bash
# Delete obsolete MCP tools
tg-delete-mcp-tool --name old-search
tg-delete-mcp-tool --name deprecated-calc
tg-delete-mcp-tool --name unused-mcp
Conditional Deletion
Delete an MCP tool only if it exists:
#!/bin/bash
# Check if MCP tool exists before deletion
if tg-show-mcp-tools | grep -q "test-mcp"; then
tg-delete-mcp-tool --name test-mcp
echo "MCP tool deleted"
else
echo "MCP tool not found"
fi
Deletion Process
The deletion process involves:
- Existence Check: Verify the MCP tool exists in the configuration
- Configuration Removal: Delete the MCP tool configuration from the 'mcp' group
The command performs validation before deletion to ensure the tool exists.
Error Handling
The command handles various error conditions:
- Tool not found: If the specified MCP tool name doesn't exist
- API connection errors: If the TrustGraph API is unavailable
- Configuration errors: If the MCP tool configuration cannot be removed
Common error scenarios:
# MCP tool not found
tg-delete-mcp-tool --name nonexistent-mcp
# Output: MCP tool 'nonexistent-mcp' not found.
# Missing required field
tg-delete-mcp-tool
# Output: Exception: Must specify --name for MCP tool to delete
# API connection error
tg-delete-mcp-tool --api-url http://invalid-host:8088/ --name tool1
# Output: Exception: [Connection error details]
Verification
The command provides feedback on the deletion process:
- Success:
MCP tool 'tool-name' deleted successfully. - Not found:
MCP tool 'tool-name' not found. - Error:
Error deleting MCP tool 'tool-name': [error details]
Advanced Usage
Safe Deletion with Verification
Verify MCP tool exists before deletion:
#!/bin/bash
MCP_NAME="weather"
# Check if MCP tool exists
if tg-show-mcp-tools | grep -q "^$MCP_NAME"; then
echo "Deleting MCP tool: $MCP_NAME"
tg-delete-mcp-tool --name "$MCP_NAME"
# Verify deletion
if ! tg-show-mcp-tools | grep -q "^$MCP_NAME"; then
echo "MCP tool successfully deleted"
else
echo "MCP tool deletion failed"
fi
else
echo "MCP tool $MCP_NAME not found"
fi
Backup Before Deletion
Backup MCP tool configuration before deletion:
#!/bin/bash
MCP_NAME="important-mcp"
# Export MCP tool configuration
echo "Backing up MCP tool configuration..."
tg-show-mcp-tools | grep -A 10 "^$MCP_NAME" > "${MCP_NAME}_backup.txt"
# Delete MCP tool
echo "Deleting MCP tool..."
tg-delete-mcp-tool --name "$MCP_NAME"
echo "MCP tool deleted, backup saved to ${MCP_NAME}_backup.txt"
Cleanup Script
Clean up multiple MCP tools based on patterns:
#!/bin/bash
# Delete all test MCP tools
echo "Cleaning up test MCP tools..."
# Get list of test MCP tools
TEST_MCPS=$(tg-show-mcp-tools | grep "^test-" | cut -d: -f1)
for mcp in $TEST_MCPS; do
echo "Deleting $mcp..."
tg-delete-mcp-tool --name "$mcp"
done
echo "Cleanup complete"
Environment-Specific Deletion
Delete MCP tools from specific environments:
#!/bin/bash
# Delete development MCP tools from production
export TRUSTGRAPH_URL="http://prod.trustgraph.com:8088/"
DEV_MCPS=("dev-mcp" "debug-mcp" "test-helper")
for mcp in "${DEV_MCPS[@]}"; do
echo "Removing development MCP tool: $mcp"
tg-delete-mcp-tool --name "$mcp"
done
MCP Service Shutdown
Remove MCP tools when services are decommissioned:
#!/bin/bash
# Remove MCP tools for decommissioned service
SERVICE_NAME="old-service"
# Find MCP tools for this service
MCP_TOOLS=$(tg-show-mcp-tools | grep "$SERVICE_NAME" | cut -d: -f1)
for tool in $MCP_TOOLS; do
echo "Removing MCP tool for decommissioned service: $tool"
tg-delete-mcp-tool --name "$tool"
done
Integration with Other Commands
With MCP Tool Management
List and delete MCP tools:
# List all MCP tools
tg-show-mcp-tools
# Delete specific MCP tool
tg-delete-mcp-tool --name unwanted-mcp
# Verify deletion
tg-show-mcp-tools | grep unwanted-mcp
With Configuration Management
Manage MCP tool configurations:
# View current configuration
tg-show-config
# Delete MCP tool
tg-delete-mcp-tool --name old-mcp
# View updated configuration
tg-show-config
With MCP Tool Invocation
Ensure MCP tools can't be invoked after deletion:
# Delete MCP tool
tg-delete-mcp-tool --name deprecated-mcp
# Verify tool is no longer available
tg-invoke-mcp-tool --name deprecated-mcp
# Should fail with tool not found error
Best Practices
- Verification: Always verify MCP tool exists before deletion
- Backup: Backup important MCP tool configurations before deletion
- Dependencies: Check for MCP tool dependencies before deletion
- Service Coordination: Coordinate with MCP service owners before deletion
- Testing: Test system functionality after MCP tool deletion
- Documentation: Document reasons for MCP tool deletion
- Gradual Removal: Remove MCP tools gradually in production environments
- Monitoring: Monitor for errors after MCP tool deletion
Troubleshooting
MCP Tool Not Found
If MCP tool deletion reports "not found":
- Verify the MCP tool name is correct
- Check MCP tool exists with
tg-show-mcp-tools - Ensure you're connected to the correct TrustGraph instance
- Check for case sensitivity in MCP tool name
Deletion Errors
If deletion fails:
- Check TrustGraph API connectivity
- Verify API permissions
- Check for configuration corruption
- Retry the deletion operation
- Check MCP service status
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 MCP Tool
If an MCP tool was accidentally deleted:
- Use backup configuration if available
- Re-register the MCP tool with
tg-set-mcp-tool - Restore from version control if MCP tool definitions are tracked
- Contact system administrator for recovery options
Verify System State
After deletion, verify system state:
# Check MCP tool registry
tg-show-mcp-tools
# Verify no orphaned configurations
tg-show-config | grep "mcp\."
# Test MCP tool functionality
tg-invoke-mcp-tool --name remaining-tool
MCP Tool Lifecycle
Development to Production
Manage MCP tool lifecycle:
#!/bin/bash
# Promote MCP tool from dev to production
# Remove development version
tg-delete-mcp-tool --name dev-tool
# Add production version
tg-set-mcp-tool --name prod-tool --tool-url "http://prod.mcp.com/api"
Version Management
Manage MCP tool versions:
#!/bin/bash
# Update MCP tool to new version
# Remove old version
tg-delete-mcp-tool --name tool-v1
# Add new version
tg-set-mcp-tool --name tool-v2 --tool-url "http://new.mcp.com/api"
Security Considerations
When deleting MCP tools:
- Access Control: Ensure proper authorization for deletion
- Audit Trail: Log MCP tool deletions for security auditing
- Impact Assessment: Assess security impact of tool removal
- Credential Cleanup: Remove associated credentials if applicable
- Network Security: Update firewall rules if MCP endpoints are no longer needed
Related Commands
tg-show-mcp-tools- Display registered MCP toolstg-set-mcp-tool- Configure and register MCP toolstg-invoke-mcp-tool- Execute MCP toolstg-delete-tool- Delete regular agent tools
See Also
- MCP Protocol Documentation
- TrustGraph MCP Integration Guide
- MCP Tool Management Manual