tool_registry_manager.md · 4.3 KB

Tool Registry Manager Documentation

Overview

The ToolRegistryManager provides simplified tool registry management operations. It handles adding, removing, and updating tools in the official tools registry.

File: tools/tool_registry_manager.py Class: ToolRegistryManager Version: 1.0.0 Status: ✅ Active

Architecture

Design Principles

  • Simplicity: Focused on basic registry operations
  • Tool-Only: Manages tools registry only
  • Direct Operations: Direct add/remove/update operations
  • Persistent Storage: Saves to JSON file
  • Error Handling: Basic error handling
  • Core Components

    class ToolRegistryManager(BaseTool):
        - registry_path: Path - Tools registry file path
    

    Available Actions

    1. add

    Adds a new tool to the registry.

    Parameters:

  • action (str, required): "add"
  • tool_id (str, required): Tool identifier
  • tool_config (Dict, required): Tool configuration
  • Returns:

    Tuple[bool, str]  # (success, message)
    

    2. remove

    Removes a tool from the registry.

    Parameters:

  • action (str, required): "remove"
  • tool_id (str, required): Tool to remove
  • Returns:

    Tuple[bool, str]  # (success, message)
    

    3. update

    Updates an existing tool in the registry.

    Parameters:

  • action (str, required): "update"
  • tool_id (str, required): Tool to update
  • tool_config (Dict, required): Updated configuration
  • Returns:

    Tuple[bool, str]  # (success, message)
    

    Usage

    Add Tool

    from tools.tool_registry_manager import ToolRegistryManager

    manager = ToolRegistryManager()

    Add tool

    success, message = await manager.execute( action="add", tool_id="custom_tool", tool_config={ "name": "Custom Tool", "description": "Tool description", "version": "1.0.0", "enabled": True } )

    Update Tool

    # Update tool
    success, message = await manager.execute(
        action="update",
        tool_id="custom_tool",
        tool_config={
            "name": "Updated Custom Tool",
            "version": "2.0.0"
        }
    )
    

    Remove Tool

    # Remove tool
    success, message = await manager.execute(
        action="remove",
        tool_id="custom_tool"
    )
    

    Features

    1. Simple Interface

    Straightforward operations:

  • Add tools
  • Remove tools
  • Update tools
  • 2. Direct Registry Access

    Directly modifies:

  • data/config/official_tools_registry.json
  • No intermediate steps
  • Immediate persistence
  • 3. Error Handling

    Basic error handling:

  • Validates required parameters
  • Checks for existing tools
  • Returns clear error messages
  • Limitations

    Current Limitations

  • No Validation: No config validation
  • No Model Cards: Doesn't create model cards
  • No Identity: No cryptographic identity
  • No Backup: No backup before changes
  • Basic Only: Very basic functionality
  • Recommended Improvements

  • Config Validation: Validate tool configs
  • Model Card Support: Create model cards
  • Identity Integration: Add cryptographic identities
  • Backup System: Backup before changes
  • Enhanced Features: More comprehensive features
  • Merge with RegistryManagerTool: Consider consolidation
  • Integration

    With Tools Registry

    Directly modifies:

    data/config/official_tools_registry.json
    

    Examples

    Basic Operations

    # Add, update, remove
    await manager.execute("add", "tool1", {...})
    await manager.execute("update", "tool1", {...})
    await manager.execute("remove", "tool1")
    

    Technical Details

    Dependencies

  • core.bdi_agent.BaseTool: Base tool class
  • utils.logging_config.get_logger: Logging
  • Registry File

    Tools registry located at:

    data/config/official_tools_registry.json
    

    Comparison with RegistryManagerTool

    FeatureToolRegistryManagerRegistryManagerTool ScopeTools onlyTools + Agents Model CardsNoYes IdentityNoYes ComplexitySimpleComprehensive Use CaseBasic operationsFull management

    Future Enhancements

  • Enhanced Features: Add validation, model cards
  • Consolidation: Consider merging with RegistryManagerTool
  • Backup Support: Automatic backups
  • Validation: Config validation
  • Identity Support: Cryptographic identities

  • All DocumentsDocument IndexThe Book of mindXImprovement JournalAPI Reference