The surface
Every one of these is async. There is no
parseToolCall on the React Native surface.
Types come from @runanywhere/proto-ts/tool_calling, not from @runanywhere/core. The one
exception is ToolExecutor, which is a TypeScript-level type exported by @runanywhere/core.
Defining a tool
ToolDefinition and ToolParameter are proto messages. Build them with fromPartial and use the
ToolParameterType enum for the parameter type.
ToolValue
Executors receive and returnRecord<string, ToolValue>, not plain JSON. ToolValue is a typed
oneof, so read the branch you expect and write the branch you mean.
The SDK converts between this tree and the plain JSON the model emits, so
args.count?.numberValue
is how you read a numeric argument.
ToolParameter
The field is
enumValues, not enum, and defaultValue is a ToolValue, not a string.
Generating
tools option the loop uses everything currently registered.
ToolCallingOptions
Passed as aPartial<ToolCallingOptions> second argument.
The sampling defaults are the same ones
generate() uses. There is no separate 0.7 or 256.
GenerateWithToolsOptions
The optional third argument.topP comes from llmOptions only and defaults to 1.0.
ToolCallingResult
ToolCall carries id, name, argumentsJson, type, createdAtMs, and rawText.
ToolResult carries toolCallId, name, resultJson, error, success, startedAtMs, and
completedAtMs.
Manual execution
SetautoExecute: false to inspect calls before running them, then execute the ones you approve.
executeTool never throws. An unknown tool, unparseable arguments, or a throwing executor all come
back as a ToolResult with success: false and a populated error.
Multi-step chains
WithmaxToolCalls above 1 the model can chain calls inside one generation.
Error handling
Related
LLM Generation
Options and defaults
Streaming
Token streaming
System Prompts
Control model behavior
Error Handling
SDKException reference