Repository navigation
@tanstack/ai@0.63.0
Minor Changes
-
#1509
37b2826- Add an optionalinputSchematodefineAgent. The agent's tool shows the schema to the model, so the parent model writes the child's input, such as a short brief.rungets the checked input as a typedctx.input. A bad input goes back to the model as a tool error, and the child does not start.inputSchemaneeds tool mode:chat()throws whensubagents.routermeets an agent that has one. Agents withoutinputSchemado not change. -
#1401
c5c1996- Preserve structured outcomes for cancelled and denied tool results. Atool-resultpart now carriesoutcome: 'cancelled' | 'denied'(newToolResultOutcometype andisToolResultOutcomeguard) across tool execution, streaming, persistence, and UI restoration, so callers can tell a user or middleware decision from an ordinary tool failure without matching error text.statestays'error'for these results. The@tanstack/ai-clientToolResultParttype (used byuseChatmessages) now has the sameoutcomefield. -
#1452
0eb8f0b-@tanstack/ai-mcpcan create an MCP server withcreateMCPServerandserveMCPStdio. The client package moves from@modelcontextprotocol/sdkto@modelcontextprotocol/clientand@modelcontextprotocol/server. The client tries spec 2026-07-28 first, then the 2025 handshake. When an MCP server asks for input,chat()pauses with anmcp_inputinterrupt. Answer it withresolveInterruptorcancel(), and the tool runs again with the answer inctx.inputResponse. A tool can setexecution: 'task'for a spec 2025 task handle. A tool readsrequestInputandsampleonctx.context, typed byMCPToolContext. The serverauthoption takes the MCP SDKOAuthTokenVerifiershape.jwtVerifierandintrospectionVerifiercover JWT and opaque tokens, and a tool reads the token asctx.context.authInfo.createMCPClient<typeof server>({ transport })types a remote client from acreateMCPServerserver, andcreateMCPClient({ server })calls a server in the same process.server.handle(request, { authInfo, context })takes a token your own middleware verified and values forctx.context, typed withMCPToolContext<{ db: Db }>. A tool'smetadata.titleandmetadata.annotationsreach the host as the MCP title and annotations. A tool with nooutputSchemacan return aCallToolResultas is.sessions: 'reject'turns spec 2025 sessions off for hosts with many instances.
Patch Changes
-
#1233
8e8ee26- Preserve failed client tool results across native interrupt resumes and await asynchronous client output validation -
#1512
3e30cde- Keep a tool-call part atcompletewhen its result arrives before the stream ends. If a stream had noTOOL_CALL_END, the end-of-stream safety net set a finished tool-call part back toinput-complete. The final state then depended on async timing. -
#1528
f44b6b2-otelMiddleware({ captureContent: true })now records content on media spans (generateImage,generateVideo,generateAudio,generateSpeech,generateTranscription, and the others).gen_ai.input.messagesgets the prompt and input media.gen_ai.output.messagesgets the output URLs or the transcript text. Inline data stays a placeholder.redactandmaxContentLengthapply to each text part. -
#1527
d632d41-otelMiddlewarewithcaptureContent: truenow keeps multimodal parts structured ingen_ai.input.messages(OTel GenAI part shapes). URL media becomes auripart and provider file handles become afilepart, so traces show what the model looked at. Inline base64 data still records a[image]-style placeholder.