diff --git a/.changeset/export-anon-function-tool.md b/.changeset/export-anon-function-tool.md new file mode 100644 index 000000000..de8347601 --- /dev/null +++ b/.changeset/export-anon-function-tool.md @@ -0,0 +1,5 @@ +--- +'@livekit/agents': patch +--- + +Export the `AnonFunctionTool` type so callers can annotate return types for name-less `tool()` factories used in object-map tool registration. diff --git a/agents/src/llm/index.ts b/agents/src/llm/index.ts index 4773501dc..721fb0395 100644 --- a/agents/src/llm/index.ts +++ b/agents/src/llm/index.ts @@ -18,6 +18,7 @@ export { Toolset, toToolContext, type AgentHandoff, + type AnonFunctionTool, type DuplicateMode, type FunctionTool, type Tool, diff --git a/agents/src/llm/tool_context.ts b/agents/src/llm/tool_context.ts index 6b947a021..215ea7f4f 100644 --- a/agents/src/llm/tool_context.ts +++ b/agents/src/llm/tool_context.ts @@ -223,6 +223,10 @@ export interface FunctionTool< [FUNCTION_TOOL_SYMBOL]: true; } +/** + * A function tool without `id`/`name`. Returned by {@link tool} when `name` is omitted; the + * containing object key supplies the name when registered via an object-map tool definition. + */ export type AnonFunctionTool< Parameters extends JSONObject = JSONObject, UserData = UnknownUserData,