onFunctionCall

View as MarkdownOpen in Claude

Dispatch a SWAIG function call to the handler registered via defineTool(). Returns null when the named function isn’t registered or has no handler. Called automatically by the POST /swaig dispatch path; subclasses (such as AgentBase) override it to add session-token validation and result normalization.

Parameters

name
stringRequired

Name of the SWAIG function to dispatch.

args
Record<string, unknown>Required

Parsed arguments for the function.

rawData
Record<string, unknown>Required

The full raw SWAIG request payload, including metadata such as call_id and global_data.

Returns

FunctionResult | Record<string, unknown> | string | void | null (or a Promise of these) — The handler’s result, or null when no matching function is registered.