Table of Contents

Class FunctionCallManager

Manages and executes registered functions that can be called by AI agents.

  • Caches MethodInfo and Delegate for performance
  • JSON binding for arguments and return values
  • Supports CancellationToken
  • Supports void/UniTask/UniTaskT return types
public class FunctionCallManager : ToolCallManager<FunctionCall, FunctionOutput>, IFunctionCallExecutor, IToolCallExecutor<FunctionCall, FunctionOutput>, IToolProvider
Inheritance
object
FunctionCallManager
Implements
Inherited Members

Properties

Functions

public List<FunctionDescriptor> Functions { get; }

Property Value

List<FunctionDescriptor>

IsEmpty

public bool IsEmpty { get; }

Property Value

bool

Methods

CanExecute(string)

public bool CanExecute(string methodName)

Parameters

methodName string

Returns

bool

ExecuteAsync(FunctionCall, CancellationToken)

public override UniTask<FunctionOutput> ExecuteAsync(FunctionCall functionCall, CancellationToken ct)

Parameters

functionCall FunctionCall
ct CancellationToken

Returns

UniTask<FunctionOutput>

GetTools()

public List<Tool> GetTools()

Returns

List<Tool>

TryExecuteFunction(string, string, out JToken)

Attempts to execute a registered function by its method name with JSON arguments. If the function is found, it is invoked and its output is returned as a JToken. If the function is not found, returns null.

public bool TryExecuteFunction(string methodName, string jsonArguments, out JToken functionResult)

Parameters

methodName string
jsonArguments string
functionResult JToken

Returns

bool

True if the function was found (regardless of execution success), false if not found.