• Overrides an existing tool schema in the swarm system with a new or partial schema. This function updates the configuration of a tool identified by its toolName, applying the provided schema properties. It operates outside any existing method or execution contexts to ensure isolation, leveraging beginContext for a clean execution scope. Logs the override operation if logging is enabled in the global configuration.

    Type Parameters

    • T extends unknown = Record<string, ToolValue>

    Parameters

    • toolSchema: TAgentTool<T>

      Tool schema configuration defining the tool's name, function, and metadata.

    Returns IAgentTool<Record<string, ToolValue>>

    If the tool schema service encounters an error during the override operation (e.g., invalid toolName or schema).

    // Override a tool’s schema with new properties
    overrideTool({
    toolName: "WeatherTool",
    description: "Updated weather data retrieval tool",
    execute: async (params) => fetchWeather(params),
    });
    // Logs the operation (if enabled) and updates the tool schema in the swarm.