filterActiveTools

Narrow a tool list to a named subset.

Returns only the tools whose names appear in the list you pass, preserving order. Handy inside prepareStep to change which tools a model can see from one step to the next without rebuilding the array.

filterActiveTools(tools, names: ["search", "read_file"])

Signature

func filterActiveTools(
    _ tools: [any AIToolProtocol],
    activeTools: [String]?
) -> [any AIToolProtocol]

Defined in Sources/AI/Core/RuntimeContext.swift.

Parameters

ParameterTypeDefault
_[any AIToolProtocol]required
activeTools[String]?required

Returns

A filtered [any AIToolProtocol].

See also