new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

AI SDK · Cookbook · all subjects

tool calling & agents

4 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

streamUI tool definition structure

A tool for streamUI requires three properties: description (a string explaining what the tool does and when to use it), inputSchema (a Zod schema object describing the input parameters the tool needs), and generate (an async generator function that runs when the model calls the tool and returns a React component).

addToolOutput function

addToolOutput accepts { tool: string; toolCallId: string; output: unknown } or { tool: string; toolCallId: string; state: 'output-error', errorText: string }. Adds tool result to chat and updates messages. If sendAutomaticallyWhen configured, may trigger automatic resubmission.

addToolApprovalResponse function

addToolApprovalResponse(options: { id: string; approved: boolean; reason?: string }) => void | PromiseLike<void>. Responds to tool approval request. The id must match the approval id from tool call. If sendAutomaticallyWhen configured, may trigger automatic resubmission.

addToolResult deprecated

addToolResult is deprecated. Use addToolOutput instead.

Give your agent this brain