[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-tanstack-ai-coretool-calling":3,"mdc--yymu2u-key":52,"related-org-tanstack-ai-coretool-calling":14745,"related-repo-tanstack-ai-coretool-calling":14889},{"slug":4,"name":5,"fn":6,"description":7,"org":8,"tags":12,"stars":24,"repoUrl":25,"updatedAt":26,"license":27,"forks":28,"topics":29,"repo":47,"sourceUrl":50,"mdContent":51},"ai-coretool-calling","ai-core\u002Ftool-calling","implement tool calling in TanStack AI","Isomorphic tool system: toolDefinition() with Zod schemas, .server() and .client() implementations, passing tools to both chat() on server and useChat\u002FclientTools on client, tool approval flows with needsApproval and bound interrupts (resolveInterrupt), lazy tool discovery with lazy:true, rendering ToolCallPart and ToolResultPart in UI.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},"tanstack","TanStack","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Ftanstack.png",[13,17,20,23],{"name":14,"slug":15,"type":16},"TypeScript","typescript","tag",{"name":18,"slug":19,"type":16},"AI SDK","ai-sdk",{"name":21,"slug":22,"type":16},"API Development","api-development",{"name":10,"slug":9,"type":16},2884,"https:\u002F\u002Fgithub.com\u002FTanStack\u002Fai","2026-07-30T05:26:08.442106",null,269,[30,31,19,32,33,34,35,36,37,38,39,40,41,42,43,9,44,15,45,46],"ai","ai-agents","anthropic","chatbot","function-calling","gemini","generative-ai","llm","multimodal","openai","react","solidjs","streaming","svelte","tool-calling","typescript-sdk","vue",{"repoUrl":25,"stars":24,"forks":28,"topics":48,"description":49},[30,31,19,32,33,34,35,36,37,38,39,40,41,42,43,9,44,15,45,46],"🤖 Type-safe, provider-agnostic TypeScript AI SDK for streaming chat, tool calling, agents, and multimodal apps across OpenAI, Anthropic, Gemini, React, Vue, Svelte, and Solid.","https:\u002F\u002Fgithub.com\u002FTanStack\u002Fai\u002Ftree\u002FHEAD\u002Fpackages\u002Fai\u002Fskills\u002Fai-core\u002Ftool-calling","---\nname: ai-core\u002Ftool-calling\ndescription: >\n  Isomorphic tool system: toolDefinition() with Zod schemas,\n  .server() and .client() implementations, passing tools to both\n  chat() on server and useChat\u002FclientTools on client, tool approval\n  flows with needsApproval and bound interrupts (resolveInterrupt), lazy tool\n  discovery with lazy:true, rendering ToolCallPart and ToolResultPart\n  in UI.\ntype: sub-skill\nlibrary: tanstack-ai\nlibrary_version: '0.10.0'\nsources:\n  - 'TanStack\u002Fai:docs\u002Ftools\u002Ftools.md'\n  - 'TanStack\u002Fai:docs\u002Ftools\u002Fserver-tools.md'\n  - 'TanStack\u002Fai:docs\u002Ftools\u002Fclient-tools.md'\n  - 'TanStack\u002Fai:docs\u002Ftools\u002Ftool-approval.md'\n  - 'TanStack\u002Fai:docs\u002Ftools\u002Flazy-tool-discovery.md'\n---\n\n# Tool Calling\n\nThis skill builds on ai-core. Read it first for critical rules.\n\n## Setup\n\nComplete end-to-end example: shared definition, server tool, client tool, server route, React client.\n\n```typescript\n\u002F\u002F tools\u002Fdefinitions.ts\nimport { toolDefinition } from '@tanstack\u002Fai'\nimport { z } from 'zod'\n\nexport const getProductsDef = toolDefinition({\n  name: 'get_products',\n  description: 'Search for products in the catalog',\n  inputSchema: z.object({\n    query: z.string().meta({ description: 'Search keyword' }),\n    limit: z.number().optional().meta({ description: 'Max results' }),\n  }),\n  outputSchema: z.object({\n    products: z.array(\n      z.object({ id: z.string(), name: z.string(), price: z.number() }),\n    ),\n  }),\n})\n\nexport const updateCartUIDef = toolDefinition({\n  name: 'update_cart_ui',\n  description: 'Update the shopping cart UI with item count',\n  inputSchema: z.object({ itemCount: z.number(), message: z.string() }),\n  outputSchema: z.object({ displayed: z.boolean() }),\n})\n```\n\n```typescript\n\u002F\u002F tools\u002Fserver.ts\nimport { getProductsDef } from '.\u002Fdefinitions'\n\nexport const getProducts = getProductsDef.server(async ({ query, limit }) => {\n  const results = await db.products.search(query, { limit: limit ?? 10 })\n  return {\n    products: results.map((p) => ({ id: p.id, name: p.name, price: p.price })),\n  }\n})\n```\n\n```typescript\n\u002F\u002F api\u002Fchat\u002Froute.ts\nimport { chat, toServerSentEventsResponse } from '@tanstack\u002Fai'\nimport { openaiText } from '@tanstack\u002Fai-openai'\nimport { getProducts } from '@\u002Ftools\u002Fserver'\nimport { updateCartUIDef } from '@\u002Ftools\u002Fdefinitions'\n\nexport async function POST(request: Request) {\n  const { messages } = await request.json()\n  const stream = chat({\n    adapter: openaiText('gpt-5.5'),\n    messages,\n    tools: [getProducts, updateCartUIDef], \u002F\u002F server tool + client definition\n  })\n  return toServerSentEventsResponse(stream)\n}\n```\n\n```typescript\n\u002F\u002F app\u002Fchat.tsx\nimport {\n  useChat,\n  fetchServerSentEvents,\n  clientTools,\n  createChatClientOptions,\n  type InferChatMessages,\n} from \"@tanstack\u002Fai-react\";\nimport { updateCartUIDef } from \"@\u002Ftools\u002Fdefinitions\";\nimport { useState } from \"react\";\n\nfunction ChatPage() {\n  const [cartCount, setCartCount] = useState(0);\n\n  const updateCartUI = updateCartUIDef.client((input) => {\n    setCartCount(input.itemCount);\n    return { displayed: true };\n  });\n\n  const tools = clientTools(updateCartUI);\n  const chatOptions = createChatClientOptions({\n    connection: fetchServerSentEvents(\"\u002Fapi\u002Fchat\"),\n    tools,\n  });\n  const { messages, sendMessage } = useChat(chatOptions);\n  \u002F\u002F InferChatMessages ties part types to the configured tools when needed:\n  \u002F\u002F type Messages = InferChatMessages\u003Ctypeof chatOptions>\n\n  return (\n    \u003Cdiv>\n      \u003Cspan>Cart: {cartCount}\u003C\u002Fspan>\n      {messages.map((msg) => (\n        \u003Cdiv key={msg.id}>\n          {msg.parts.map((part) => {\n            if (part.type === \"text\") return \u003Cp>{part.content}\u003C\u002Fp>;\n            if (part.type === \"tool-call\") {\n              return \u003Cdiv key={part.id}>Tool: {part.name} ({part.state})\u003C\u002Fdiv>;\n            }\n            return null;\n          })}\n        \u003C\u002Fdiv>\n      ))}\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n## Core Patterns\n\n### Pattern 1: Server-Only Tool\n\nDefine with `toolDefinition()`, implement with `.server()`, pass to `chat({ tools })`.\nThe server executes it automatically. The client never runs code for this tool.\n\n```typescript\nimport { toolDefinition } from '@tanstack\u002Fai'\nimport { z } from 'zod'\n\nconst getUserDataDef = toolDefinition({\n  name: 'get_user_data',\n  description: 'Look up user by ID',\n  inputSchema: z.object({\n    userId: z.string().meta({ description: \"The user's ID\" }),\n  }),\n  outputSchema: z.object({ name: z.string(), email: z.string() }),\n})\n\nconst getUserData = getUserDataDef.server(async ({ userId }) => {\n  const user = await db.users.findUnique({ where: { id: userId } })\n  return { name: user.name, email: user.email }\n})\n\n\u002F\u002F In your route handler:\nconst stream = chat({\n  adapter: openaiText('gpt-5.5'),\n  messages,\n  tools: [getUserData],\n})\n```\n\n### Pattern 2: Client-Only Tool\n\nPass the bare definition (no `.server()`) to `chat({ tools })` so the LLM knows\nabout it. Pass the `.client()` implementation to `useChat` via `clientTools()`.\n\n```typescript\nimport { toolDefinition } from '@tanstack\u002Fai'\nimport { z } from 'zod'\n\nexport const showNotificationDef = toolDefinition({\n  name: 'show_notification',\n  description: 'Display a toast notification to the user',\n  inputSchema: z.object({\n    message: z.string(),\n    type: z.enum(['success', 'error', 'info']),\n  }),\n  outputSchema: z.object({ shown: z.boolean() }),\n})\n```\n\nServer -- pass definition only (no execute function):\n\n```typescript\nconst stream = chat({\n  adapter: openaiText('gpt-5.5'),\n  messages,\n  tools: [showNotificationDef],\n})\n```\n\nClient -- pass `.client()` implementation:\n\n```typescript\nimport {\n  useChat,\n  fetchServerSentEvents,\n  clientTools,\n  createChatClientOptions,\n} from \"@tanstack\u002Fai-react\";\nimport { showNotificationDef } from \"@\u002Ftools\u002Fdefinitions\";\nimport { useState } from \"react\";\n\nfunction ChatPage() {\n  const [toast, setToast] = useState\u003Cstring | null>(null);\n\n  const showNotification = showNotificationDef.client((input) => {\n    setToast(input.message);\n    setTimeout(() => setToast(null), 3000);\n    return { shown: true };\n  });\n\n  const { messages, sendMessage } = useChat(\n    createChatClientOptions({\n      connection: fetchServerSentEvents(\"\u002Fapi\u002Fchat\"),\n      tools: clientTools(showNotification),\n    })\n  );\n\n  return (\n    \u003Cdiv>\n      {toast && \u003Cdiv className=\"toast\">{toast}\u003C\u002Fdiv>}\n      {messages.map((msg) => (\n        \u003Cdiv key={msg.id}>\n          {msg.parts.map((part) =>\n            part.type === \"text\" ? \u003Cp>{part.content}\u003C\u002Fp> : null\n          )}\n        \u003C\u002Fdiv>\n      ))}\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n### Pattern 3: Tool with Approval Flow\n\nSet `needsApproval: true` in the definition. Execution pauses with\n`RUN_FINISHED.outcome.type === 'interrupt'`. The primary client API is bound\n`interrupts` + `resolveInterrupt` \u002F `resolveInterrupts` \u002F `cancel`.\n`addToolApprovalResponse` and `pendingInterrupts` remain as deprecated\ncompatibility shims during migration.\n\n```typescript\nimport { toolDefinition } from '@tanstack\u002Fai'\nimport { z } from 'zod'\n\nexport const sendEmailDef = toolDefinition({\n  name: 'send_email',\n  description: 'Send an email to a recipient',\n  inputSchema: z.object({\n    to: z.string().email(),\n    subject: z.string(),\n    body: z.string(),\n  }),\n  outputSchema: z.object({ success: z.boolean(), messageId: z.string() }),\n  needsApproval: true,\n})\n\nexport const sendEmail = sendEmailDef.server(async ({ to, subject, body }) => {\n  const result = await emailService.send({ to, subject, body })\n  return { success: true, messageId: result.id }\n})\n```\n\nServer route must forward `resume` \u002F `parentRunId` (via `chatParamsFromRequest`\nor equivalent). Client -- render bound interrupts:\n\n```typescript\nimport { useChat, fetchServerSentEvents } from \"@tanstack\u002Fai-react\";\n\nfunction ChatPage() {\n  const { messages, interrupts, sendMessage } = useChat({\n    connection: fetchServerSentEvents(\"\u002Fapi\u002Fchat\"),\n  });\n\n  return (\n    \u003Cdiv>\n      {interrupts.map((interrupt) => {\n        if (interrupt.kind !== \"tool-approval\") return null;\n        return (\n          \u003Cdiv key={interrupt.id}>\n            \u003Cp>Approve \"{interrupt.toolName}\"?\u003C\u002Fp>\n            \u003Cpre>{JSON.stringify(interrupt.originalArgs, null, 2)}\u003C\u002Fpre>\n            \u003Cbutton onClick={() => interrupt.resolveInterrupt(true)}>\n              Approve\n            \u003C\u002Fbutton>\n            \u003Cbutton onClick={() => interrupt.resolveInterrupt(false)}>\n              Deny\n            \u003C\u002Fbutton>\n            \u003Cbutton onClick={() => interrupt.cancel()}>Cancel\u003C\u002Fbutton>\n          \u003C\u002Fdiv>\n        );\n      })}\n      {messages.map((msg) => (\n        \u003Cdiv key={msg.id}>\n          {msg.parts.map((part) =>\n            part.type === \"text\" ? \u003Cp key={part.content}>{part.content}\u003C\u002Fp> : null\n          )}\n        \u003C\u002Fdiv>\n      ))}\n    \u003C\u002Fdiv>\n  );\n}\n```\n\nBatch all pending approvals with `resolveInterrupts` (void — submission is\nasync; watch `resuming` \u002F `interruptErrors`):\n\n```typescript\n\u002F\u002F Payloadless tool-approvals only\nresolveInterrupts(true)\n\n\u002F\u002F Or per-item:\nresolveInterrupts((interrupt) => {\n  if (interrupt.kind === 'tool-approval') {\n    interrupt.resolveInterrupt(true)\n  }\n})\n```\n\nMigration: `pendingInterrupts` aliases `interrupts`; `addToolApprovalResponse`\nforwards to the matching bound approval when present. Prefer the bound methods\nabove for new code. See `docs\u002Finterrupts\u002F`.\n\n### Pattern 4: Lazy Tool Discovery\n\nSet `lazy: true` on rarely-needed tools. The LLM sees their names via a synthetic\n`__lazy__tool__discovery__` tool and discovers schemas on demand. Saves tokens.\n\n```typescript\nimport {\n  toolDefinition,\n  chat,\n  toServerSentEventsResponse,\n  maxIterations,\n} from '@tanstack\u002Fai'\nimport { openaiText } from '@tanstack\u002Fai-openai'\nimport { z } from 'zod'\n\nconst getProductsDef = toolDefinition({\n  name: 'getProducts',\n  description: 'List all products',\n  inputSchema: z.object({}),\n  outputSchema: z.array(\n    z.object({ id: z.number(), name: z.string(), price: z.number() }),\n  ),\n})\nconst getProducts = getProductsDef.server(async () => db.products.findMany())\n\nconst compareProductsDef = toolDefinition({\n  name: 'compareProducts',\n  description: 'Compare two or more products side by side',\n  inputSchema: z.object({ productIds: z.array(z.number()).min(2) }),\n  lazy: true, \u002F\u002F not sent to LLM upfront\n})\nconst compareProducts = compareProductsDef.server(async ({ productIds }) => {\n  return db.products.findMany({ where: { id: { in: productIds } } })\n})\n\nexport async function POST(request: Request) {\n  const { messages } = await request.json()\n  const stream = chat({\n    adapter: openaiText('gpt-5.5'),\n    messages,\n    tools: [getProducts, compareProducts],\n    \u002F\u002F maxIterations bounds model turns, not tool calls. For tool budgets,\n    \u002F\u002F use middleware onBeforeToolCall + onShouldContinue (see agentic-cycle docs).\n    agentLoopStrategy: maxIterations(20),\n  })\n  return toServerSentEventsResponse(stream)\n}\n```\n\nThe LLM sees `getProducts` and `__lazy__tool__discovery__` upfront.\nTo compare, it first calls `__lazy__tool__discovery__({ toolNames: [\"compareProducts\"] })`,\ngets the full schema, then calls `compareProducts` directly.\nOnce discovered, a tool stays available for the conversation.\nWhen all lazy tools are discovered, the discovery tool is removed automatically.\n\n### Tuning the lazy catalog with `lazyToolsConfig`\n\nBy default the discovery-tool catalog lists only bare names (`'none'`). Pass\n`lazyToolsConfig` to `chat()` to include more context:\n\n```typescript\nconst stream = chat({\n  adapter: openaiText('gpt-5.5'),\n  messages,\n  tools: [getProducts, compareProducts],\n  agentLoopStrategy: maxIterations(20),\n  lazyToolsConfig: { includeDescription: 'first-sentence' },\n})\n```\n\n`includeDescription` values:\n\n| Value              | Catalog entry                                                                            | When to use                                                                        |\n| ------------------ | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |\n| `'none'` (default) | `compareProducts`                                                                        | Smallest prompt; model discovers by name                                           |\n| `'first-sentence'` | `compareProducts — Compare two or more products side by side.`                           | Helps the model decide whether to discover without extra tokens                    |\n| `'full'`           | `compareProducts — Compare two or more products side by side. Accepts productIds array.` | Use when descriptions are short or the model needs full context to route correctly |\n\nThe post-discovery payload always returns the full description and schema regardless of this setting.\n\n## MCP Tools\n\n`@tanstack\u002Fai-mcp` lets a server-side `chat()` call discover and invoke tools\nhosted on any MCP server (Streamable HTTP, SSE, or stdio).\n\n**MCP tools and UI resources:** When an MCP tool result carries a `ui:\u002F\u002F`\nresource URI (via `_meta.ui.resourceUri`), TanStack AI surfaces it as a\n`UIResourcePart` on the assistant `UIMessage` in the client message list.\n`UIResourcePart` is a presentational-only part — it never enters model input.\nSee the `@tanstack\u002Fai-mcp` skill for the full MCP Apps API\n(`createMcpAppCallHandler`, `createMcpAppBridge`, `MCPAppResource`).\n\n### Basic usage — auto-discovery\n\n```typescript\n\u002F\u002F src\u002Froutes\u002Fapi.chat.ts\nimport { createFileRoute } from '@tanstack\u002Freact-router'\nimport { chat, toServerSentEventsResponse } from '@tanstack\u002Fai'\nimport { openaiText } from '@tanstack\u002Fai-openai'\nimport { createMCPClient } from '@tanstack\u002Fai-mcp'\n\nexport const Route = createFileRoute('\u002Fapi\u002Fchat')({\n  server: {\n    handlers: {\n      POST: async ({ request }) => {\n        const { messages } = await request.json()\n\n        \u002F\u002F 1. Connect to the MCP server.\n        const mcp = await createMCPClient({\n          transport: { type: 'http', url: 'https:\u002F\u002Fmcp.example.com\u002Fmcp' },\n        })\n\n        \u002F\u002F 2. Discover all tools from the server (returns ServerTool[]).\n        const mcpTools = await mcp.tools()\n\n        \u002F\u002F 3. Spread them into chat() — they work exactly like hand-written tools.\n        \u002F\u002F Caller owns the lifecycle — chat() never closes the client. Tools run\n        \u002F\u002F while the response streams, so close in a middleware terminal hook\n        \u002F\u002F (a try\u002Ffinally around the return would close before tools execute).\n        const stream = chat({\n          adapter: openaiText('gpt-5.5'),\n          messages,\n          tools: [...mcpTools],\n          middleware: [\n            {\n              name: 'mcp-close',\n              onFinish: () => mcp.close(),\n              onAbort: () => mcp.close(),\n              onError: () => mcp.close(),\n            },\n          ],\n        })\n        return toServerSentEventsResponse(stream)\n      },\n    },\n  },\n})\n```\n\n### Typed path — pass toolDefinition instances\n\nPass bare `toolDefinition()` instances (no `.server()`) to `client.tools([...])`.\nThe MCP client supplies a `callTool` proxy as the execute function, while\ninput\u002Foutput validation and types come from the definitions' Zod schemas.\n\n```typescript\nimport { toolDefinition } from '@tanstack\u002Fai'\nimport { createMCPClient } from '@tanstack\u002Fai-mcp'\nimport { z } from 'zod'\n\nconst getWeather = toolDefinition({\n  name: 'get_weather',\n  description: 'Current weather for a city',\n  inputSchema: z.object({ city: z.string() }),\n  outputSchema: z.object({ temperature: z.number(), conditions: z.string() }),\n})\n\nconst mcp = await createMCPClient({\n  transport: { type: 'http', url: 'https:\u002F\u002Fmcp.example.com\u002Fmcp' },\n})\n\n\u002F\u002F Returns ServerTool[] typed to the definitions' input\u002Foutput schemas.\n\u002F\u002F Throws MCPToolNotFoundError if the server does not expose a tool with that name.\nconst tools = await mcp.tools([getWeather])\n\nconst stream = chat({ adapter: openaiText('gpt-5.5'), messages, tools })\n```\n\n### Multiple servers with `createMCPClients`\n\n```typescript\nimport { createMCPClients } from '@tanstack\u002Fai-mcp'\n\n\u002F\u002F Each key becomes the default prefix for that server's tools.\nawait using pool = await createMCPClients({\n  github: { transport: { type: 'http', url: 'https:\u002F\u002Fmcp.github.com\u002Fmcp' } },\n  linear: { transport: { type: 'http', url: 'https:\u002F\u002Fmcp.linear.app\u002Fmcp' } },\n})\n\n\u002F\u002F Tools auto-prefixed: 'github_search_repos', 'linear_create_issue', etc.\nconst tools = await pool.tools()\n\nconst stream = chat({ adapter: openaiText('gpt-5.5'), messages, tools })\n```\n\nUse `pool.clients.\u003Cname>` for typed per-server access (resources, prompts, typed\n`tools([defs])` overload).\n\n### `ToolExecutionContext.abortSignal` — cancelling long-running tools\n\nEvery server tool's execute function now receives `abortSignal` in its context.\nWhen the chat run aborts (e.g. the client disconnects or calls the run's\n`abortController`), the signal fires and any in-flight `callTool` call is\ncancelled automatically.\n\nYou can also forward it from your own server tools:\n\n```typescript\nconst longRunningTool = myToolDef.server(async (args, ctx) => {\n  \u002F\u002F Forward to fetch, a DB query, or an MCP callTool call.\n  const response = await fetch('https:\u002F\u002Fslow.api\u002Fdata', {\n    signal: ctx?.abortSignal,\n  })\n  return response.json()\n})\n```\n\nMCP tools wire this automatically — `makeMcpExecute` passes `ctx?.abortSignal`\nas the `signal` option to `client.callTool(...)`, so MCP server calls cancel\nwith the chat run without any extra code.\n\n### stdio transport (Node-only)\n\n```typescript\nimport { createMCPClient } from '@tanstack\u002Fai-mcp'\nimport { stdioTransport } from '@tanstack\u002Fai-mcp\u002Fstdio'\n\nconst mcp = await createMCPClient({\n  transport: stdioTransport({ command: 'npx', args: ['-y', 'my-mcp-server'] }),\n})\n```\n\nImport `stdioTransport` from the `\u002Fstdio` subpath only — it contains Node.js\n`child_process` imports and must not be bundled for edge runtimes.\n\n### `chat({ mcp })` — discovery + lifecycle in one prop\n\nInstead of manually calling `client.tools()` and managing `close()`, pass an\n`mcp` object and let `chat()` handle discovery and lifecycle.\n\n```typescript\n\u002F\u002F Prop shape (ChatMCPOptions):\n\u002F\u002F mcp: {\n\u002F\u002F   clients: Array\u003CMCPClient | MCPClients>,\n\u002F\u002F   connection?: 'close' | 'keep-alive',  \u002F\u002F default: 'close'\n\u002F\u002F   lazyTools?: boolean,\n\u002F\u002F   onDiscoveryError?: (error: unknown, source) => void,\n\u002F\u002F }\n```\n\n- At run start, `chat()` calls `.tools()` on every entry in `clients` and merges\n  the results — identical to spreading `await client.tools()` into `tools: [...]`.\n- `lazyTools: true` is forwarded to `tools({ lazy: true })`.\n- `onDiscoveryError`: throw to fail-fast; return to skip that source.\n- `connection: 'close'` (default) closes each client when the run ends (after\n  the agent loop completes and the stream is drained). With `'keep-alive'`,\n  `chat()` never closes the clients — the caller owns their lifecycle (keep\n  connections warm across requests).\n\n**When to use `mcp` vs. the tools spread:**\n\n| Approach                                                | Use when                                                                          |\n| ------------------------------------------------------- | --------------------------------------------------------------------------------- |\n| `chat({ mcp: { clients: [...] } })`                     | Convenience: discovery + lifecycle in one place; untyped tool args are acceptable |\n| `tools: [...await client.tools([toolDefinition(...)])]` | Fully-typed tool args\u002Fresults via Zod schemas                                     |\n\n**Example:**\n\n```typescript\nimport { createFileRoute } from '@tanstack\u002Freact-router'\nimport { chat, toServerSentEventsResponse } from '@tanstack\u002Fai'\nimport { openaiText } from '@tanstack\u002Fai-openai'\nimport { createMCPClient } from '@tanstack\u002Fai-mcp'\n\nexport const Route = createFileRoute('\u002Fapi\u002Fchat')({\n  server: {\n    handlers: {\n      POST: async ({ request }) => {\n        const { messages } = await request.json()\n\n        const mcpClient = await createMCPClient({\n          transport: { type: 'http', url: 'https:\u002F\u002Fmcp.example.com\u002Fmcp' },\n        })\n\n        const stream = chat({\n          adapter: openaiText('gpt-5.5'),\n          messages,\n          mcp: {\n            clients: [mcpClient],\n            connection: 'keep-alive',\n            onDiscoveryError: (err, source) => {\n              console.warn('MCP discovery failed, skipping source:', err)\n              \u002F\u002F returning (not throwing) skips this source and continues\n            },\n          },\n        })\n\n        return toServerSentEventsResponse(stream)\n      },\n    },\n  },\n})\n```\n\n## Provider Skills\n\n> **Not to be confused with `@tanstack\u002Fai-code-mode-skills`**, which are locally-generated TypeScript functions executed client-side. Provider Skills are hosted, provider-managed bundles that the model loads on demand and runs inside the provider's server-side sandbox.\n\nProvider Skills are inert without an execution tool. The execution tool is what activates the sandbox; skills are additional capability bundles that run inside it:\n\n- **Anthropic**: skills require the `code_execution` tool (`@tanstack\u002Fai-anthropic\u002Ftools`).\n- **OpenAI**: skills live inside the `shell` tool (`@tanstack\u002Fai-openai\u002Ftools`) and are Responses API only.\n\n### Anthropic: `codeExecutionTool` with skills\n\nImport from `@tanstack\u002Fai-anthropic\u002Ftools`:\n\n```typescript\nimport { codeExecutionTool } from '@tanstack\u002Fai-anthropic\u002Ftools'\nimport { chat, toServerSentEventsResponse } from '@tanstack\u002Fai'\nimport { anthropicText } from '@tanstack\u002Fai-anthropic'\n\nexport async function POST(request: Request) {\n  const { messages } = await request.json()\n  const stream = chat({\n    adapter: anthropicText('claude-sonnet-4-6'),\n    messages,\n    tools: [\n      codeExecutionTool(\n        { type: 'code_execution_20250825', name: 'code_execution' },\n        {\n          skills: [{ type: 'anthropic', skill_id: 'pptx', version: 'latest' }],\n        },\n      ),\n    ],\n  })\n  return toServerSentEventsResponse(stream)\n}\n```\n\n`AnthropicContainerSkill` shape: `{ type: 'anthropic' | 'custom'; skill_id: string; version?: string }`. Constraints: max 8 skills per request; `skill_id` must be 1–64 characters.\n\nThe adapter automatically:\n\n- Lifts the skills into the request's top-level `container.skills` param (the shape Anthropic's API requires).\n- Attaches the required beta headers (`code-execution-2025-08-25` plus `skills-2025-10-02` when skills are present). You do not set these manually.\n\n**Deprecation:** Setting skills via `modelOptions.container.skills` is deprecated. Use `codeExecutionTool(config, { skills })` instead — the legacy path bypasses the beta-header wiring.\n\n### OpenAI: `shellTool` with skills (Responses API only)\n\nImport from `@tanstack\u002Fai-openai\u002Ftools`:\n\n```typescript\nimport { shellTool } from '@tanstack\u002Fai-openai\u002Ftools'\nimport { chat, toServerSentEventsResponse } from '@tanstack\u002Fai'\nimport { openaiText } from '@tanstack\u002Fai-openai'\n\nexport async function POST(request: Request) {\n  const { messages } = await request.json()\n  const stream = chat({\n    adapter: openaiText('gpt-5.5'),\n    messages,\n    tools: [\n      shellTool({\n        environment: {\n          type: 'container_auto',\n          skills: [\n            { type: 'skill_reference', skill_id: 'skill_abc', version: '2' },\n          ],\n        },\n      }),\n    ],\n  })\n  return toServerSentEventsResponse(stream)\n}\n```\n\n`SkillReference` shape: `{ type: 'skill_reference'; skill_id: string; version?: string }`. `version` is a string — use a positive integer as a string (e.g. `'2'`) or `'latest'`. This is Responses API only; Chat Completions does not support the shell tool.\n\n### Scope\n\nOnly hosted\u002Fmanaged-by-id skills (`type: 'anthropic'` \u002F `type: 'custom'` for Anthropic; `type: 'skill_reference'` for OpenAI) are wired. Inline bundles, local-path, and upload-API skill creation are not handled by these factories.\n\n## Common Mistakes\n\n### a. HIGH: Not passing tool definitions to both server and client\n\nServer tools need `chat({ tools })`. Client tools need their definition in\n`chat({ tools })` AND their `.client()` in `useChat({ tools: clientTools(...) })`.\n\nWrong -- tool only on server, client cannot execute:\n\n```typescript\nchat({ adapter, messages, tools: [myToolDef] })\nuseChat({ connection: fetchServerSentEvents('\u002Fapi\u002Fchat') }) \u002F\u002F no tools\n```\n\nWrong -- tool only on client, LLM does not know about it:\n\n```typescript\nchat({ adapter, messages }); \u002F\u002F no tools\nuseChat({ ..., tools: clientTools(myToolDef.client(() => result)) });\n```\n\nCorrect:\n\n```typescript\nchat({ adapter, messages, tools: [myToolDef] });\nuseChat({ ..., tools: clientTools(myToolDef.client((input) => ({ success: true }))) });\n```\n\nSource: docs\u002Ftools\u002Ftools.md\n\n## Cross-References\n\n- See also: ai-core\u002Fchat-experience\u002FSKILL.md -- Tools are used within chat\n- See also: `@tanstack\u002Fai-code-mode` package skills -- Code Mode is an alternative to tools for complex multi-step operations\n",{"data":53,"body":63},{"name":5,"description":7,"type":54,"library":55,"library_version":56,"sources":57},"sub-skill","tanstack-ai","0.10.0",[58,59,60,61,62],"TanStack\u002Fai:docs\u002Ftools\u002Ftools.md","TanStack\u002Fai:docs\u002Ftools\u002Fserver-tools.md","TanStack\u002Fai:docs\u002Ftools\u002Fclient-tools.md","TanStack\u002Fai:docs\u002Ftools\u002Ftool-approval.md","TanStack\u002Fai:docs\u002Ftools\u002Flazy-tool-discovery.md",{"type":64,"children":65},"root",[66,74,80,87,92,1051,1450,1892,3088,3094,3101,3130,3880,3886,3928,4343,4348,4463,4475,5448,5454,5522,6195,6223,7155,7182,7359,7392,7398,7418,8625,8658,8670,8698,8897,8908,9019,9024,9030,9048,9128,9134,10064,10070,10104,10748,10760,11166,11187,11199,11227,11232,11438,11475,11481,11718,11747,11759,11795,11863,11965,11980,12036,12044,12817,12823,12843,12848,12901,12915,12926,13489,13516,13521,13558,13584,13598,13608,14157,14199,14205,14233,14239,14245,14278,14283,14404,14409,14536,14541,14707,14712,14718,14739],{"type":67,"tag":68,"props":69,"children":70},"element","h1",{"id":44},[71],{"type":72,"value":73},"text","Tool Calling",{"type":67,"tag":75,"props":76,"children":77},"p",{},[78],{"type":72,"value":79},"This skill builds on ai-core. Read it first for critical rules.",{"type":67,"tag":81,"props":82,"children":84},"h2",{"id":83},"setup",[85],{"type":72,"value":86},"Setup",{"type":67,"tag":75,"props":88,"children":89},{},[90],{"type":72,"value":91},"Complete end-to-end example: shared definition, server tool, client tool, server route, React client.",{"type":67,"tag":93,"props":94,"children":98},"pre",{"className":95,"code":96,"language":15,"meta":97,"style":97},"language-typescript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u002F\u002F tools\u002Fdefinitions.ts\nimport { toolDefinition } from '@tanstack\u002Fai'\nimport { z } from 'zod'\n\nexport const getProductsDef = toolDefinition({\n  name: 'get_products',\n  description: 'Search for products in the catalog',\n  inputSchema: z.object({\n    query: z.string().meta({ description: 'Search keyword' }),\n    limit: z.number().optional().meta({ description: 'Max results' }),\n  }),\n  outputSchema: z.object({\n    products: z.array(\n      z.object({ id: z.string(), name: z.string(), price: z.number() }),\n    ),\n  }),\n})\n\nexport const updateCartUIDef = toolDefinition({\n  name: 'update_cart_ui',\n  description: 'Update the shopping cart UI with item count',\n  inputSchema: z.object({ itemCount: z.number(), message: z.string() }),\n  outputSchema: z.object({ displayed: z.boolean() }),\n})\n","",[99],{"type":67,"tag":100,"props":101,"children":102},"code",{"__ignoreMap":97},[103,115,163,201,211,251,285,315,350,434,526,543,576,607,730,743,759,772,780,813,842,871,969,1039],{"type":67,"tag":104,"props":105,"children":108},"span",{"class":106,"line":107},"line",1,[109],{"type":67,"tag":104,"props":110,"children":112},{"style":111},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic",[113],{"type":72,"value":114},"\u002F\u002F tools\u002Fdefinitions.ts\n",{"type":67,"tag":104,"props":116,"children":118},{"class":106,"line":117},2,[119,125,131,137,142,147,152,158],{"type":67,"tag":104,"props":120,"children":122},{"style":121},"--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic",[123],{"type":72,"value":124},"import",{"type":67,"tag":104,"props":126,"children":128},{"style":127},"--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF",[129],{"type":72,"value":130}," {",{"type":67,"tag":104,"props":132,"children":134},{"style":133},"--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8",[135],{"type":72,"value":136}," toolDefinition",{"type":67,"tag":104,"props":138,"children":139},{"style":127},[140],{"type":72,"value":141}," }",{"type":67,"tag":104,"props":143,"children":144},{"style":121},[145],{"type":72,"value":146}," from",{"type":67,"tag":104,"props":148,"children":149},{"style":127},[150],{"type":72,"value":151}," '",{"type":67,"tag":104,"props":153,"children":155},{"style":154},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[156],{"type":72,"value":157},"@tanstack\u002Fai",{"type":67,"tag":104,"props":159,"children":160},{"style":127},[161],{"type":72,"value":162},"'\n",{"type":67,"tag":104,"props":164,"children":166},{"class":106,"line":165},3,[167,171,175,180,184,188,192,197],{"type":67,"tag":104,"props":168,"children":169},{"style":121},[170],{"type":72,"value":124},{"type":67,"tag":104,"props":172,"children":173},{"style":127},[174],{"type":72,"value":130},{"type":67,"tag":104,"props":176,"children":177},{"style":133},[178],{"type":72,"value":179}," z",{"type":67,"tag":104,"props":181,"children":182},{"style":127},[183],{"type":72,"value":141},{"type":67,"tag":104,"props":185,"children":186},{"style":121},[187],{"type":72,"value":146},{"type":67,"tag":104,"props":189,"children":190},{"style":127},[191],{"type":72,"value":151},{"type":67,"tag":104,"props":193,"children":194},{"style":154},[195],{"type":72,"value":196},"zod",{"type":67,"tag":104,"props":198,"children":199},{"style":127},[200],{"type":72,"value":162},{"type":67,"tag":104,"props":202,"children":204},{"class":106,"line":203},4,[205],{"type":67,"tag":104,"props":206,"children":208},{"emptyLinePlaceholder":207},true,[209],{"type":72,"value":210},"\n",{"type":67,"tag":104,"props":212,"children":214},{"class":106,"line":213},5,[215,220,226,231,236,241,246],{"type":67,"tag":104,"props":216,"children":217},{"style":121},[218],{"type":72,"value":219},"export",{"type":67,"tag":104,"props":221,"children":223},{"style":222},"--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA",[224],{"type":72,"value":225}," const",{"type":67,"tag":104,"props":227,"children":228},{"style":133},[229],{"type":72,"value":230}," getProductsDef ",{"type":67,"tag":104,"props":232,"children":233},{"style":127},[234],{"type":72,"value":235},"=",{"type":67,"tag":104,"props":237,"children":239},{"style":238},"--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF",[240],{"type":72,"value":136},{"type":67,"tag":104,"props":242,"children":243},{"style":133},[244],{"type":72,"value":245},"(",{"type":67,"tag":104,"props":247,"children":248},{"style":127},[249],{"type":72,"value":250},"{\n",{"type":67,"tag":104,"props":252,"children":254},{"class":106,"line":253},6,[255,261,266,270,275,280],{"type":67,"tag":104,"props":256,"children":258},{"style":257},"--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178",[259],{"type":72,"value":260},"  name",{"type":67,"tag":104,"props":262,"children":263},{"style":127},[264],{"type":72,"value":265},":",{"type":67,"tag":104,"props":267,"children":268},{"style":127},[269],{"type":72,"value":151},{"type":67,"tag":104,"props":271,"children":272},{"style":154},[273],{"type":72,"value":274},"get_products",{"type":67,"tag":104,"props":276,"children":277},{"style":127},[278],{"type":72,"value":279},"'",{"type":67,"tag":104,"props":281,"children":282},{"style":127},[283],{"type":72,"value":284},",\n",{"type":67,"tag":104,"props":286,"children":288},{"class":106,"line":287},7,[289,294,298,302,307,311],{"type":67,"tag":104,"props":290,"children":291},{"style":257},[292],{"type":72,"value":293},"  description",{"type":67,"tag":104,"props":295,"children":296},{"style":127},[297],{"type":72,"value":265},{"type":67,"tag":104,"props":299,"children":300},{"style":127},[301],{"type":72,"value":151},{"type":67,"tag":104,"props":303,"children":304},{"style":154},[305],{"type":72,"value":306},"Search for products in the catalog",{"type":67,"tag":104,"props":308,"children":309},{"style":127},[310],{"type":72,"value":279},{"type":67,"tag":104,"props":312,"children":313},{"style":127},[314],{"type":72,"value":284},{"type":67,"tag":104,"props":316,"children":318},{"class":106,"line":317},8,[319,324,328,332,337,342,346],{"type":67,"tag":104,"props":320,"children":321},{"style":257},[322],{"type":72,"value":323},"  inputSchema",{"type":67,"tag":104,"props":325,"children":326},{"style":127},[327],{"type":72,"value":265},{"type":67,"tag":104,"props":329,"children":330},{"style":133},[331],{"type":72,"value":179},{"type":67,"tag":104,"props":333,"children":334},{"style":127},[335],{"type":72,"value":336},".",{"type":67,"tag":104,"props":338,"children":339},{"style":238},[340],{"type":72,"value":341},"object",{"type":67,"tag":104,"props":343,"children":344},{"style":133},[345],{"type":72,"value":245},{"type":67,"tag":104,"props":347,"children":348},{"style":127},[349],{"type":72,"value":250},{"type":67,"tag":104,"props":351,"children":353},{"class":106,"line":352},9,[354,359,363,367,371,376,381,385,390,394,399,404,408,412,417,421,425,430],{"type":67,"tag":104,"props":355,"children":356},{"style":257},[357],{"type":72,"value":358},"    query",{"type":67,"tag":104,"props":360,"children":361},{"style":127},[362],{"type":72,"value":265},{"type":67,"tag":104,"props":364,"children":365},{"style":133},[366],{"type":72,"value":179},{"type":67,"tag":104,"props":368,"children":369},{"style":127},[370],{"type":72,"value":336},{"type":67,"tag":104,"props":372,"children":373},{"style":238},[374],{"type":72,"value":375},"string",{"type":67,"tag":104,"props":377,"children":378},{"style":133},[379],{"type":72,"value":380},"()",{"type":67,"tag":104,"props":382,"children":383},{"style":127},[384],{"type":72,"value":336},{"type":67,"tag":104,"props":386,"children":387},{"style":238},[388],{"type":72,"value":389},"meta",{"type":67,"tag":104,"props":391,"children":392},{"style":133},[393],{"type":72,"value":245},{"type":67,"tag":104,"props":395,"children":396},{"style":127},[397],{"type":72,"value":398},"{",{"type":67,"tag":104,"props":400,"children":401},{"style":257},[402],{"type":72,"value":403}," description",{"type":67,"tag":104,"props":405,"children":406},{"style":127},[407],{"type":72,"value":265},{"type":67,"tag":104,"props":409,"children":410},{"style":127},[411],{"type":72,"value":151},{"type":67,"tag":104,"props":413,"children":414},{"style":154},[415],{"type":72,"value":416},"Search keyword",{"type":67,"tag":104,"props":418,"children":419},{"style":127},[420],{"type":72,"value":279},{"type":67,"tag":104,"props":422,"children":423},{"style":127},[424],{"type":72,"value":141},{"type":67,"tag":104,"props":426,"children":427},{"style":133},[428],{"type":72,"value":429},")",{"type":67,"tag":104,"props":431,"children":432},{"style":127},[433],{"type":72,"value":284},{"type":67,"tag":104,"props":435,"children":437},{"class":106,"line":436},10,[438,443,447,451,455,460,464,468,473,477,481,485,489,493,497,501,505,510,514,518,522],{"type":67,"tag":104,"props":439,"children":440},{"style":257},[441],{"type":72,"value":442},"    limit",{"type":67,"tag":104,"props":444,"children":445},{"style":127},[446],{"type":72,"value":265},{"type":67,"tag":104,"props":448,"children":449},{"style":133},[450],{"type":72,"value":179},{"type":67,"tag":104,"props":452,"children":453},{"style":127},[454],{"type":72,"value":336},{"type":67,"tag":104,"props":456,"children":457},{"style":238},[458],{"type":72,"value":459},"number",{"type":67,"tag":104,"props":461,"children":462},{"style":133},[463],{"type":72,"value":380},{"type":67,"tag":104,"props":465,"children":466},{"style":127},[467],{"type":72,"value":336},{"type":67,"tag":104,"props":469,"children":470},{"style":238},[471],{"type":72,"value":472},"optional",{"type":67,"tag":104,"props":474,"children":475},{"style":133},[476],{"type":72,"value":380},{"type":67,"tag":104,"props":478,"children":479},{"style":127},[480],{"type":72,"value":336},{"type":67,"tag":104,"props":482,"children":483},{"style":238},[484],{"type":72,"value":389},{"type":67,"tag":104,"props":486,"children":487},{"style":133},[488],{"type":72,"value":245},{"type":67,"tag":104,"props":490,"children":491},{"style":127},[492],{"type":72,"value":398},{"type":67,"tag":104,"props":494,"children":495},{"style":257},[496],{"type":72,"value":403},{"type":67,"tag":104,"props":498,"children":499},{"style":127},[500],{"type":72,"value":265},{"type":67,"tag":104,"props":502,"children":503},{"style":127},[504],{"type":72,"value":151},{"type":67,"tag":104,"props":506,"children":507},{"style":154},[508],{"type":72,"value":509},"Max results",{"type":67,"tag":104,"props":511,"children":512},{"style":127},[513],{"type":72,"value":279},{"type":67,"tag":104,"props":515,"children":516},{"style":127},[517],{"type":72,"value":141},{"type":67,"tag":104,"props":519,"children":520},{"style":133},[521],{"type":72,"value":429},{"type":67,"tag":104,"props":523,"children":524},{"style":127},[525],{"type":72,"value":284},{"type":67,"tag":104,"props":527,"children":529},{"class":106,"line":528},11,[530,535,539],{"type":67,"tag":104,"props":531,"children":532},{"style":127},[533],{"type":72,"value":534},"  }",{"type":67,"tag":104,"props":536,"children":537},{"style":133},[538],{"type":72,"value":429},{"type":67,"tag":104,"props":540,"children":541},{"style":127},[542],{"type":72,"value":284},{"type":67,"tag":104,"props":544,"children":546},{"class":106,"line":545},12,[547,552,556,560,564,568,572],{"type":67,"tag":104,"props":548,"children":549},{"style":257},[550],{"type":72,"value":551},"  outputSchema",{"type":67,"tag":104,"props":553,"children":554},{"style":127},[555],{"type":72,"value":265},{"type":67,"tag":104,"props":557,"children":558},{"style":133},[559],{"type":72,"value":179},{"type":67,"tag":104,"props":561,"children":562},{"style":127},[563],{"type":72,"value":336},{"type":67,"tag":104,"props":565,"children":566},{"style":238},[567],{"type":72,"value":341},{"type":67,"tag":104,"props":569,"children":570},{"style":133},[571],{"type":72,"value":245},{"type":67,"tag":104,"props":573,"children":574},{"style":127},[575],{"type":72,"value":250},{"type":67,"tag":104,"props":577,"children":579},{"class":106,"line":578},13,[580,585,589,593,597,602],{"type":67,"tag":104,"props":581,"children":582},{"style":257},[583],{"type":72,"value":584},"    products",{"type":67,"tag":104,"props":586,"children":587},{"style":127},[588],{"type":72,"value":265},{"type":67,"tag":104,"props":590,"children":591},{"style":133},[592],{"type":72,"value":179},{"type":67,"tag":104,"props":594,"children":595},{"style":127},[596],{"type":72,"value":336},{"type":67,"tag":104,"props":598,"children":599},{"style":238},[600],{"type":72,"value":601},"array",{"type":67,"tag":104,"props":603,"children":604},{"style":133},[605],{"type":72,"value":606},"(\n",{"type":67,"tag":104,"props":608,"children":610},{"class":106,"line":609},14,[611,616,620,624,628,632,637,641,645,649,653,657,662,667,671,675,679,683,687,691,696,700,704,708,712,717,722,726],{"type":67,"tag":104,"props":612,"children":613},{"style":133},[614],{"type":72,"value":615},"      z",{"type":67,"tag":104,"props":617,"children":618},{"style":127},[619],{"type":72,"value":336},{"type":67,"tag":104,"props":621,"children":622},{"style":238},[623],{"type":72,"value":341},{"type":67,"tag":104,"props":625,"children":626},{"style":133},[627],{"type":72,"value":245},{"type":67,"tag":104,"props":629,"children":630},{"style":127},[631],{"type":72,"value":398},{"type":67,"tag":104,"props":633,"children":634},{"style":257},[635],{"type":72,"value":636}," id",{"type":67,"tag":104,"props":638,"children":639},{"style":127},[640],{"type":72,"value":265},{"type":67,"tag":104,"props":642,"children":643},{"style":133},[644],{"type":72,"value":179},{"type":67,"tag":104,"props":646,"children":647},{"style":127},[648],{"type":72,"value":336},{"type":67,"tag":104,"props":650,"children":651},{"style":238},[652],{"type":72,"value":375},{"type":67,"tag":104,"props":654,"children":655},{"style":133},[656],{"type":72,"value":380},{"type":67,"tag":104,"props":658,"children":659},{"style":127},[660],{"type":72,"value":661},",",{"type":67,"tag":104,"props":663,"children":664},{"style":257},[665],{"type":72,"value":666}," name",{"type":67,"tag":104,"props":668,"children":669},{"style":127},[670],{"type":72,"value":265},{"type":67,"tag":104,"props":672,"children":673},{"style":133},[674],{"type":72,"value":179},{"type":67,"tag":104,"props":676,"children":677},{"style":127},[678],{"type":72,"value":336},{"type":67,"tag":104,"props":680,"children":681},{"style":238},[682],{"type":72,"value":375},{"type":67,"tag":104,"props":684,"children":685},{"style":133},[686],{"type":72,"value":380},{"type":67,"tag":104,"props":688,"children":689},{"style":127},[690],{"type":72,"value":661},{"type":67,"tag":104,"props":692,"children":693},{"style":257},[694],{"type":72,"value":695}," price",{"type":67,"tag":104,"props":697,"children":698},{"style":127},[699],{"type":72,"value":265},{"type":67,"tag":104,"props":701,"children":702},{"style":133},[703],{"type":72,"value":179},{"type":67,"tag":104,"props":705,"children":706},{"style":127},[707],{"type":72,"value":336},{"type":67,"tag":104,"props":709,"children":710},{"style":238},[711],{"type":72,"value":459},{"type":67,"tag":104,"props":713,"children":714},{"style":133},[715],{"type":72,"value":716},"() ",{"type":67,"tag":104,"props":718,"children":719},{"style":127},[720],{"type":72,"value":721},"}",{"type":67,"tag":104,"props":723,"children":724},{"style":133},[725],{"type":72,"value":429},{"type":67,"tag":104,"props":727,"children":728},{"style":127},[729],{"type":72,"value":284},{"type":67,"tag":104,"props":731,"children":733},{"class":106,"line":732},15,[734,739],{"type":67,"tag":104,"props":735,"children":736},{"style":133},[737],{"type":72,"value":738},"    )",{"type":67,"tag":104,"props":740,"children":741},{"style":127},[742],{"type":72,"value":284},{"type":67,"tag":104,"props":744,"children":746},{"class":106,"line":745},16,[747,751,755],{"type":67,"tag":104,"props":748,"children":749},{"style":127},[750],{"type":72,"value":534},{"type":67,"tag":104,"props":752,"children":753},{"style":133},[754],{"type":72,"value":429},{"type":67,"tag":104,"props":756,"children":757},{"style":127},[758],{"type":72,"value":284},{"type":67,"tag":104,"props":760,"children":762},{"class":106,"line":761},17,[763,767],{"type":67,"tag":104,"props":764,"children":765},{"style":127},[766],{"type":72,"value":721},{"type":67,"tag":104,"props":768,"children":769},{"style":133},[770],{"type":72,"value":771},")\n",{"type":67,"tag":104,"props":773,"children":775},{"class":106,"line":774},18,[776],{"type":67,"tag":104,"props":777,"children":778},{"emptyLinePlaceholder":207},[779],{"type":72,"value":210},{"type":67,"tag":104,"props":781,"children":783},{"class":106,"line":782},19,[784,788,792,797,801,805,809],{"type":67,"tag":104,"props":785,"children":786},{"style":121},[787],{"type":72,"value":219},{"type":67,"tag":104,"props":789,"children":790},{"style":222},[791],{"type":72,"value":225},{"type":67,"tag":104,"props":793,"children":794},{"style":133},[795],{"type":72,"value":796}," updateCartUIDef ",{"type":67,"tag":104,"props":798,"children":799},{"style":127},[800],{"type":72,"value":235},{"type":67,"tag":104,"props":802,"children":803},{"style":238},[804],{"type":72,"value":136},{"type":67,"tag":104,"props":806,"children":807},{"style":133},[808],{"type":72,"value":245},{"type":67,"tag":104,"props":810,"children":811},{"style":127},[812],{"type":72,"value":250},{"type":67,"tag":104,"props":814,"children":816},{"class":106,"line":815},20,[817,821,825,829,834,838],{"type":67,"tag":104,"props":818,"children":819},{"style":257},[820],{"type":72,"value":260},{"type":67,"tag":104,"props":822,"children":823},{"style":127},[824],{"type":72,"value":265},{"type":67,"tag":104,"props":826,"children":827},{"style":127},[828],{"type":72,"value":151},{"type":67,"tag":104,"props":830,"children":831},{"style":154},[832],{"type":72,"value":833},"update_cart_ui",{"type":67,"tag":104,"props":835,"children":836},{"style":127},[837],{"type":72,"value":279},{"type":67,"tag":104,"props":839,"children":840},{"style":127},[841],{"type":72,"value":284},{"type":67,"tag":104,"props":843,"children":845},{"class":106,"line":844},21,[846,850,854,858,863,867],{"type":67,"tag":104,"props":847,"children":848},{"style":257},[849],{"type":72,"value":293},{"type":67,"tag":104,"props":851,"children":852},{"style":127},[853],{"type":72,"value":265},{"type":67,"tag":104,"props":855,"children":856},{"style":127},[857],{"type":72,"value":151},{"type":67,"tag":104,"props":859,"children":860},{"style":154},[861],{"type":72,"value":862},"Update the shopping cart UI with item count",{"type":67,"tag":104,"props":864,"children":865},{"style":127},[866],{"type":72,"value":279},{"type":67,"tag":104,"props":868,"children":869},{"style":127},[870],{"type":72,"value":284},{"type":67,"tag":104,"props":872,"children":874},{"class":106,"line":873},22,[875,879,883,887,891,895,899,903,908,912,916,920,924,928,932,937,941,945,949,953,957,961,965],{"type":67,"tag":104,"props":876,"children":877},{"style":257},[878],{"type":72,"value":323},{"type":67,"tag":104,"props":880,"children":881},{"style":127},[882],{"type":72,"value":265},{"type":67,"tag":104,"props":884,"children":885},{"style":133},[886],{"type":72,"value":179},{"type":67,"tag":104,"props":888,"children":889},{"style":127},[890],{"type":72,"value":336},{"type":67,"tag":104,"props":892,"children":893},{"style":238},[894],{"type":72,"value":341},{"type":67,"tag":104,"props":896,"children":897},{"style":133},[898],{"type":72,"value":245},{"type":67,"tag":104,"props":900,"children":901},{"style":127},[902],{"type":72,"value":398},{"type":67,"tag":104,"props":904,"children":905},{"style":257},[906],{"type":72,"value":907}," itemCount",{"type":67,"tag":104,"props":909,"children":910},{"style":127},[911],{"type":72,"value":265},{"type":67,"tag":104,"props":913,"children":914},{"style":133},[915],{"type":72,"value":179},{"type":67,"tag":104,"props":917,"children":918},{"style":127},[919],{"type":72,"value":336},{"type":67,"tag":104,"props":921,"children":922},{"style":238},[923],{"type":72,"value":459},{"type":67,"tag":104,"props":925,"children":926},{"style":133},[927],{"type":72,"value":380},{"type":67,"tag":104,"props":929,"children":930},{"style":127},[931],{"type":72,"value":661},{"type":67,"tag":104,"props":933,"children":934},{"style":257},[935],{"type":72,"value":936}," message",{"type":67,"tag":104,"props":938,"children":939},{"style":127},[940],{"type":72,"value":265},{"type":67,"tag":104,"props":942,"children":943},{"style":133},[944],{"type":72,"value":179},{"type":67,"tag":104,"props":946,"children":947},{"style":127},[948],{"type":72,"value":336},{"type":67,"tag":104,"props":950,"children":951},{"style":238},[952],{"type":72,"value":375},{"type":67,"tag":104,"props":954,"children":955},{"style":133},[956],{"type":72,"value":716},{"type":67,"tag":104,"props":958,"children":959},{"style":127},[960],{"type":72,"value":721},{"type":67,"tag":104,"props":962,"children":963},{"style":133},[964],{"type":72,"value":429},{"type":67,"tag":104,"props":966,"children":967},{"style":127},[968],{"type":72,"value":284},{"type":67,"tag":104,"props":970,"children":972},{"class":106,"line":971},23,[973,977,981,985,989,993,997,1001,1006,1010,1014,1018,1023,1027,1031,1035],{"type":67,"tag":104,"props":974,"children":975},{"style":257},[976],{"type":72,"value":551},{"type":67,"tag":104,"props":978,"children":979},{"style":127},[980],{"type":72,"value":265},{"type":67,"tag":104,"props":982,"children":983},{"style":133},[984],{"type":72,"value":179},{"type":67,"tag":104,"props":986,"children":987},{"style":127},[988],{"type":72,"value":336},{"type":67,"tag":104,"props":990,"children":991},{"style":238},[992],{"type":72,"value":341},{"type":67,"tag":104,"props":994,"children":995},{"style":133},[996],{"type":72,"value":245},{"type":67,"tag":104,"props":998,"children":999},{"style":127},[1000],{"type":72,"value":398},{"type":67,"tag":104,"props":1002,"children":1003},{"style":257},[1004],{"type":72,"value":1005}," displayed",{"type":67,"tag":104,"props":1007,"children":1008},{"style":127},[1009],{"type":72,"value":265},{"type":67,"tag":104,"props":1011,"children":1012},{"style":133},[1013],{"type":72,"value":179},{"type":67,"tag":104,"props":1015,"children":1016},{"style":127},[1017],{"type":72,"value":336},{"type":67,"tag":104,"props":1019,"children":1020},{"style":238},[1021],{"type":72,"value":1022},"boolean",{"type":67,"tag":104,"props":1024,"children":1025},{"style":133},[1026],{"type":72,"value":716},{"type":67,"tag":104,"props":1028,"children":1029},{"style":127},[1030],{"type":72,"value":721},{"type":67,"tag":104,"props":1032,"children":1033},{"style":133},[1034],{"type":72,"value":429},{"type":67,"tag":104,"props":1036,"children":1037},{"style":127},[1038],{"type":72,"value":284},{"type":67,"tag":104,"props":1040,"children":1042},{"class":106,"line":1041},24,[1043,1047],{"type":67,"tag":104,"props":1044,"children":1045},{"style":127},[1046],{"type":72,"value":721},{"type":67,"tag":104,"props":1048,"children":1049},{"style":133},[1050],{"type":72,"value":771},{"type":67,"tag":93,"props":1052,"children":1054},{"className":95,"code":1053,"language":15,"meta":97,"style":97},"\u002F\u002F tools\u002Fserver.ts\nimport { getProductsDef } from '.\u002Fdefinitions'\n\nexport const getProducts = getProductsDef.server(async ({ query, limit }) => {\n  const results = await db.products.search(query, { limit: limit ?? 10 })\n  return {\n    products: results.map((p) => ({ id: p.id, name: p.name, price: p.price })),\n  }\n})\n",[1055],{"type":67,"tag":100,"props":1056,"children":1057},{"__ignoreMap":97},[1058,1066,1103,1110,1187,1281,1293,1431,1439],{"type":67,"tag":104,"props":1059,"children":1060},{"class":106,"line":107},[1061],{"type":67,"tag":104,"props":1062,"children":1063},{"style":111},[1064],{"type":72,"value":1065},"\u002F\u002F tools\u002Fserver.ts\n",{"type":67,"tag":104,"props":1067,"children":1068},{"class":106,"line":117},[1069,1073,1077,1082,1086,1090,1094,1099],{"type":67,"tag":104,"props":1070,"children":1071},{"style":121},[1072],{"type":72,"value":124},{"type":67,"tag":104,"props":1074,"children":1075},{"style":127},[1076],{"type":72,"value":130},{"type":67,"tag":104,"props":1078,"children":1079},{"style":133},[1080],{"type":72,"value":1081}," getProductsDef",{"type":67,"tag":104,"props":1083,"children":1084},{"style":127},[1085],{"type":72,"value":141},{"type":67,"tag":104,"props":1087,"children":1088},{"style":121},[1089],{"type":72,"value":146},{"type":67,"tag":104,"props":1091,"children":1092},{"style":127},[1093],{"type":72,"value":151},{"type":67,"tag":104,"props":1095,"children":1096},{"style":154},[1097],{"type":72,"value":1098},".\u002Fdefinitions",{"type":67,"tag":104,"props":1100,"children":1101},{"style":127},[1102],{"type":72,"value":162},{"type":67,"tag":104,"props":1104,"children":1105},{"class":106,"line":165},[1106],{"type":67,"tag":104,"props":1107,"children":1108},{"emptyLinePlaceholder":207},[1109],{"type":72,"value":210},{"type":67,"tag":104,"props":1111,"children":1112},{"class":106,"line":203},[1113,1117,1121,1126,1130,1134,1138,1143,1147,1152,1157,1163,1167,1172,1177,1182],{"type":67,"tag":104,"props":1114,"children":1115},{"style":121},[1116],{"type":72,"value":219},{"type":67,"tag":104,"props":1118,"children":1119},{"style":222},[1120],{"type":72,"value":225},{"type":67,"tag":104,"props":1122,"children":1123},{"style":133},[1124],{"type":72,"value":1125}," getProducts ",{"type":67,"tag":104,"props":1127,"children":1128},{"style":127},[1129],{"type":72,"value":235},{"type":67,"tag":104,"props":1131,"children":1132},{"style":133},[1133],{"type":72,"value":1081},{"type":67,"tag":104,"props":1135,"children":1136},{"style":127},[1137],{"type":72,"value":336},{"type":67,"tag":104,"props":1139,"children":1140},{"style":238},[1141],{"type":72,"value":1142},"server",{"type":67,"tag":104,"props":1144,"children":1145},{"style":133},[1146],{"type":72,"value":245},{"type":67,"tag":104,"props":1148,"children":1149},{"style":222},[1150],{"type":72,"value":1151},"async",{"type":67,"tag":104,"props":1153,"children":1154},{"style":127},[1155],{"type":72,"value":1156}," ({",{"type":67,"tag":104,"props":1158,"children":1160},{"style":1159},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic",[1161],{"type":72,"value":1162}," query",{"type":67,"tag":104,"props":1164,"children":1165},{"style":127},[1166],{"type":72,"value":661},{"type":67,"tag":104,"props":1168,"children":1169},{"style":1159},[1170],{"type":72,"value":1171}," limit",{"type":67,"tag":104,"props":1173,"children":1174},{"style":127},[1175],{"type":72,"value":1176}," })",{"type":67,"tag":104,"props":1178,"children":1179},{"style":222},[1180],{"type":72,"value":1181}," =>",{"type":67,"tag":104,"props":1183,"children":1184},{"style":127},[1185],{"type":72,"value":1186}," {\n",{"type":67,"tag":104,"props":1188,"children":1189},{"class":106,"line":213},[1190,1195,1200,1205,1210,1215,1219,1224,1228,1233,1237,1242,1246,1250,1254,1258,1262,1267,1273,1277],{"type":67,"tag":104,"props":1191,"children":1192},{"style":222},[1193],{"type":72,"value":1194},"  const",{"type":67,"tag":104,"props":1196,"children":1197},{"style":133},[1198],{"type":72,"value":1199}," results",{"type":67,"tag":104,"props":1201,"children":1202},{"style":127},[1203],{"type":72,"value":1204}," =",{"type":67,"tag":104,"props":1206,"children":1207},{"style":121},[1208],{"type":72,"value":1209}," await",{"type":67,"tag":104,"props":1211,"children":1212},{"style":133},[1213],{"type":72,"value":1214}," db",{"type":67,"tag":104,"props":1216,"children":1217},{"style":127},[1218],{"type":72,"value":336},{"type":67,"tag":104,"props":1220,"children":1221},{"style":133},[1222],{"type":72,"value":1223},"products",{"type":67,"tag":104,"props":1225,"children":1226},{"style":127},[1227],{"type":72,"value":336},{"type":67,"tag":104,"props":1229,"children":1230},{"style":238},[1231],{"type":72,"value":1232},"search",{"type":67,"tag":104,"props":1234,"children":1235},{"style":257},[1236],{"type":72,"value":245},{"type":67,"tag":104,"props":1238,"children":1239},{"style":133},[1240],{"type":72,"value":1241},"query",{"type":67,"tag":104,"props":1243,"children":1244},{"style":127},[1245],{"type":72,"value":661},{"type":67,"tag":104,"props":1247,"children":1248},{"style":127},[1249],{"type":72,"value":130},{"type":67,"tag":104,"props":1251,"children":1252},{"style":257},[1253],{"type":72,"value":1171},{"type":67,"tag":104,"props":1255,"children":1256},{"style":127},[1257],{"type":72,"value":265},{"type":67,"tag":104,"props":1259,"children":1260},{"style":133},[1261],{"type":72,"value":1171},{"type":67,"tag":104,"props":1263,"children":1264},{"style":127},[1265],{"type":72,"value":1266}," ??",{"type":67,"tag":104,"props":1268,"children":1270},{"style":1269},"--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C",[1271],{"type":72,"value":1272}," 10",{"type":67,"tag":104,"props":1274,"children":1275},{"style":127},[1276],{"type":72,"value":141},{"type":67,"tag":104,"props":1278,"children":1279},{"style":257},[1280],{"type":72,"value":771},{"type":67,"tag":104,"props":1282,"children":1283},{"class":106,"line":253},[1284,1289],{"type":67,"tag":104,"props":1285,"children":1286},{"style":121},[1287],{"type":72,"value":1288},"  return",{"type":67,"tag":104,"props":1290,"children":1291},{"style":127},[1292],{"type":72,"value":1186},{"type":67,"tag":104,"props":1294,"children":1295},{"class":106,"line":287},[1296,1300,1304,1308,1312,1317,1321,1325,1329,1333,1337,1342,1346,1350,1354,1359,1363,1368,1372,1376,1380,1384,1388,1393,1397,1401,1405,1409,1413,1418,1422,1427],{"type":67,"tag":104,"props":1297,"children":1298},{"style":257},[1299],{"type":72,"value":584},{"type":67,"tag":104,"props":1301,"children":1302},{"style":127},[1303],{"type":72,"value":265},{"type":67,"tag":104,"props":1305,"children":1306},{"style":133},[1307],{"type":72,"value":1199},{"type":67,"tag":104,"props":1309,"children":1310},{"style":127},[1311],{"type":72,"value":336},{"type":67,"tag":104,"props":1313,"children":1314},{"style":238},[1315],{"type":72,"value":1316},"map",{"type":67,"tag":104,"props":1318,"children":1319},{"style":257},[1320],{"type":72,"value":245},{"type":67,"tag":104,"props":1322,"children":1323},{"style":127},[1324],{"type":72,"value":245},{"type":67,"tag":104,"props":1326,"children":1327},{"style":1159},[1328],{"type":72,"value":75},{"type":67,"tag":104,"props":1330,"children":1331},{"style":127},[1332],{"type":72,"value":429},{"type":67,"tag":104,"props":1334,"children":1335},{"style":222},[1336],{"type":72,"value":1181},{"type":67,"tag":104,"props":1338,"children":1339},{"style":257},[1340],{"type":72,"value":1341}," (",{"type":67,"tag":104,"props":1343,"children":1344},{"style":127},[1345],{"type":72,"value":398},{"type":67,"tag":104,"props":1347,"children":1348},{"style":257},[1349],{"type":72,"value":636},{"type":67,"tag":104,"props":1351,"children":1352},{"style":127},[1353],{"type":72,"value":265},{"type":67,"tag":104,"props":1355,"children":1356},{"style":133},[1357],{"type":72,"value":1358}," p",{"type":67,"tag":104,"props":1360,"children":1361},{"style":127},[1362],{"type":72,"value":336},{"type":67,"tag":104,"props":1364,"children":1365},{"style":133},[1366],{"type":72,"value":1367},"id",{"type":67,"tag":104,"props":1369,"children":1370},{"style":127},[1371],{"type":72,"value":661},{"type":67,"tag":104,"props":1373,"children":1374},{"style":257},[1375],{"type":72,"value":666},{"type":67,"tag":104,"props":1377,"children":1378},{"style":127},[1379],{"type":72,"value":265},{"type":67,"tag":104,"props":1381,"children":1382},{"style":133},[1383],{"type":72,"value":1358},{"type":67,"tag":104,"props":1385,"children":1386},{"style":127},[1387],{"type":72,"value":336},{"type":67,"tag":104,"props":1389,"children":1390},{"style":133},[1391],{"type":72,"value":1392},"name",{"type":67,"tag":104,"props":1394,"children":1395},{"style":127},[1396],{"type":72,"value":661},{"type":67,"tag":104,"props":1398,"children":1399},{"style":257},[1400],{"type":72,"value":695},{"type":67,"tag":104,"props":1402,"children":1403},{"style":127},[1404],{"type":72,"value":265},{"type":67,"tag":104,"props":1406,"children":1407},{"style":133},[1408],{"type":72,"value":1358},{"type":67,"tag":104,"props":1410,"children":1411},{"style":127},[1412],{"type":72,"value":336},{"type":67,"tag":104,"props":1414,"children":1415},{"style":133},[1416],{"type":72,"value":1417},"price",{"type":67,"tag":104,"props":1419,"children":1420},{"style":127},[1421],{"type":72,"value":141},{"type":67,"tag":104,"props":1423,"children":1424},{"style":257},[1425],{"type":72,"value":1426},"))",{"type":67,"tag":104,"props":1428,"children":1429},{"style":127},[1430],{"type":72,"value":284},{"type":67,"tag":104,"props":1432,"children":1433},{"class":106,"line":317},[1434],{"type":67,"tag":104,"props":1435,"children":1436},{"style":127},[1437],{"type":72,"value":1438},"  }\n",{"type":67,"tag":104,"props":1440,"children":1441},{"class":106,"line":352},[1442,1446],{"type":67,"tag":104,"props":1443,"children":1444},{"style":127},[1445],{"type":72,"value":721},{"type":67,"tag":104,"props":1447,"children":1448},{"style":133},[1449],{"type":72,"value":771},{"type":67,"tag":93,"props":1451,"children":1453},{"className":95,"code":1452,"language":15,"meta":97,"style":97},"\u002F\u002F api\u002Fchat\u002Froute.ts\nimport { chat, toServerSentEventsResponse } from '@tanstack\u002Fai'\nimport { openaiText } from '@tanstack\u002Fai-openai'\nimport { getProducts } from '@\u002Ftools\u002Fserver'\nimport { updateCartUIDef } from '@\u002Ftools\u002Fdefinitions'\n\nexport async function POST(request: Request) {\n  const { messages } = await request.json()\n  const stream = chat({\n    adapter: openaiText('gpt-5.5'),\n    messages,\n    tools: [getProducts, updateCartUIDef], \u002F\u002F server tool + client definition\n  })\n  return toServerSentEventsResponse(stream)\n}\n",[1454],{"type":67,"tag":100,"props":1455,"children":1456},{"__ignoreMap":97},[1457,1465,1510,1547,1584,1621,1628,1677,1724,1752,1793,1805,1849,1860,1884],{"type":67,"tag":104,"props":1458,"children":1459},{"class":106,"line":107},[1460],{"type":67,"tag":104,"props":1461,"children":1462},{"style":111},[1463],{"type":72,"value":1464},"\u002F\u002F api\u002Fchat\u002Froute.ts\n",{"type":67,"tag":104,"props":1466,"children":1467},{"class":106,"line":117},[1468,1472,1476,1481,1485,1490,1494,1498,1502,1506],{"type":67,"tag":104,"props":1469,"children":1470},{"style":121},[1471],{"type":72,"value":124},{"type":67,"tag":104,"props":1473,"children":1474},{"style":127},[1475],{"type":72,"value":130},{"type":67,"tag":104,"props":1477,"children":1478},{"style":133},[1479],{"type":72,"value":1480}," chat",{"type":67,"tag":104,"props":1482,"children":1483},{"style":127},[1484],{"type":72,"value":661},{"type":67,"tag":104,"props":1486,"children":1487},{"style":133},[1488],{"type":72,"value":1489}," toServerSentEventsResponse",{"type":67,"tag":104,"props":1491,"children":1492},{"style":127},[1493],{"type":72,"value":141},{"type":67,"tag":104,"props":1495,"children":1496},{"style":121},[1497],{"type":72,"value":146},{"type":67,"tag":104,"props":1499,"children":1500},{"style":127},[1501],{"type":72,"value":151},{"type":67,"tag":104,"props":1503,"children":1504},{"style":154},[1505],{"type":72,"value":157},{"type":67,"tag":104,"props":1507,"children":1508},{"style":127},[1509],{"type":72,"value":162},{"type":67,"tag":104,"props":1511,"children":1512},{"class":106,"line":165},[1513,1517,1521,1526,1530,1534,1538,1543],{"type":67,"tag":104,"props":1514,"children":1515},{"style":121},[1516],{"type":72,"value":124},{"type":67,"tag":104,"props":1518,"children":1519},{"style":127},[1520],{"type":72,"value":130},{"type":67,"tag":104,"props":1522,"children":1523},{"style":133},[1524],{"type":72,"value":1525}," openaiText",{"type":67,"tag":104,"props":1527,"children":1528},{"style":127},[1529],{"type":72,"value":141},{"type":67,"tag":104,"props":1531,"children":1532},{"style":121},[1533],{"type":72,"value":146},{"type":67,"tag":104,"props":1535,"children":1536},{"style":127},[1537],{"type":72,"value":151},{"type":67,"tag":104,"props":1539,"children":1540},{"style":154},[1541],{"type":72,"value":1542},"@tanstack\u002Fai-openai",{"type":67,"tag":104,"props":1544,"children":1545},{"style":127},[1546],{"type":72,"value":162},{"type":67,"tag":104,"props":1548,"children":1549},{"class":106,"line":203},[1550,1554,1558,1563,1567,1571,1575,1580],{"type":67,"tag":104,"props":1551,"children":1552},{"style":121},[1553],{"type":72,"value":124},{"type":67,"tag":104,"props":1555,"children":1556},{"style":127},[1557],{"type":72,"value":130},{"type":67,"tag":104,"props":1559,"children":1560},{"style":133},[1561],{"type":72,"value":1562}," getProducts",{"type":67,"tag":104,"props":1564,"children":1565},{"style":127},[1566],{"type":72,"value":141},{"type":67,"tag":104,"props":1568,"children":1569},{"style":121},[1570],{"type":72,"value":146},{"type":67,"tag":104,"props":1572,"children":1573},{"style":127},[1574],{"type":72,"value":151},{"type":67,"tag":104,"props":1576,"children":1577},{"style":154},[1578],{"type":72,"value":1579},"@\u002Ftools\u002Fserver",{"type":67,"tag":104,"props":1581,"children":1582},{"style":127},[1583],{"type":72,"value":162},{"type":67,"tag":104,"props":1585,"children":1586},{"class":106,"line":213},[1587,1591,1595,1600,1604,1608,1612,1617],{"type":67,"tag":104,"props":1588,"children":1589},{"style":121},[1590],{"type":72,"value":124},{"type":67,"tag":104,"props":1592,"children":1593},{"style":127},[1594],{"type":72,"value":130},{"type":67,"tag":104,"props":1596,"children":1597},{"style":133},[1598],{"type":72,"value":1599}," updateCartUIDef",{"type":67,"tag":104,"props":1601,"children":1602},{"style":127},[1603],{"type":72,"value":141},{"type":67,"tag":104,"props":1605,"children":1606},{"style":121},[1607],{"type":72,"value":146},{"type":67,"tag":104,"props":1609,"children":1610},{"style":127},[1611],{"type":72,"value":151},{"type":67,"tag":104,"props":1613,"children":1614},{"style":154},[1615],{"type":72,"value":1616},"@\u002Ftools\u002Fdefinitions",{"type":67,"tag":104,"props":1618,"children":1619},{"style":127},[1620],{"type":72,"value":162},{"type":67,"tag":104,"props":1622,"children":1623},{"class":106,"line":253},[1624],{"type":67,"tag":104,"props":1625,"children":1626},{"emptyLinePlaceholder":207},[1627],{"type":72,"value":210},{"type":67,"tag":104,"props":1629,"children":1630},{"class":106,"line":287},[1631,1635,1640,1645,1650,1654,1659,1663,1669,1673],{"type":67,"tag":104,"props":1632,"children":1633},{"style":121},[1634],{"type":72,"value":219},{"type":67,"tag":104,"props":1636,"children":1637},{"style":222},[1638],{"type":72,"value":1639}," async",{"type":67,"tag":104,"props":1641,"children":1642},{"style":222},[1643],{"type":72,"value":1644}," function",{"type":67,"tag":104,"props":1646,"children":1647},{"style":238},[1648],{"type":72,"value":1649}," POST",{"type":67,"tag":104,"props":1651,"children":1652},{"style":127},[1653],{"type":72,"value":245},{"type":67,"tag":104,"props":1655,"children":1656},{"style":1159},[1657],{"type":72,"value":1658},"request",{"type":67,"tag":104,"props":1660,"children":1661},{"style":127},[1662],{"type":72,"value":265},{"type":67,"tag":104,"props":1664,"children":1666},{"style":1665},"--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B",[1667],{"type":72,"value":1668}," Request",{"type":67,"tag":104,"props":1670,"children":1671},{"style":127},[1672],{"type":72,"value":429},{"type":67,"tag":104,"props":1674,"children":1675},{"style":127},[1676],{"type":72,"value":1186},{"type":67,"tag":104,"props":1678,"children":1679},{"class":106,"line":317},[1680,1684,1688,1693,1697,1701,1705,1710,1714,1719],{"type":67,"tag":104,"props":1681,"children":1682},{"style":222},[1683],{"type":72,"value":1194},{"type":67,"tag":104,"props":1685,"children":1686},{"style":127},[1687],{"type":72,"value":130},{"type":67,"tag":104,"props":1689,"children":1690},{"style":133},[1691],{"type":72,"value":1692}," messages",{"type":67,"tag":104,"props":1694,"children":1695},{"style":127},[1696],{"type":72,"value":141},{"type":67,"tag":104,"props":1698,"children":1699},{"style":127},[1700],{"type":72,"value":1204},{"type":67,"tag":104,"props":1702,"children":1703},{"style":121},[1704],{"type":72,"value":1209},{"type":67,"tag":104,"props":1706,"children":1707},{"style":133},[1708],{"type":72,"value":1709}," request",{"type":67,"tag":104,"props":1711,"children":1712},{"style":127},[1713],{"type":72,"value":336},{"type":67,"tag":104,"props":1715,"children":1716},{"style":238},[1717],{"type":72,"value":1718},"json",{"type":67,"tag":104,"props":1720,"children":1721},{"style":257},[1722],{"type":72,"value":1723},"()\n",{"type":67,"tag":104,"props":1725,"children":1726},{"class":106,"line":352},[1727,1731,1736,1740,1744,1748],{"type":67,"tag":104,"props":1728,"children":1729},{"style":222},[1730],{"type":72,"value":1194},{"type":67,"tag":104,"props":1732,"children":1733},{"style":133},[1734],{"type":72,"value":1735}," stream",{"type":67,"tag":104,"props":1737,"children":1738},{"style":127},[1739],{"type":72,"value":1204},{"type":67,"tag":104,"props":1741,"children":1742},{"style":238},[1743],{"type":72,"value":1480},{"type":67,"tag":104,"props":1745,"children":1746},{"style":257},[1747],{"type":72,"value":245},{"type":67,"tag":104,"props":1749,"children":1750},{"style":127},[1751],{"type":72,"value":250},{"type":67,"tag":104,"props":1753,"children":1754},{"class":106,"line":436},[1755,1760,1764,1768,1772,1776,1781,1785,1789],{"type":67,"tag":104,"props":1756,"children":1757},{"style":257},[1758],{"type":72,"value":1759},"    adapter",{"type":67,"tag":104,"props":1761,"children":1762},{"style":127},[1763],{"type":72,"value":265},{"type":67,"tag":104,"props":1765,"children":1766},{"style":238},[1767],{"type":72,"value":1525},{"type":67,"tag":104,"props":1769,"children":1770},{"style":257},[1771],{"type":72,"value":245},{"type":67,"tag":104,"props":1773,"children":1774},{"style":127},[1775],{"type":72,"value":279},{"type":67,"tag":104,"props":1777,"children":1778},{"style":154},[1779],{"type":72,"value":1780},"gpt-5.5",{"type":67,"tag":104,"props":1782,"children":1783},{"style":127},[1784],{"type":72,"value":279},{"type":67,"tag":104,"props":1786,"children":1787},{"style":257},[1788],{"type":72,"value":429},{"type":67,"tag":104,"props":1790,"children":1791},{"style":127},[1792],{"type":72,"value":284},{"type":67,"tag":104,"props":1794,"children":1795},{"class":106,"line":528},[1796,1801],{"type":67,"tag":104,"props":1797,"children":1798},{"style":133},[1799],{"type":72,"value":1800},"    messages",{"type":67,"tag":104,"props":1802,"children":1803},{"style":127},[1804],{"type":72,"value":284},{"type":67,"tag":104,"props":1806,"children":1807},{"class":106,"line":545},[1808,1813,1817,1822,1827,1831,1835,1840,1844],{"type":67,"tag":104,"props":1809,"children":1810},{"style":257},[1811],{"type":72,"value":1812},"    tools",{"type":67,"tag":104,"props":1814,"children":1815},{"style":127},[1816],{"type":72,"value":265},{"type":67,"tag":104,"props":1818,"children":1819},{"style":257},[1820],{"type":72,"value":1821}," [",{"type":67,"tag":104,"props":1823,"children":1824},{"style":133},[1825],{"type":72,"value":1826},"getProducts",{"type":67,"tag":104,"props":1828,"children":1829},{"style":127},[1830],{"type":72,"value":661},{"type":67,"tag":104,"props":1832,"children":1833},{"style":133},[1834],{"type":72,"value":1599},{"type":67,"tag":104,"props":1836,"children":1837},{"style":257},[1838],{"type":72,"value":1839},"]",{"type":67,"tag":104,"props":1841,"children":1842},{"style":127},[1843],{"type":72,"value":661},{"type":67,"tag":104,"props":1845,"children":1846},{"style":111},[1847],{"type":72,"value":1848}," \u002F\u002F server tool + client definition\n",{"type":67,"tag":104,"props":1850,"children":1851},{"class":106,"line":578},[1852,1856],{"type":67,"tag":104,"props":1853,"children":1854},{"style":127},[1855],{"type":72,"value":534},{"type":67,"tag":104,"props":1857,"children":1858},{"style":257},[1859],{"type":72,"value":771},{"type":67,"tag":104,"props":1861,"children":1862},{"class":106,"line":609},[1863,1867,1871,1875,1880],{"type":67,"tag":104,"props":1864,"children":1865},{"style":121},[1866],{"type":72,"value":1288},{"type":67,"tag":104,"props":1868,"children":1869},{"style":238},[1870],{"type":72,"value":1489},{"type":67,"tag":104,"props":1872,"children":1873},{"style":257},[1874],{"type":72,"value":245},{"type":67,"tag":104,"props":1876,"children":1877},{"style":133},[1878],{"type":72,"value":1879},"stream",{"type":67,"tag":104,"props":1881,"children":1882},{"style":257},[1883],{"type":72,"value":771},{"type":67,"tag":104,"props":1885,"children":1886},{"class":106,"line":732},[1887],{"type":67,"tag":104,"props":1888,"children":1889},{"style":127},[1890],{"type":72,"value":1891},"}\n",{"type":67,"tag":93,"props":1893,"children":1895},{"className":95,"code":1894,"language":15,"meta":97,"style":97},"\u002F\u002F app\u002Fchat.tsx\nimport {\n  useChat,\n  fetchServerSentEvents,\n  clientTools,\n  createChatClientOptions,\n  type InferChatMessages,\n} from \"@tanstack\u002Fai-react\";\nimport { updateCartUIDef } from \"@\u002Ftools\u002Fdefinitions\";\nimport { useState } from \"react\";\n\nfunction ChatPage() {\n  const [cartCount, setCartCount] = useState(0);\n\n  const updateCartUI = updateCartUIDef.client((input) => {\n    setCartCount(input.itemCount);\n    return { displayed: true };\n  });\n\n  const tools = clientTools(updateCartUI);\n  const chatOptions = createChatClientOptions({\n    connection: fetchServerSentEvents(\"\u002Fapi\u002Fchat\"),\n    tools,\n  });\n  const { messages, sendMessage } = useChat(chatOptions);\n  \u002F\u002F InferChatMessages ties part types to the configured tools when needed:\n  \u002F\u002F type Messages = InferChatMessages\u003Ctypeof chatOptions>\n\n  return (\n    \u003Cdiv>\n      \u003Cspan>Cart: {cartCount}\u003C\u002Fspan>\n      {messages.map((msg) => (\n        \u003Cdiv key={msg.id}>\n          {msg.parts.map((part) => {\n            if (part.type === \"text\") return \u003Cp>{part.content}\u003C\u002Fp>;\n            if (part.type === \"tool-call\") {\n              return \u003Cdiv key={part.id}>Tool: {part.name} ({part.state})\u003C\u002Fdiv>;\n            }\n            return null;\n          })}\n        \u003C\u002Fdiv>\n      ))}\n    \u003C\u002Fdiv>\n  );\n}\n",[1896],{"type":67,"tag":100,"props":1897,"children":1898},{"__ignoreMap":97},[1899,1907,1918,1930,1942,1954,1966,1983,2014,2053,2093,2100,2121,2175,2182,2236,2269,2300,2315,2322,2360,2389,2431,2442,2457,2512,2521,2530,2538,2551,2570,2623,2669,2706,2757,2832,2869,2985,2994,3003,3020,3037,3050,3067,3080],{"type":67,"tag":104,"props":1900,"children":1901},{"class":106,"line":107},[1902],{"type":67,"tag":104,"props":1903,"children":1904},{"style":111},[1905],{"type":72,"value":1906},"\u002F\u002F app\u002Fchat.tsx\n",{"type":67,"tag":104,"props":1908,"children":1909},{"class":106,"line":117},[1910,1914],{"type":67,"tag":104,"props":1911,"children":1912},{"style":121},[1913],{"type":72,"value":124},{"type":67,"tag":104,"props":1915,"children":1916},{"style":127},[1917],{"type":72,"value":1186},{"type":67,"tag":104,"props":1919,"children":1920},{"class":106,"line":165},[1921,1926],{"type":67,"tag":104,"props":1922,"children":1923},{"style":133},[1924],{"type":72,"value":1925},"  useChat",{"type":67,"tag":104,"props":1927,"children":1928},{"style":127},[1929],{"type":72,"value":284},{"type":67,"tag":104,"props":1931,"children":1932},{"class":106,"line":203},[1933,1938],{"type":67,"tag":104,"props":1934,"children":1935},{"style":133},[1936],{"type":72,"value":1937},"  fetchServerSentEvents",{"type":67,"tag":104,"props":1939,"children":1940},{"style":127},[1941],{"type":72,"value":284},{"type":67,"tag":104,"props":1943,"children":1944},{"class":106,"line":213},[1945,1950],{"type":67,"tag":104,"props":1946,"children":1947},{"style":133},[1948],{"type":72,"value":1949},"  clientTools",{"type":67,"tag":104,"props":1951,"children":1952},{"style":127},[1953],{"type":72,"value":284},{"type":67,"tag":104,"props":1955,"children":1956},{"class":106,"line":253},[1957,1962],{"type":67,"tag":104,"props":1958,"children":1959},{"style":133},[1960],{"type":72,"value":1961},"  createChatClientOptions",{"type":67,"tag":104,"props":1963,"children":1964},{"style":127},[1965],{"type":72,"value":284},{"type":67,"tag":104,"props":1967,"children":1968},{"class":106,"line":287},[1969,1974,1979],{"type":67,"tag":104,"props":1970,"children":1971},{"style":121},[1972],{"type":72,"value":1973},"  type",{"type":67,"tag":104,"props":1975,"children":1976},{"style":133},[1977],{"type":72,"value":1978}," InferChatMessages",{"type":67,"tag":104,"props":1980,"children":1981},{"style":127},[1982],{"type":72,"value":284},{"type":67,"tag":104,"props":1984,"children":1985},{"class":106,"line":317},[1986,1990,1994,1999,2004,2009],{"type":67,"tag":104,"props":1987,"children":1988},{"style":127},[1989],{"type":72,"value":721},{"type":67,"tag":104,"props":1991,"children":1992},{"style":121},[1993],{"type":72,"value":146},{"type":67,"tag":104,"props":1995,"children":1996},{"style":127},[1997],{"type":72,"value":1998}," \"",{"type":67,"tag":104,"props":2000,"children":2001},{"style":154},[2002],{"type":72,"value":2003},"@tanstack\u002Fai-react",{"type":67,"tag":104,"props":2005,"children":2006},{"style":127},[2007],{"type":72,"value":2008},"\"",{"type":67,"tag":104,"props":2010,"children":2011},{"style":127},[2012],{"type":72,"value":2013},";\n",{"type":67,"tag":104,"props":2015,"children":2016},{"class":106,"line":352},[2017,2021,2025,2029,2033,2037,2041,2045,2049],{"type":67,"tag":104,"props":2018,"children":2019},{"style":121},[2020],{"type":72,"value":124},{"type":67,"tag":104,"props":2022,"children":2023},{"style":127},[2024],{"type":72,"value":130},{"type":67,"tag":104,"props":2026,"children":2027},{"style":133},[2028],{"type":72,"value":1599},{"type":67,"tag":104,"props":2030,"children":2031},{"style":127},[2032],{"type":72,"value":141},{"type":67,"tag":104,"props":2034,"children":2035},{"style":121},[2036],{"type":72,"value":146},{"type":67,"tag":104,"props":2038,"children":2039},{"style":127},[2040],{"type":72,"value":1998},{"type":67,"tag":104,"props":2042,"children":2043},{"style":154},[2044],{"type":72,"value":1616},{"type":67,"tag":104,"props":2046,"children":2047},{"style":127},[2048],{"type":72,"value":2008},{"type":67,"tag":104,"props":2050,"children":2051},{"style":127},[2052],{"type":72,"value":2013},{"type":67,"tag":104,"props":2054,"children":2055},{"class":106,"line":436},[2056,2060,2064,2069,2073,2077,2081,2085,2089],{"type":67,"tag":104,"props":2057,"children":2058},{"style":121},[2059],{"type":72,"value":124},{"type":67,"tag":104,"props":2061,"children":2062},{"style":127},[2063],{"type":72,"value":130},{"type":67,"tag":104,"props":2065,"children":2066},{"style":133},[2067],{"type":72,"value":2068}," useState",{"type":67,"tag":104,"props":2070,"children":2071},{"style":127},[2072],{"type":72,"value":141},{"type":67,"tag":104,"props":2074,"children":2075},{"style":121},[2076],{"type":72,"value":146},{"type":67,"tag":104,"props":2078,"children":2079},{"style":127},[2080],{"type":72,"value":1998},{"type":67,"tag":104,"props":2082,"children":2083},{"style":154},[2084],{"type":72,"value":40},{"type":67,"tag":104,"props":2086,"children":2087},{"style":127},[2088],{"type":72,"value":2008},{"type":67,"tag":104,"props":2090,"children":2091},{"style":127},[2092],{"type":72,"value":2013},{"type":67,"tag":104,"props":2094,"children":2095},{"class":106,"line":528},[2096],{"type":67,"tag":104,"props":2097,"children":2098},{"emptyLinePlaceholder":207},[2099],{"type":72,"value":210},{"type":67,"tag":104,"props":2101,"children":2102},{"class":106,"line":545},[2103,2108,2113,2117],{"type":67,"tag":104,"props":2104,"children":2105},{"style":222},[2106],{"type":72,"value":2107},"function",{"type":67,"tag":104,"props":2109,"children":2110},{"style":238},[2111],{"type":72,"value":2112}," ChatPage",{"type":67,"tag":104,"props":2114,"children":2115},{"style":127},[2116],{"type":72,"value":380},{"type":67,"tag":104,"props":2118,"children":2119},{"style":127},[2120],{"type":72,"value":1186},{"type":67,"tag":104,"props":2122,"children":2123},{"class":106,"line":578},[2124,2128,2132,2137,2141,2146,2150,2154,2158,2162,2167,2171],{"type":67,"tag":104,"props":2125,"children":2126},{"style":222},[2127],{"type":72,"value":1194},{"type":67,"tag":104,"props":2129,"children":2130},{"style":127},[2131],{"type":72,"value":1821},{"type":67,"tag":104,"props":2133,"children":2134},{"style":133},[2135],{"type":72,"value":2136},"cartCount",{"type":67,"tag":104,"props":2138,"children":2139},{"style":127},[2140],{"type":72,"value":661},{"type":67,"tag":104,"props":2142,"children":2143},{"style":133},[2144],{"type":72,"value":2145}," setCartCount",{"type":67,"tag":104,"props":2147,"children":2148},{"style":127},[2149],{"type":72,"value":1839},{"type":67,"tag":104,"props":2151,"children":2152},{"style":127},[2153],{"type":72,"value":1204},{"type":67,"tag":104,"props":2155,"children":2156},{"style":238},[2157],{"type":72,"value":2068},{"type":67,"tag":104,"props":2159,"children":2160},{"style":257},[2161],{"type":72,"value":245},{"type":67,"tag":104,"props":2163,"children":2164},{"style":1269},[2165],{"type":72,"value":2166},"0",{"type":67,"tag":104,"props":2168,"children":2169},{"style":257},[2170],{"type":72,"value":429},{"type":67,"tag":104,"props":2172,"children":2173},{"style":127},[2174],{"type":72,"value":2013},{"type":67,"tag":104,"props":2176,"children":2177},{"class":106,"line":609},[2178],{"type":67,"tag":104,"props":2179,"children":2180},{"emptyLinePlaceholder":207},[2181],{"type":72,"value":210},{"type":67,"tag":104,"props":2183,"children":2184},{"class":106,"line":732},[2185,2189,2194,2198,2202,2206,2211,2215,2219,2224,2228,2232],{"type":67,"tag":104,"props":2186,"children":2187},{"style":222},[2188],{"type":72,"value":1194},{"type":67,"tag":104,"props":2190,"children":2191},{"style":133},[2192],{"type":72,"value":2193}," updateCartUI",{"type":67,"tag":104,"props":2195,"children":2196},{"style":127},[2197],{"type":72,"value":1204},{"type":67,"tag":104,"props":2199,"children":2200},{"style":133},[2201],{"type":72,"value":1599},{"type":67,"tag":104,"props":2203,"children":2204},{"style":127},[2205],{"type":72,"value":336},{"type":67,"tag":104,"props":2207,"children":2208},{"style":238},[2209],{"type":72,"value":2210},"client",{"type":67,"tag":104,"props":2212,"children":2213},{"style":257},[2214],{"type":72,"value":245},{"type":67,"tag":104,"props":2216,"children":2217},{"style":127},[2218],{"type":72,"value":245},{"type":67,"tag":104,"props":2220,"children":2221},{"style":1159},[2222],{"type":72,"value":2223},"input",{"type":67,"tag":104,"props":2225,"children":2226},{"style":127},[2227],{"type":72,"value":429},{"type":67,"tag":104,"props":2229,"children":2230},{"style":222},[2231],{"type":72,"value":1181},{"type":67,"tag":104,"props":2233,"children":2234},{"style":127},[2235],{"type":72,"value":1186},{"type":67,"tag":104,"props":2237,"children":2238},{"class":106,"line":745},[2239,2244,2248,2252,2256,2261,2265],{"type":67,"tag":104,"props":2240,"children":2241},{"style":238},[2242],{"type":72,"value":2243},"    setCartCount",{"type":67,"tag":104,"props":2245,"children":2246},{"style":257},[2247],{"type":72,"value":245},{"type":67,"tag":104,"props":2249,"children":2250},{"style":133},[2251],{"type":72,"value":2223},{"type":67,"tag":104,"props":2253,"children":2254},{"style":127},[2255],{"type":72,"value":336},{"type":67,"tag":104,"props":2257,"children":2258},{"style":133},[2259],{"type":72,"value":2260},"itemCount",{"type":67,"tag":104,"props":2262,"children":2263},{"style":257},[2264],{"type":72,"value":429},{"type":67,"tag":104,"props":2266,"children":2267},{"style":127},[2268],{"type":72,"value":2013},{"type":67,"tag":104,"props":2270,"children":2271},{"class":106,"line":761},[2272,2277,2281,2285,2289,2295],{"type":67,"tag":104,"props":2273,"children":2274},{"style":121},[2275],{"type":72,"value":2276},"    return",{"type":67,"tag":104,"props":2278,"children":2279},{"style":127},[2280],{"type":72,"value":130},{"type":67,"tag":104,"props":2282,"children":2283},{"style":257},[2284],{"type":72,"value":1005},{"type":67,"tag":104,"props":2286,"children":2287},{"style":127},[2288],{"type":72,"value":265},{"type":67,"tag":104,"props":2290,"children":2292},{"style":2291},"--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC",[2293],{"type":72,"value":2294}," true",{"type":67,"tag":104,"props":2296,"children":2297},{"style":127},[2298],{"type":72,"value":2299}," };\n",{"type":67,"tag":104,"props":2301,"children":2302},{"class":106,"line":774},[2303,2307,2311],{"type":67,"tag":104,"props":2304,"children":2305},{"style":127},[2306],{"type":72,"value":534},{"type":67,"tag":104,"props":2308,"children":2309},{"style":257},[2310],{"type":72,"value":429},{"type":67,"tag":104,"props":2312,"children":2313},{"style":127},[2314],{"type":72,"value":2013},{"type":67,"tag":104,"props":2316,"children":2317},{"class":106,"line":782},[2318],{"type":67,"tag":104,"props":2319,"children":2320},{"emptyLinePlaceholder":207},[2321],{"type":72,"value":210},{"type":67,"tag":104,"props":2323,"children":2324},{"class":106,"line":815},[2325,2329,2334,2338,2343,2347,2352,2356],{"type":67,"tag":104,"props":2326,"children":2327},{"style":222},[2328],{"type":72,"value":1194},{"type":67,"tag":104,"props":2330,"children":2331},{"style":133},[2332],{"type":72,"value":2333}," tools",{"type":67,"tag":104,"props":2335,"children":2336},{"style":127},[2337],{"type":72,"value":1204},{"type":67,"tag":104,"props":2339,"children":2340},{"style":238},[2341],{"type":72,"value":2342}," clientTools",{"type":67,"tag":104,"props":2344,"children":2345},{"style":257},[2346],{"type":72,"value":245},{"type":67,"tag":104,"props":2348,"children":2349},{"style":133},[2350],{"type":72,"value":2351},"updateCartUI",{"type":67,"tag":104,"props":2353,"children":2354},{"style":257},[2355],{"type":72,"value":429},{"type":67,"tag":104,"props":2357,"children":2358},{"style":127},[2359],{"type":72,"value":2013},{"type":67,"tag":104,"props":2361,"children":2362},{"class":106,"line":844},[2363,2367,2372,2376,2381,2385],{"type":67,"tag":104,"props":2364,"children":2365},{"style":222},[2366],{"type":72,"value":1194},{"type":67,"tag":104,"props":2368,"children":2369},{"style":133},[2370],{"type":72,"value":2371}," chatOptions",{"type":67,"tag":104,"props":2373,"children":2374},{"style":127},[2375],{"type":72,"value":1204},{"type":67,"tag":104,"props":2377,"children":2378},{"style":238},[2379],{"type":72,"value":2380}," createChatClientOptions",{"type":67,"tag":104,"props":2382,"children":2383},{"style":257},[2384],{"type":72,"value":245},{"type":67,"tag":104,"props":2386,"children":2387},{"style":127},[2388],{"type":72,"value":250},{"type":67,"tag":104,"props":2390,"children":2391},{"class":106,"line":873},[2392,2397,2401,2406,2410,2414,2419,2423,2427],{"type":67,"tag":104,"props":2393,"children":2394},{"style":257},[2395],{"type":72,"value":2396},"    connection",{"type":67,"tag":104,"props":2398,"children":2399},{"style":127},[2400],{"type":72,"value":265},{"type":67,"tag":104,"props":2402,"children":2403},{"style":238},[2404],{"type":72,"value":2405}," fetchServerSentEvents",{"type":67,"tag":104,"props":2407,"children":2408},{"style":257},[2409],{"type":72,"value":245},{"type":67,"tag":104,"props":2411,"children":2412},{"style":127},[2413],{"type":72,"value":2008},{"type":67,"tag":104,"props":2415,"children":2416},{"style":154},[2417],{"type":72,"value":2418},"\u002Fapi\u002Fchat",{"type":67,"tag":104,"props":2420,"children":2421},{"style":127},[2422],{"type":72,"value":2008},{"type":67,"tag":104,"props":2424,"children":2425},{"style":257},[2426],{"type":72,"value":429},{"type":67,"tag":104,"props":2428,"children":2429},{"style":127},[2430],{"type":72,"value":284},{"type":67,"tag":104,"props":2432,"children":2433},{"class":106,"line":971},[2434,2438],{"type":67,"tag":104,"props":2435,"children":2436},{"style":133},[2437],{"type":72,"value":1812},{"type":67,"tag":104,"props":2439,"children":2440},{"style":127},[2441],{"type":72,"value":284},{"type":67,"tag":104,"props":2443,"children":2444},{"class":106,"line":1041},[2445,2449,2453],{"type":67,"tag":104,"props":2446,"children":2447},{"style":127},[2448],{"type":72,"value":534},{"type":67,"tag":104,"props":2450,"children":2451},{"style":257},[2452],{"type":72,"value":429},{"type":67,"tag":104,"props":2454,"children":2455},{"style":127},[2456],{"type":72,"value":2013},{"type":67,"tag":104,"props":2458,"children":2460},{"class":106,"line":2459},25,[2461,2465,2469,2473,2477,2482,2486,2490,2495,2499,2504,2508],{"type":67,"tag":104,"props":2462,"children":2463},{"style":222},[2464],{"type":72,"value":1194},{"type":67,"tag":104,"props":2466,"children":2467},{"style":127},[2468],{"type":72,"value":130},{"type":67,"tag":104,"props":2470,"children":2471},{"style":133},[2472],{"type":72,"value":1692},{"type":67,"tag":104,"props":2474,"children":2475},{"style":127},[2476],{"type":72,"value":661},{"type":67,"tag":104,"props":2478,"children":2479},{"style":133},[2480],{"type":72,"value":2481}," sendMessage",{"type":67,"tag":104,"props":2483,"children":2484},{"style":127},[2485],{"type":72,"value":141},{"type":67,"tag":104,"props":2487,"children":2488},{"style":127},[2489],{"type":72,"value":1204},{"type":67,"tag":104,"props":2491,"children":2492},{"style":238},[2493],{"type":72,"value":2494}," useChat",{"type":67,"tag":104,"props":2496,"children":2497},{"style":257},[2498],{"type":72,"value":245},{"type":67,"tag":104,"props":2500,"children":2501},{"style":133},[2502],{"type":72,"value":2503},"chatOptions",{"type":67,"tag":104,"props":2505,"children":2506},{"style":257},[2507],{"type":72,"value":429},{"type":67,"tag":104,"props":2509,"children":2510},{"style":127},[2511],{"type":72,"value":2013},{"type":67,"tag":104,"props":2513,"children":2515},{"class":106,"line":2514},26,[2516],{"type":67,"tag":104,"props":2517,"children":2518},{"style":111},[2519],{"type":72,"value":2520},"  \u002F\u002F InferChatMessages ties part types to the configured tools when needed:\n",{"type":67,"tag":104,"props":2522,"children":2524},{"class":106,"line":2523},27,[2525],{"type":67,"tag":104,"props":2526,"children":2527},{"style":111},[2528],{"type":72,"value":2529},"  \u002F\u002F type Messages = InferChatMessages\u003Ctypeof chatOptions>\n",{"type":67,"tag":104,"props":2531,"children":2533},{"class":106,"line":2532},28,[2534],{"type":67,"tag":104,"props":2535,"children":2536},{"emptyLinePlaceholder":207},[2537],{"type":72,"value":210},{"type":67,"tag":104,"props":2539,"children":2541},{"class":106,"line":2540},29,[2542,2546],{"type":67,"tag":104,"props":2543,"children":2544},{"style":121},[2545],{"type":72,"value":1288},{"type":67,"tag":104,"props":2547,"children":2548},{"style":257},[2549],{"type":72,"value":2550}," (\n",{"type":67,"tag":104,"props":2552,"children":2554},{"class":106,"line":2553},30,[2555,2560,2565],{"type":67,"tag":104,"props":2556,"children":2557},{"style":257},[2558],{"type":72,"value":2559},"    \u003C",{"type":67,"tag":104,"props":2561,"children":2562},{"style":1665},[2563],{"type":72,"value":2564},"div",{"type":67,"tag":104,"props":2566,"children":2567},{"style":257},[2568],{"type":72,"value":2569},">\n",{"type":67,"tag":104,"props":2571,"children":2573},{"class":106,"line":2572},31,[2574,2579,2583,2588,2593,2597,2601,2605,2610,2615,2619],{"type":67,"tag":104,"props":2575,"children":2576},{"style":257},[2577],{"type":72,"value":2578},"      \u003C",{"type":67,"tag":104,"props":2580,"children":2581},{"style":1665},[2582],{"type":72,"value":104},{"type":67,"tag":104,"props":2584,"children":2585},{"style":257},[2586],{"type":72,"value":2587},">",{"type":67,"tag":104,"props":2589,"children":2590},{"style":1159},[2591],{"type":72,"value":2592},"Cart",{"type":67,"tag":104,"props":2594,"children":2595},{"style":127},[2596],{"type":72,"value":265},{"type":67,"tag":104,"props":2598,"children":2599},{"style":127},[2600],{"type":72,"value":130},{"type":67,"tag":104,"props":2602,"children":2603},{"style":257},[2604],{"type":72,"value":2136},{"type":67,"tag":104,"props":2606,"children":2607},{"style":127},[2608],{"type":72,"value":2609},"}\u003C",{"type":67,"tag":104,"props":2611,"children":2612},{"style":257},[2613],{"type":72,"value":2614},"\u002F",{"type":67,"tag":104,"props":2616,"children":2617},{"style":1665},[2618],{"type":72,"value":104},{"type":67,"tag":104,"props":2620,"children":2621},{"style":127},[2622],{"type":72,"value":2569},{"type":67,"tag":104,"props":2624,"children":2626},{"class":106,"line":2625},32,[2627,2632,2637,2641,2645,2650,2655,2660,2665],{"type":67,"tag":104,"props":2628,"children":2629},{"style":127},[2630],{"type":72,"value":2631},"      {",{"type":67,"tag":104,"props":2633,"children":2634},{"style":1159},[2635],{"type":72,"value":2636},"messages",{"type":67,"tag":104,"props":2638,"children":2639},{"style":257},[2640],{"type":72,"value":336},{"type":67,"tag":104,"props":2642,"children":2643},{"style":1159},[2644],{"type":72,"value":1316},{"type":67,"tag":104,"props":2646,"children":2647},{"style":257},[2648],{"type":72,"value":2649},"((",{"type":67,"tag":104,"props":2651,"children":2652},{"style":1159},[2653],{"type":72,"value":2654},"msg",{"type":67,"tag":104,"props":2656,"children":2657},{"style":257},[2658],{"type":72,"value":2659},") ",{"type":67,"tag":104,"props":2661,"children":2662},{"style":127},[2663],{"type":72,"value":2664},"=>",{"type":67,"tag":104,"props":2666,"children":2667},{"style":257},[2668],{"type":72,"value":2550},{"type":67,"tag":104,"props":2670,"children":2672},{"class":106,"line":2671},33,[2673,2678,2682,2687,2692,2697,2701],{"type":67,"tag":104,"props":2674,"children":2675},{"style":127},[2676],{"type":72,"value":2677},"        \u003C",{"type":67,"tag":104,"props":2679,"children":2680},{"style":133},[2681],{"type":72,"value":2564},{"type":67,"tag":104,"props":2683,"children":2684},{"style":133},[2685],{"type":72,"value":2686}," key",{"type":67,"tag":104,"props":2688,"children":2689},{"style":127},[2690],{"type":72,"value":2691},"={",{"type":67,"tag":104,"props":2693,"children":2694},{"style":257},[2695],{"type":72,"value":2696},"msg.",{"type":67,"tag":104,"props":2698,"children":2699},{"style":133},[2700],{"type":72,"value":1367},{"type":67,"tag":104,"props":2702,"children":2703},{"style":127},[2704],{"type":72,"value":2705},"}>\n",{"type":67,"tag":104,"props":2707,"children":2709},{"class":106,"line":2708},34,[2710,2715,2719,2723,2728,2732,2736,2740,2745,2749,2753],{"type":67,"tag":104,"props":2711,"children":2712},{"style":127},[2713],{"type":72,"value":2714},"          {",{"type":67,"tag":104,"props":2716,"children":2717},{"style":1159},[2718],{"type":72,"value":2654},{"type":67,"tag":104,"props":2720,"children":2721},{"style":257},[2722],{"type":72,"value":336},{"type":67,"tag":104,"props":2724,"children":2725},{"style":1159},[2726],{"type":72,"value":2727},"parts",{"type":67,"tag":104,"props":2729,"children":2730},{"style":257},[2731],{"type":72,"value":336},{"type":67,"tag":104,"props":2733,"children":2734},{"style":1159},[2735],{"type":72,"value":1316},{"type":67,"tag":104,"props":2737,"children":2738},{"style":257},[2739],{"type":72,"value":2649},{"type":67,"tag":104,"props":2741,"children":2742},{"style":1159},[2743],{"type":72,"value":2744},"part",{"type":67,"tag":104,"props":2746,"children":2747},{"style":257},[2748],{"type":72,"value":2659},{"type":67,"tag":104,"props":2750,"children":2751},{"style":127},[2752],{"type":72,"value":2664},{"type":67,"tag":104,"props":2754,"children":2755},{"style":127},[2756],{"type":72,"value":1186},{"type":67,"tag":104,"props":2758,"children":2760},{"class":106,"line":2759},35,[2761,2766,2770,2775,2779,2783,2787,2791,2796,2801,2805,2810,2814,2818,2823,2827],{"type":67,"tag":104,"props":2762,"children":2763},{"style":257},[2764],{"type":72,"value":2765},"            if ",{"type":67,"tag":104,"props":2767,"children":2768},{"style":127},[2769],{"type":72,"value":245},{"type":67,"tag":104,"props":2771,"children":2772},{"style":257},[2773],{"type":72,"value":2774},"part.type === ",{"type":67,"tag":104,"props":2776,"children":2777},{"style":127},[2778],{"type":72,"value":2008},{"type":67,"tag":104,"props":2780,"children":2781},{"style":154},[2782],{"type":72,"value":72},{"type":67,"tag":104,"props":2784,"children":2785},{"style":127},[2786],{"type":72,"value":2008},{"type":67,"tag":104,"props":2788,"children":2789},{"style":127},[2790],{"type":72,"value":429},{"type":67,"tag":104,"props":2792,"children":2793},{"style":257},[2794],{"type":72,"value":2795}," return ",{"type":67,"tag":104,"props":2797,"children":2798},{"style":127},[2799],{"type":72,"value":2800},"\u003C",{"type":67,"tag":104,"props":2802,"children":2803},{"style":1665},[2804],{"type":72,"value":75},{"type":67,"tag":104,"props":2806,"children":2807},{"style":127},[2808],{"type":72,"value":2809},">{",{"type":67,"tag":104,"props":2811,"children":2812},{"style":133},[2813],{"type":72,"value":2744},{"type":67,"tag":104,"props":2815,"children":2816},{"style":127},[2817],{"type":72,"value":336},{"type":67,"tag":104,"props":2819,"children":2820},{"style":133},[2821],{"type":72,"value":2822},"content",{"type":67,"tag":104,"props":2824,"children":2825},{"style":127},[2826],{"type":72,"value":721},{"type":67,"tag":104,"props":2828,"children":2829},{"style":257},[2830],{"type":72,"value":2831},"\u003C\u002Fp>;\n",{"type":67,"tag":104,"props":2833,"children":2835},{"class":106,"line":2834},36,[2836,2840,2844,2848,2852,2857,2861,2865],{"type":67,"tag":104,"props":2837,"children":2838},{"style":257},[2839],{"type":72,"value":2765},{"type":67,"tag":104,"props":2841,"children":2842},{"style":127},[2843],{"type":72,"value":245},{"type":67,"tag":104,"props":2845,"children":2846},{"style":257},[2847],{"type":72,"value":2774},{"type":67,"tag":104,"props":2849,"children":2850},{"style":127},[2851],{"type":72,"value":2008},{"type":67,"tag":104,"props":2853,"children":2854},{"style":154},[2855],{"type":72,"value":2856},"tool-call",{"type":67,"tag":104,"props":2858,"children":2859},{"style":127},[2860],{"type":72,"value":2008},{"type":67,"tag":104,"props":2862,"children":2863},{"style":127},[2864],{"type":72,"value":429},{"type":67,"tag":104,"props":2866,"children":2867},{"style":127},[2868],{"type":72,"value":1186},{"type":67,"tag":104,"props":2870,"children":2872},{"class":106,"line":2871},37,[2873,2878,2883,2887,2891,2895,2899,2903,2907,2911,2915,2919,2924,2929,2933,2938,2942,2946,2950,2954,2958,2963,2967,2971,2976,2980],{"type":67,"tag":104,"props":2874,"children":2875},{"style":121},[2876],{"type":72,"value":2877},"              return",{"type":67,"tag":104,"props":2879,"children":2880},{"style":257},[2881],{"type":72,"value":2882}," \u003C",{"type":67,"tag":104,"props":2884,"children":2885},{"style":1665},[2886],{"type":72,"value":2564},{"type":67,"tag":104,"props":2888,"children":2889},{"style":1665},[2890],{"type":72,"value":2686},{"type":67,"tag":104,"props":2892,"children":2893},{"style":257},[2894],{"type":72,"value":235},{"type":67,"tag":104,"props":2896,"children":2897},{"style":127},[2898],{"type":72,"value":398},{"type":67,"tag":104,"props":2900,"children":2901},{"style":1665},[2902],{"type":72,"value":2744},{"type":67,"tag":104,"props":2904,"children":2905},{"style":127},[2906],{"type":72,"value":336},{"type":67,"tag":104,"props":2908,"children":2909},{"style":257},[2910],{"type":72,"value":1367},{"type":67,"tag":104,"props":2912,"children":2913},{"style":127},[2914],{"type":72,"value":721},{"type":67,"tag":104,"props":2916,"children":2917},{"style":257},[2918],{"type":72,"value":2587},{"type":67,"tag":104,"props":2920,"children":2921},{"style":133},[2922],{"type":72,"value":2923},"Tool",{"type":67,"tag":104,"props":2925,"children":2926},{"style":257},[2927],{"type":72,"value":2928},": ",{"type":67,"tag":104,"props":2930,"children":2931},{"style":127},[2932],{"type":72,"value":398},{"type":67,"tag":104,"props":2934,"children":2935},{"style":257},[2936],{"type":72,"value":2937},"part.",{"type":67,"tag":104,"props":2939,"children":2940},{"style":133},[2941],{"type":72,"value":1392},{"type":67,"tag":104,"props":2943,"children":2944},{"style":127},[2945],{"type":72,"value":721},{"type":67,"tag":104,"props":2947,"children":2948},{"style":257},[2949],{"type":72,"value":1341},{"type":67,"tag":104,"props":2951,"children":2952},{"style":127},[2953],{"type":72,"value":398},{"type":67,"tag":104,"props":2955,"children":2956},{"style":257},[2957],{"type":72,"value":2937},{"type":67,"tag":104,"props":2959,"children":2960},{"style":133},[2961],{"type":72,"value":2962},"state",{"type":67,"tag":104,"props":2964,"children":2965},{"style":127},[2966],{"type":72,"value":721},{"type":67,"tag":104,"props":2968,"children":2969},{"style":257},[2970],{"type":72,"value":429},{"type":67,"tag":104,"props":2972,"children":2973},{"style":127},[2974],{"type":72,"value":2975},"\u003C\u002F",{"type":67,"tag":104,"props":2977,"children":2978},{"style":133},[2979],{"type":72,"value":2564},{"type":67,"tag":104,"props":2981,"children":2982},{"style":127},[2983],{"type":72,"value":2984},">;\n",{"type":67,"tag":104,"props":2986,"children":2988},{"class":106,"line":2987},38,[2989],{"type":67,"tag":104,"props":2990,"children":2991},{"style":127},[2992],{"type":72,"value":2993},"            }\n",{"type":67,"tag":104,"props":2995,"children":2997},{"class":106,"line":2996},39,[2998],{"type":67,"tag":104,"props":2999,"children":3000},{"style":257},[3001],{"type":72,"value":3002},"            return null;\n",{"type":67,"tag":104,"props":3004,"children":3006},{"class":106,"line":3005},40,[3007,3012,3016],{"type":67,"tag":104,"props":3008,"children":3009},{"style":127},[3010],{"type":72,"value":3011},"          }",{"type":67,"tag":104,"props":3013,"children":3014},{"style":257},[3015],{"type":72,"value":429},{"type":67,"tag":104,"props":3017,"children":3018},{"style":127},[3019],{"type":72,"value":1891},{"type":67,"tag":104,"props":3021,"children":3023},{"class":106,"line":3022},41,[3024,3029,3033],{"type":67,"tag":104,"props":3025,"children":3026},{"style":127},[3027],{"type":72,"value":3028},"        \u003C\u002F",{"type":67,"tag":104,"props":3030,"children":3031},{"style":133},[3032],{"type":72,"value":2564},{"type":67,"tag":104,"props":3034,"children":3035},{"style":127},[3036],{"type":72,"value":2569},{"type":67,"tag":104,"props":3038,"children":3040},{"class":106,"line":3039},42,[3041,3046],{"type":67,"tag":104,"props":3042,"children":3043},{"style":257},[3044],{"type":72,"value":3045},"      ))",{"type":67,"tag":104,"props":3047,"children":3048},{"style":127},[3049],{"type":72,"value":1891},{"type":67,"tag":104,"props":3051,"children":3053},{"class":106,"line":3052},43,[3054,3059,3063],{"type":67,"tag":104,"props":3055,"children":3056},{"style":127},[3057],{"type":72,"value":3058},"    \u003C\u002F",{"type":67,"tag":104,"props":3060,"children":3061},{"style":133},[3062],{"type":72,"value":2564},{"type":67,"tag":104,"props":3064,"children":3065},{"style":127},[3066],{"type":72,"value":2569},{"type":67,"tag":104,"props":3068,"children":3070},{"class":106,"line":3069},44,[3071,3076],{"type":67,"tag":104,"props":3072,"children":3073},{"style":257},[3074],{"type":72,"value":3075},"  )",{"type":67,"tag":104,"props":3077,"children":3078},{"style":127},[3079],{"type":72,"value":2013},{"type":67,"tag":104,"props":3081,"children":3083},{"class":106,"line":3082},45,[3084],{"type":67,"tag":104,"props":3085,"children":3086},{"style":127},[3087],{"type":72,"value":1891},{"type":67,"tag":81,"props":3089,"children":3091},{"id":3090},"core-patterns",[3092],{"type":72,"value":3093},"Core Patterns",{"type":67,"tag":3095,"props":3096,"children":3098},"h3",{"id":3097},"pattern-1-server-only-tool",[3099],{"type":72,"value":3100},"Pattern 1: Server-Only Tool",{"type":67,"tag":75,"props":3102,"children":3103},{},[3104,3106,3112,3114,3120,3122,3128],{"type":72,"value":3105},"Define with ",{"type":67,"tag":100,"props":3107,"children":3109},{"className":3108},[],[3110],{"type":72,"value":3111},"toolDefinition()",{"type":72,"value":3113},", implement with ",{"type":67,"tag":100,"props":3115,"children":3117},{"className":3116},[],[3118],{"type":72,"value":3119},".server()",{"type":72,"value":3121},", pass to ",{"type":67,"tag":100,"props":3123,"children":3125},{"className":3124},[],[3126],{"type":72,"value":3127},"chat({ tools })",{"type":72,"value":3129},".\nThe server executes it automatically. The client never runs code for this tool.",{"type":67,"tag":93,"props":3131,"children":3133},{"className":95,"code":3132,"language":15,"meta":97,"style":97},"import { toolDefinition } from '@tanstack\u002Fai'\nimport { z } from 'zod'\n\nconst getUserDataDef = toolDefinition({\n  name: 'get_user_data',\n  description: 'Look up user by ID',\n  inputSchema: z.object({\n    userId: z.string().meta({ description: \"The user's ID\" }),\n  }),\n  outputSchema: z.object({ name: z.string(), email: z.string() }),\n})\n\nconst getUserData = getUserDataDef.server(async ({ userId }) => {\n  const user = await db.users.findUnique({ where: { id: userId } })\n  return { name: user.name, email: user.email }\n})\n\n\u002F\u002F In your route handler:\nconst stream = chat({\n  adapter: openaiText('gpt-5.5'),\n  messages,\n  tools: [getUserData],\n})\n",[3134],{"type":67,"tag":100,"props":3135,"children":3136},{"__ignoreMap":97},[3137,3172,3207,3214,3243,3271,3299,3330,3407,3422,3518,3529,3536,3594,3681,3742,3753,3760,3768,3796,3836,3848,3869],{"type":67,"tag":104,"props":3138,"children":3139},{"class":106,"line":107},[3140,3144,3148,3152,3156,3160,3164,3168],{"type":67,"tag":104,"props":3141,"children":3142},{"style":121},[3143],{"type":72,"value":124},{"type":67,"tag":104,"props":3145,"children":3146},{"style":127},[3147],{"type":72,"value":130},{"type":67,"tag":104,"props":3149,"children":3150},{"style":133},[3151],{"type":72,"value":136},{"type":67,"tag":104,"props":3153,"children":3154},{"style":127},[3155],{"type":72,"value":141},{"type":67,"tag":104,"props":3157,"children":3158},{"style":121},[3159],{"type":72,"value":146},{"type":67,"tag":104,"props":3161,"children":3162},{"style":127},[3163],{"type":72,"value":151},{"type":67,"tag":104,"props":3165,"children":3166},{"style":154},[3167],{"type":72,"value":157},{"type":67,"tag":104,"props":3169,"children":3170},{"style":127},[3171],{"type":72,"value":162},{"type":67,"tag":104,"props":3173,"children":3174},{"class":106,"line":117},[3175,3179,3183,3187,3191,3195,3199,3203],{"type":67,"tag":104,"props":3176,"children":3177},{"style":121},[3178],{"type":72,"value":124},{"type":67,"tag":104,"props":3180,"children":3181},{"style":127},[3182],{"type":72,"value":130},{"type":67,"tag":104,"props":3184,"children":3185},{"style":133},[3186],{"type":72,"value":179},{"type":67,"tag":104,"props":3188,"children":3189},{"style":127},[3190],{"type":72,"value":141},{"type":67,"tag":104,"props":3192,"children":3193},{"style":121},[3194],{"type":72,"value":146},{"type":67,"tag":104,"props":3196,"children":3197},{"style":127},[3198],{"type":72,"value":151},{"type":67,"tag":104,"props":3200,"children":3201},{"style":154},[3202],{"type":72,"value":196},{"type":67,"tag":104,"props":3204,"children":3205},{"style":127},[3206],{"type":72,"value":162},{"type":67,"tag":104,"props":3208,"children":3209},{"class":106,"line":165},[3210],{"type":67,"tag":104,"props":3211,"children":3212},{"emptyLinePlaceholder":207},[3213],{"type":72,"value":210},{"type":67,"tag":104,"props":3215,"children":3216},{"class":106,"line":203},[3217,3222,3227,3231,3235,3239],{"type":67,"tag":104,"props":3218,"children":3219},{"style":222},[3220],{"type":72,"value":3221},"const",{"type":67,"tag":104,"props":3223,"children":3224},{"style":133},[3225],{"type":72,"value":3226}," getUserDataDef ",{"type":67,"tag":104,"props":3228,"children":3229},{"style":127},[3230],{"type":72,"value":235},{"type":67,"tag":104,"props":3232,"children":3233},{"style":238},[3234],{"type":72,"value":136},{"type":67,"tag":104,"props":3236,"children":3237},{"style":133},[3238],{"type":72,"value":245},{"type":67,"tag":104,"props":3240,"children":3241},{"style":127},[3242],{"type":72,"value":250},{"type":67,"tag":104,"props":3244,"children":3245},{"class":106,"line":213},[3246,3250,3254,3258,3263,3267],{"type":67,"tag":104,"props":3247,"children":3248},{"style":257},[3249],{"type":72,"value":260},{"type":67,"tag":104,"props":3251,"children":3252},{"style":127},[3253],{"type":72,"value":265},{"type":67,"tag":104,"props":3255,"children":3256},{"style":127},[3257],{"type":72,"value":151},{"type":67,"tag":104,"props":3259,"children":3260},{"style":154},[3261],{"type":72,"value":3262},"get_user_data",{"type":67,"tag":104,"props":3264,"children":3265},{"style":127},[3266],{"type":72,"value":279},{"type":67,"tag":104,"props":3268,"children":3269},{"style":127},[3270],{"type":72,"value":284},{"type":67,"tag":104,"props":3272,"children":3273},{"class":106,"line":253},[3274,3278,3282,3286,3291,3295],{"type":67,"tag":104,"props":3275,"children":3276},{"style":257},[3277],{"type":72,"value":293},{"type":67,"tag":104,"props":3279,"children":3280},{"style":127},[3281],{"type":72,"value":265},{"type":67,"tag":104,"props":3283,"children":3284},{"style":127},[3285],{"type":72,"value":151},{"type":67,"tag":104,"props":3287,"children":3288},{"style":154},[3289],{"type":72,"value":3290},"Look up user by ID",{"type":67,"tag":104,"props":3292,"children":3293},{"style":127},[3294],{"type":72,"value":279},{"type":67,"tag":104,"props":3296,"children":3297},{"style":127},[3298],{"type":72,"value":284},{"type":67,"tag":104,"props":3300,"children":3301},{"class":106,"line":287},[3302,3306,3310,3314,3318,3322,3326],{"type":67,"tag":104,"props":3303,"children":3304},{"style":257},[3305],{"type":72,"value":323},{"type":67,"tag":104,"props":3307,"children":3308},{"style":127},[3309],{"type":72,"value":265},{"type":67,"tag":104,"props":3311,"children":3312},{"style":133},[3313],{"type":72,"value":179},{"type":67,"tag":104,"props":3315,"children":3316},{"style":127},[3317],{"type":72,"value":336},{"type":67,"tag":104,"props":3319,"children":3320},{"style":238},[3321],{"type":72,"value":341},{"type":67,"tag":104,"props":3323,"children":3324},{"style":133},[3325],{"type":72,"value":245},{"type":67,"tag":104,"props":3327,"children":3328},{"style":127},[3329],{"type":72,"value":250},{"type":67,"tag":104,"props":3331,"children":3332},{"class":106,"line":317},[3333,3338,3342,3346,3350,3354,3358,3362,3366,3370,3374,3378,3382,3386,3391,3395,3399,3403],{"type":67,"tag":104,"props":3334,"children":3335},{"style":257},[3336],{"type":72,"value":3337},"    userId",{"type":67,"tag":104,"props":3339,"children":3340},{"style":127},[3341],{"type":72,"value":265},{"type":67,"tag":104,"props":3343,"children":3344},{"style":133},[3345],{"type":72,"value":179},{"type":67,"tag":104,"props":3347,"children":3348},{"style":127},[3349],{"type":72,"value":336},{"type":67,"tag":104,"props":3351,"children":3352},{"style":238},[3353],{"type":72,"value":375},{"type":67,"tag":104,"props":3355,"children":3356},{"style":133},[3357],{"type":72,"value":380},{"type":67,"tag":104,"props":3359,"children":3360},{"style":127},[3361],{"type":72,"value":336},{"type":67,"tag":104,"props":3363,"children":3364},{"style":238},[3365],{"type":72,"value":389},{"type":67,"tag":104,"props":3367,"children":3368},{"style":133},[3369],{"type":72,"value":245},{"type":67,"tag":104,"props":3371,"children":3372},{"style":127},[3373],{"type":72,"value":398},{"type":67,"tag":104,"props":3375,"children":3376},{"style":257},[3377],{"type":72,"value":403},{"type":67,"tag":104,"props":3379,"children":3380},{"style":127},[3381],{"type":72,"value":265},{"type":67,"tag":104,"props":3383,"children":3384},{"style":127},[3385],{"type":72,"value":1998},{"type":67,"tag":104,"props":3387,"children":3388},{"style":154},[3389],{"type":72,"value":3390},"The user's ID",{"type":67,"tag":104,"props":3392,"children":3393},{"style":127},[3394],{"type":72,"value":2008},{"type":67,"tag":104,"props":3396,"children":3397},{"style":127},[3398],{"type":72,"value":141},{"type":67,"tag":104,"props":3400,"children":3401},{"style":133},[3402],{"type":72,"value":429},{"type":67,"tag":104,"props":3404,"children":3405},{"style":127},[3406],{"type":72,"value":284},{"type":67,"tag":104,"props":3408,"children":3409},{"class":106,"line":352},[3410,3414,3418],{"type":67,"tag":104,"props":3411,"children":3412},{"style":127},[3413],{"type":72,"value":534},{"type":67,"tag":104,"props":3415,"children":3416},{"style":133},[3417],{"type":72,"value":429},{"type":67,"tag":104,"props":3419,"children":3420},{"style":127},[3421],{"type":72,"value":284},{"type":67,"tag":104,"props":3423,"children":3424},{"class":106,"line":436},[3425,3429,3433,3437,3441,3445,3449,3453,3457,3461,3465,3469,3473,3477,3481,3486,3490,3494,3498,3502,3506,3510,3514],{"type":67,"tag":104,"props":3426,"children":3427},{"style":257},[3428],{"type":72,"value":551},{"type":67,"tag":104,"props":3430,"children":3431},{"style":127},[3432],{"type":72,"value":265},{"type":67,"tag":104,"props":3434,"children":3435},{"style":133},[3436],{"type":72,"value":179},{"type":67,"tag":104,"props":3438,"children":3439},{"style":127},[3440],{"type":72,"value":336},{"type":67,"tag":104,"props":3442,"children":3443},{"style":238},[3444],{"type":72,"value":341},{"type":67,"tag":104,"props":3446,"children":3447},{"style":133},[3448],{"type":72,"value":245},{"type":67,"tag":104,"props":3450,"children":3451},{"style":127},[3452],{"type":72,"value":398},{"type":67,"tag":104,"props":3454,"children":3455},{"style":257},[3456],{"type":72,"value":666},{"type":67,"tag":104,"props":3458,"children":3459},{"style":127},[3460],{"type":72,"value":265},{"type":67,"tag":104,"props":3462,"children":3463},{"style":133},[3464],{"type":72,"value":179},{"type":67,"tag":104,"props":3466,"children":3467},{"style":127},[3468],{"type":72,"value":336},{"type":67,"tag":104,"props":3470,"children":3471},{"style":238},[3472],{"type":72,"value":375},{"type":67,"tag":104,"props":3474,"children":3475},{"style":133},[3476],{"type":72,"value":380},{"type":67,"tag":104,"props":3478,"children":3479},{"style":127},[3480],{"type":72,"value":661},{"type":67,"tag":104,"props":3482,"children":3483},{"style":257},[3484],{"type":72,"value":3485}," email",{"type":67,"tag":104,"props":3487,"children":3488},{"style":127},[3489],{"type":72,"value":265},{"type":67,"tag":104,"props":3491,"children":3492},{"style":133},[3493],{"type":72,"value":179},{"type":67,"tag":104,"props":3495,"children":3496},{"style":127},[3497],{"type":72,"value":336},{"type":67,"tag":104,"props":3499,"children":3500},{"style":238},[3501],{"type":72,"value":375},{"type":67,"tag":104,"props":3503,"children":3504},{"style":133},[3505],{"type":72,"value":716},{"type":67,"tag":104,"props":3507,"children":3508},{"style":127},[3509],{"type":72,"value":721},{"type":67,"tag":104,"props":3511,"children":3512},{"style":133},[3513],{"type":72,"value":429},{"type":67,"tag":104,"props":3515,"children":3516},{"style":127},[3517],{"type":72,"value":284},{"type":67,"tag":104,"props":3519,"children":3520},{"class":106,"line":528},[3521,3525],{"type":67,"tag":104,"props":3522,"children":3523},{"style":127},[3524],{"type":72,"value":721},{"type":67,"tag":104,"props":3526,"children":3527},{"style":133},[3528],{"type":72,"value":771},{"type":67,"tag":104,"props":3530,"children":3531},{"class":106,"line":545},[3532],{"type":67,"tag":104,"props":3533,"children":3534},{"emptyLinePlaceholder":207},[3535],{"type":72,"value":210},{"type":67,"tag":104,"props":3537,"children":3538},{"class":106,"line":578},[3539,3543,3548,3552,3557,3561,3565,3569,3573,3577,3582,3586,3590],{"type":67,"tag":104,"props":3540,"children":3541},{"style":222},[3542],{"type":72,"value":3221},{"type":67,"tag":104,"props":3544,"children":3545},{"style":133},[3546],{"type":72,"value":3547}," getUserData ",{"type":67,"tag":104,"props":3549,"children":3550},{"style":127},[3551],{"type":72,"value":235},{"type":67,"tag":104,"props":3553,"children":3554},{"style":133},[3555],{"type":72,"value":3556}," getUserDataDef",{"type":67,"tag":104,"props":3558,"children":3559},{"style":127},[3560],{"type":72,"value":336},{"type":67,"tag":104,"props":3562,"children":3563},{"style":238},[3564],{"type":72,"value":1142},{"type":67,"tag":104,"props":3566,"children":3567},{"style":133},[3568],{"type":72,"value":245},{"type":67,"tag":104,"props":3570,"children":3571},{"style":222},[3572],{"type":72,"value":1151},{"type":67,"tag":104,"props":3574,"children":3575},{"style":127},[3576],{"type":72,"value":1156},{"type":67,"tag":104,"props":3578,"children":3579},{"style":1159},[3580],{"type":72,"value":3581}," userId",{"type":67,"tag":104,"props":3583,"children":3584},{"style":127},[3585],{"type":72,"value":1176},{"type":67,"tag":104,"props":3587,"children":3588},{"style":222},[3589],{"type":72,"value":1181},{"type":67,"tag":104,"props":3591,"children":3592},{"style":127},[3593],{"type":72,"value":1186},{"type":67,"tag":104,"props":3595,"children":3596},{"class":106,"line":609},[3597,3601,3606,3610,3614,3618,3622,3627,3631,3636,3640,3644,3649,3653,3657,3661,3665,3669,3673,3677],{"type":67,"tag":104,"props":3598,"children":3599},{"style":222},[3600],{"type":72,"value":1194},{"type":67,"tag":104,"props":3602,"children":3603},{"style":133},[3604],{"type":72,"value":3605}," user",{"type":67,"tag":104,"props":3607,"children":3608},{"style":127},[3609],{"type":72,"value":1204},{"type":67,"tag":104,"props":3611,"children":3612},{"style":121},[3613],{"type":72,"value":1209},{"type":67,"tag":104,"props":3615,"children":3616},{"style":133},[3617],{"type":72,"value":1214},{"type":67,"tag":104,"props":3619,"children":3620},{"style":127},[3621],{"type":72,"value":336},{"type":67,"tag":104,"props":3623,"children":3624},{"style":133},[3625],{"type":72,"value":3626},"users",{"type":67,"tag":104,"props":3628,"children":3629},{"style":127},[3630],{"type":72,"value":336},{"type":67,"tag":104,"props":3632,"children":3633},{"style":238},[3634],{"type":72,"value":3635},"findUnique",{"type":67,"tag":104,"props":3637,"children":3638},{"style":257},[3639],{"type":72,"value":245},{"type":67,"tag":104,"props":3641,"children":3642},{"style":127},[3643],{"type":72,"value":398},{"type":67,"tag":104,"props":3645,"children":3646},{"style":257},[3647],{"type":72,"value":3648}," where",{"type":67,"tag":104,"props":3650,"children":3651},{"style":127},[3652],{"type":72,"value":265},{"type":67,"tag":104,"props":3654,"children":3655},{"style":127},[3656],{"type":72,"value":130},{"type":67,"tag":104,"props":3658,"children":3659},{"style":257},[3660],{"type":72,"value":636},{"type":67,"tag":104,"props":3662,"children":3663},{"style":127},[3664],{"type":72,"value":265},{"type":67,"tag":104,"props":3666,"children":3667},{"style":133},[3668],{"type":72,"value":3581},{"type":67,"tag":104,"props":3670,"children":3671},{"style":127},[3672],{"type":72,"value":141},{"type":67,"tag":104,"props":3674,"children":3675},{"style":127},[3676],{"type":72,"value":141},{"type":67,"tag":104,"props":3678,"children":3679},{"style":257},[3680],{"type":72,"value":771},{"type":67,"tag":104,"props":3682,"children":3683},{"class":106,"line":732},[3684,3688,3692,3696,3700,3704,3708,3712,3716,3720,3724,3728,3732,3737],{"type":67,"tag":104,"props":3685,"children":3686},{"style":121},[3687],{"type":72,"value":1288},{"type":67,"tag":104,"props":3689,"children":3690},{"style":127},[3691],{"type":72,"value":130},{"type":67,"tag":104,"props":3693,"children":3694},{"style":257},[3695],{"type":72,"value":666},{"type":67,"tag":104,"props":3697,"children":3698},{"style":127},[3699],{"type":72,"value":265},{"type":67,"tag":104,"props":3701,"children":3702},{"style":133},[3703],{"type":72,"value":3605},{"type":67,"tag":104,"props":3705,"children":3706},{"style":127},[3707],{"type":72,"value":336},{"type":67,"tag":104,"props":3709,"children":3710},{"style":133},[3711],{"type":72,"value":1392},{"type":67,"tag":104,"props":3713,"children":3714},{"style":127},[3715],{"type":72,"value":661},{"type":67,"tag":104,"props":3717,"children":3718},{"style":257},[3719],{"type":72,"value":3485},{"type":67,"tag":104,"props":3721,"children":3722},{"style":127},[3723],{"type":72,"value":265},{"type":67,"tag":104,"props":3725,"children":3726},{"style":133},[3727],{"type":72,"value":3605},{"type":67,"tag":104,"props":3729,"children":3730},{"style":127},[3731],{"type":72,"value":336},{"type":67,"tag":104,"props":3733,"children":3734},{"style":133},[3735],{"type":72,"value":3736},"email",{"type":67,"tag":104,"props":3738,"children":3739},{"style":127},[3740],{"type":72,"value":3741}," }\n",{"type":67,"tag":104,"props":3743,"children":3744},{"class":106,"line":745},[3745,3749],{"type":67,"tag":104,"props":3746,"children":3747},{"style":127},[3748],{"type":72,"value":721},{"type":67,"tag":104,"props":3750,"children":3751},{"style":133},[3752],{"type":72,"value":771},{"type":67,"tag":104,"props":3754,"children":3755},{"class":106,"line":761},[3756],{"type":67,"tag":104,"props":3757,"children":3758},{"emptyLinePlaceholder":207},[3759],{"type":72,"value":210},{"type":67,"tag":104,"props":3761,"children":3762},{"class":106,"line":774},[3763],{"type":67,"tag":104,"props":3764,"children":3765},{"style":111},[3766],{"type":72,"value":3767},"\u002F\u002F In your route handler:\n",{"type":67,"tag":104,"props":3769,"children":3770},{"class":106,"line":782},[3771,3775,3780,3784,3788,3792],{"type":67,"tag":104,"props":3772,"children":3773},{"style":222},[3774],{"type":72,"value":3221},{"type":67,"tag":104,"props":3776,"children":3777},{"style":133},[3778],{"type":72,"value":3779}," stream ",{"type":67,"tag":104,"props":3781,"children":3782},{"style":127},[3783],{"type":72,"value":235},{"type":67,"tag":104,"props":3785,"children":3786},{"style":238},[3787],{"type":72,"value":1480},{"type":67,"tag":104,"props":3789,"children":3790},{"style":133},[3791],{"type":72,"value":245},{"type":67,"tag":104,"props":3793,"children":3794},{"style":127},[3795],{"type":72,"value":250},{"type":67,"tag":104,"props":3797,"children":3798},{"class":106,"line":815},[3799,3804,3808,3812,3816,3820,3824,3828,3832],{"type":67,"tag":104,"props":3800,"children":3801},{"style":257},[3802],{"type":72,"value":3803},"  adapter",{"type":67,"tag":104,"props":3805,"children":3806},{"style":127},[3807],{"type":72,"value":265},{"type":67,"tag":104,"props":3809,"children":3810},{"style":238},[3811],{"type":72,"value":1525},{"type":67,"tag":104,"props":3813,"children":3814},{"style":133},[3815],{"type":72,"value":245},{"type":67,"tag":104,"props":3817,"children":3818},{"style":127},[3819],{"type":72,"value":279},{"type":67,"tag":104,"props":3821,"children":3822},{"style":154},[3823],{"type":72,"value":1780},{"type":67,"tag":104,"props":3825,"children":3826},{"style":127},[3827],{"type":72,"value":279},{"type":67,"tag":104,"props":3829,"children":3830},{"style":133},[3831],{"type":72,"value":429},{"type":67,"tag":104,"props":3833,"children":3834},{"style":127},[3835],{"type":72,"value":284},{"type":67,"tag":104,"props":3837,"children":3838},{"class":106,"line":844},[3839,3844],{"type":67,"tag":104,"props":3840,"children":3841},{"style":133},[3842],{"type":72,"value":3843},"  messages",{"type":67,"tag":104,"props":3845,"children":3846},{"style":127},[3847],{"type":72,"value":284},{"type":67,"tag":104,"props":3849,"children":3850},{"class":106,"line":873},[3851,3856,3860,3865],{"type":67,"tag":104,"props":3852,"children":3853},{"style":257},[3854],{"type":72,"value":3855},"  tools",{"type":67,"tag":104,"props":3857,"children":3858},{"style":127},[3859],{"type":72,"value":265},{"type":67,"tag":104,"props":3861,"children":3862},{"style":133},[3863],{"type":72,"value":3864}," [getUserData]",{"type":67,"tag":104,"props":3866,"children":3867},{"style":127},[3868],{"type":72,"value":284},{"type":67,"tag":104,"props":3870,"children":3871},{"class":106,"line":971},[3872,3876],{"type":67,"tag":104,"props":3873,"children":3874},{"style":127},[3875],{"type":72,"value":721},{"type":67,"tag":104,"props":3877,"children":3878},{"style":133},[3879],{"type":72,"value":771},{"type":67,"tag":3095,"props":3881,"children":3883},{"id":3882},"pattern-2-client-only-tool",[3884],{"type":72,"value":3885},"Pattern 2: Client-Only Tool",{"type":67,"tag":75,"props":3887,"children":3888},{},[3889,3891,3896,3898,3903,3905,3911,3913,3919,3921,3927],{"type":72,"value":3890},"Pass the bare definition (no ",{"type":67,"tag":100,"props":3892,"children":3894},{"className":3893},[],[3895],{"type":72,"value":3119},{"type":72,"value":3897},") to ",{"type":67,"tag":100,"props":3899,"children":3901},{"className":3900},[],[3902],{"type":72,"value":3127},{"type":72,"value":3904}," so the LLM knows\nabout it. Pass the ",{"type":67,"tag":100,"props":3906,"children":3908},{"className":3907},[],[3909],{"type":72,"value":3910},".client()",{"type":72,"value":3912}," implementation to ",{"type":67,"tag":100,"props":3914,"children":3916},{"className":3915},[],[3917],{"type":72,"value":3918},"useChat",{"type":72,"value":3920}," via ",{"type":67,"tag":100,"props":3922,"children":3924},{"className":3923},[],[3925],{"type":72,"value":3926},"clientTools()",{"type":72,"value":336},{"type":67,"tag":93,"props":3929,"children":3931},{"className":95,"code":3930,"language":15,"meta":97,"style":97},"import { toolDefinition } from '@tanstack\u002Fai'\nimport { z } from 'zod'\n\nexport const showNotificationDef = toolDefinition({\n  name: 'show_notification',\n  description: 'Display a toast notification to the user',\n  inputSchema: z.object({\n    message: z.string(),\n    type: z.enum(['success', 'error', 'info']),\n  }),\n  outputSchema: z.object({ shown: z.boolean() }),\n})\n",[3932],{"type":67,"tag":100,"props":3933,"children":3934},{"__ignoreMap":97},[3935,3970,4005,4012,4044,4072,4100,4131,4163,4249,4264,4332],{"type":67,"tag":104,"props":3936,"children":3937},{"class":106,"line":107},[3938,3942,3946,3950,3954,3958,3962,3966],{"type":67,"tag":104,"props":3939,"children":3940},{"style":121},[3941],{"type":72,"value":124},{"type":67,"tag":104,"props":3943,"children":3944},{"style":127},[3945],{"type":72,"value":130},{"type":67,"tag":104,"props":3947,"children":3948},{"style":133},[3949],{"type":72,"value":136},{"type":67,"tag":104,"props":3951,"children":3952},{"style":127},[3953],{"type":72,"value":141},{"type":67,"tag":104,"props":3955,"children":3956},{"style":121},[3957],{"type":72,"value":146},{"type":67,"tag":104,"props":3959,"children":3960},{"style":127},[3961],{"type":72,"value":151},{"type":67,"tag":104,"props":3963,"children":3964},{"style":154},[3965],{"type":72,"value":157},{"type":67,"tag":104,"props":3967,"children":3968},{"style":127},[3969],{"type":72,"value":162},{"type":67,"tag":104,"props":3971,"children":3972},{"class":106,"line":117},[3973,3977,3981,3985,3989,3993,3997,4001],{"type":67,"tag":104,"props":3974,"children":3975},{"style":121},[3976],{"type":72,"value":124},{"type":67,"tag":104,"props":3978,"children":3979},{"style":127},[3980],{"type":72,"value":130},{"type":67,"tag":104,"props":3982,"children":3983},{"style":133},[3984],{"type":72,"value":179},{"type":67,"tag":104,"props":3986,"children":3987},{"style":127},[3988],{"type":72,"value":141},{"type":67,"tag":104,"props":3990,"children":3991},{"style":121},[3992],{"type":72,"value":146},{"type":67,"tag":104,"props":3994,"children":3995},{"style":127},[3996],{"type":72,"value":151},{"type":67,"tag":104,"props":3998,"children":3999},{"style":154},[4000],{"type":72,"value":196},{"type":67,"tag":104,"props":4002,"children":4003},{"style":127},[4004],{"type":72,"value":162},{"type":67,"tag":104,"props":4006,"children":4007},{"class":106,"line":165},[4008],{"type":67,"tag":104,"props":4009,"children":4010},{"emptyLinePlaceholder":207},[4011],{"type":72,"value":210},{"type":67,"tag":104,"props":4013,"children":4014},{"class":106,"line":203},[4015,4019,4023,4028,4032,4036,4040],{"type":67,"tag":104,"props":4016,"children":4017},{"style":121},[4018],{"type":72,"value":219},{"type":67,"tag":104,"props":4020,"children":4021},{"style":222},[4022],{"type":72,"value":225},{"type":67,"tag":104,"props":4024,"children":4025},{"style":133},[4026],{"type":72,"value":4027}," showNotificationDef ",{"type":67,"tag":104,"props":4029,"children":4030},{"style":127},[4031],{"type":72,"value":235},{"type":67,"tag":104,"props":4033,"children":4034},{"style":238},[4035],{"type":72,"value":136},{"type":67,"tag":104,"props":4037,"children":4038},{"style":133},[4039],{"type":72,"value":245},{"type":67,"tag":104,"props":4041,"children":4042},{"style":127},[4043],{"type":72,"value":250},{"type":67,"tag":104,"props":4045,"children":4046},{"class":106,"line":213},[4047,4051,4055,4059,4064,4068],{"type":67,"tag":104,"props":4048,"children":4049},{"style":257},[4050],{"type":72,"value":260},{"type":67,"tag":104,"props":4052,"children":4053},{"style":127},[4054],{"type":72,"value":265},{"type":67,"tag":104,"props":4056,"children":4057},{"style":127},[4058],{"type":72,"value":151},{"type":67,"tag":104,"props":4060,"children":4061},{"style":154},[4062],{"type":72,"value":4063},"show_notification",{"type":67,"tag":104,"props":4065,"children":4066},{"style":127},[4067],{"type":72,"value":279},{"type":67,"tag":104,"props":4069,"children":4070},{"style":127},[4071],{"type":72,"value":284},{"type":67,"tag":104,"props":4073,"children":4074},{"class":106,"line":253},[4075,4079,4083,4087,4092,4096],{"type":67,"tag":104,"props":4076,"children":4077},{"style":257},[4078],{"type":72,"value":293},{"type":67,"tag":104,"props":4080,"children":4081},{"style":127},[4082],{"type":72,"value":265},{"type":67,"tag":104,"props":4084,"children":4085},{"style":127},[4086],{"type":72,"value":151},{"type":67,"tag":104,"props":4088,"children":4089},{"style":154},[4090],{"type":72,"value":4091},"Display a toast notification to the user",{"type":67,"tag":104,"props":4093,"children":4094},{"style":127},[4095],{"type":72,"value":279},{"type":67,"tag":104,"props":4097,"children":4098},{"style":127},[4099],{"type":72,"value":284},{"type":67,"tag":104,"props":4101,"children":4102},{"class":106,"line":287},[4103,4107,4111,4115,4119,4123,4127],{"type":67,"tag":104,"props":4104,"children":4105},{"style":257},[4106],{"type":72,"value":323},{"type":67,"tag":104,"props":4108,"children":4109},{"style":127},[4110],{"type":72,"value":265},{"type":67,"tag":104,"props":4112,"children":4113},{"style":133},[4114],{"type":72,"value":179},{"type":67,"tag":104,"props":4116,"children":4117},{"style":127},[4118],{"type":72,"value":336},{"type":67,"tag":104,"props":4120,"children":4121},{"style":238},[4122],{"type":72,"value":341},{"type":67,"tag":104,"props":4124,"children":4125},{"style":133},[4126],{"type":72,"value":245},{"type":67,"tag":104,"props":4128,"children":4129},{"style":127},[4130],{"type":72,"value":250},{"type":67,"tag":104,"props":4132,"children":4133},{"class":106,"line":317},[4134,4139,4143,4147,4151,4155,4159],{"type":67,"tag":104,"props":4135,"children":4136},{"style":257},[4137],{"type":72,"value":4138},"    message",{"type":67,"tag":104,"props":4140,"children":4141},{"style":127},[4142],{"type":72,"value":265},{"type":67,"tag":104,"props":4144,"children":4145},{"style":133},[4146],{"type":72,"value":179},{"type":67,"tag":104,"props":4148,"children":4149},{"style":127},[4150],{"type":72,"value":336},{"type":67,"tag":104,"props":4152,"children":4153},{"style":238},[4154],{"type":72,"value":375},{"type":67,"tag":104,"props":4156,"children":4157},{"style":133},[4158],{"type":72,"value":380},{"type":67,"tag":104,"props":4160,"children":4161},{"style":127},[4162],{"type":72,"value":284},{"type":67,"tag":104,"props":4164,"children":4165},{"class":106,"line":352},[4166,4171,4175,4179,4183,4188,4193,4197,4202,4206,4210,4214,4219,4223,4227,4231,4236,4240,4245],{"type":67,"tag":104,"props":4167,"children":4168},{"style":257},[4169],{"type":72,"value":4170},"    type",{"type":67,"tag":104,"props":4172,"children":4173},{"style":127},[4174],{"type":72,"value":265},{"type":67,"tag":104,"props":4176,"children":4177},{"style":133},[4178],{"type":72,"value":179},{"type":67,"tag":104,"props":4180,"children":4181},{"style":127},[4182],{"type":72,"value":336},{"type":67,"tag":104,"props":4184,"children":4185},{"style":238},[4186],{"type":72,"value":4187},"enum",{"type":67,"tag":104,"props":4189,"children":4190},{"style":133},[4191],{"type":72,"value":4192},"([",{"type":67,"tag":104,"props":4194,"children":4195},{"style":127},[4196],{"type":72,"value":279},{"type":67,"tag":104,"props":4198,"children":4199},{"style":154},[4200],{"type":72,"value":4201},"success",{"type":67,"tag":104,"props":4203,"children":4204},{"style":127},[4205],{"type":72,"value":279},{"type":67,"tag":104,"props":4207,"children":4208},{"style":127},[4209],{"type":72,"value":661},{"type":67,"tag":104,"props":4211,"children":4212},{"style":127},[4213],{"type":72,"value":151},{"type":67,"tag":104,"props":4215,"children":4216},{"style":154},[4217],{"type":72,"value":4218},"error",{"type":67,"tag":104,"props":4220,"children":4221},{"style":127},[4222],{"type":72,"value":279},{"type":67,"tag":104,"props":4224,"children":4225},{"style":127},[4226],{"type":72,"value":661},{"type":67,"tag":104,"props":4228,"children":4229},{"style":127},[4230],{"type":72,"value":151},{"type":67,"tag":104,"props":4232,"children":4233},{"style":154},[4234],{"type":72,"value":4235},"info",{"type":67,"tag":104,"props":4237,"children":4238},{"style":127},[4239],{"type":72,"value":279},{"type":67,"tag":104,"props":4241,"children":4242},{"style":133},[4243],{"type":72,"value":4244},"])",{"type":67,"tag":104,"props":4246,"children":4247},{"style":127},[4248],{"type":72,"value":284},{"type":67,"tag":104,"props":4250,"children":4251},{"class":106,"line":436},[4252,4256,4260],{"type":67,"tag":104,"props":4253,"children":4254},{"style":127},[4255],{"type":72,"value":534},{"type":67,"tag":104,"props":4257,"children":4258},{"style":133},[4259],{"type":72,"value":429},{"type":67,"tag":104,"props":4261,"children":4262},{"style":127},[4263],{"type":72,"value":284},{"type":67,"tag":104,"props":4265,"children":4266},{"class":106,"line":528},[4267,4271,4275,4279,4283,4287,4291,4295,4300,4304,4308,4312,4316,4320,4324,4328],{"type":67,"tag":104,"props":4268,"children":4269},{"style":257},[4270],{"type":72,"value":551},{"type":67,"tag":104,"props":4272,"children":4273},{"style":127},[4274],{"type":72,"value":265},{"type":67,"tag":104,"props":4276,"children":4277},{"style":133},[4278],{"type":72,"value":179},{"type":67,"tag":104,"props":4280,"children":4281},{"style":127},[4282],{"type":72,"value":336},{"type":67,"tag":104,"props":4284,"children":4285},{"style":238},[4286],{"type":72,"value":341},{"type":67,"tag":104,"props":4288,"children":4289},{"style":133},[4290],{"type":72,"value":245},{"type":67,"tag":104,"props":4292,"children":4293},{"style":127},[4294],{"type":72,"value":398},{"type":67,"tag":104,"props":4296,"children":4297},{"style":257},[4298],{"type":72,"value":4299}," shown",{"type":67,"tag":104,"props":4301,"children":4302},{"style":127},[4303],{"type":72,"value":265},{"type":67,"tag":104,"props":4305,"children":4306},{"style":133},[4307],{"type":72,"value":179},{"type":67,"tag":104,"props":4309,"children":4310},{"style":127},[4311],{"type":72,"value":336},{"type":67,"tag":104,"props":4313,"children":4314},{"style":238},[4315],{"type":72,"value":1022},{"type":67,"tag":104,"props":4317,"children":4318},{"style":133},[4319],{"type":72,"value":716},{"type":67,"tag":104,"props":4321,"children":4322},{"style":127},[4323],{"type":72,"value":721},{"type":67,"tag":104,"props":4325,"children":4326},{"style":133},[4327],{"type":72,"value":429},{"type":67,"tag":104,"props":4329,"children":4330},{"style":127},[4331],{"type":72,"value":284},{"type":67,"tag":104,"props":4333,"children":4334},{"class":106,"line":545},[4335,4339],{"type":67,"tag":104,"props":4336,"children":4337},{"style":127},[4338],{"type":72,"value":721},{"type":67,"tag":104,"props":4340,"children":4341},{"style":133},[4342],{"type":72,"value":771},{"type":67,"tag":75,"props":4344,"children":4345},{},[4346],{"type":72,"value":4347},"Server -- pass definition only (no execute function):",{"type":67,"tag":93,"props":4349,"children":4351},{"className":95,"code":4350,"language":15,"meta":97,"style":97},"const stream = chat({\n  adapter: openaiText('gpt-5.5'),\n  messages,\n  tools: [showNotificationDef],\n})\n",[4352],{"type":67,"tag":100,"props":4353,"children":4354},{"__ignoreMap":97},[4355,4382,4421,4432,4452],{"type":67,"tag":104,"props":4356,"children":4357},{"class":106,"line":107},[4358,4362,4366,4370,4374,4378],{"type":67,"tag":104,"props":4359,"children":4360},{"style":222},[4361],{"type":72,"value":3221},{"type":67,"tag":104,"props":4363,"children":4364},{"style":133},[4365],{"type":72,"value":3779},{"type":67,"tag":104,"props":4367,"children":4368},{"style":127},[4369],{"type":72,"value":235},{"type":67,"tag":104,"props":4371,"children":4372},{"style":238},[4373],{"type":72,"value":1480},{"type":67,"tag":104,"props":4375,"children":4376},{"style":133},[4377],{"type":72,"value":245},{"type":67,"tag":104,"props":4379,"children":4380},{"style":127},[4381],{"type":72,"value":250},{"type":67,"tag":104,"props":4383,"children":4384},{"class":106,"line":117},[4385,4389,4393,4397,4401,4405,4409,4413,4417],{"type":67,"tag":104,"props":4386,"children":4387},{"style":257},[4388],{"type":72,"value":3803},{"type":67,"tag":104,"props":4390,"children":4391},{"style":127},[4392],{"type":72,"value":265},{"type":67,"tag":104,"props":4394,"children":4395},{"style":238},[4396],{"type":72,"value":1525},{"type":67,"tag":104,"props":4398,"children":4399},{"style":133},[4400],{"type":72,"value":245},{"type":67,"tag":104,"props":4402,"children":4403},{"style":127},[4404],{"type":72,"value":279},{"type":67,"tag":104,"props":4406,"children":4407},{"style":154},[4408],{"type":72,"value":1780},{"type":67,"tag":104,"props":4410,"children":4411},{"style":127},[4412],{"type":72,"value":279},{"type":67,"tag":104,"props":4414,"children":4415},{"style":133},[4416],{"type":72,"value":429},{"type":67,"tag":104,"props":4418,"children":4419},{"style":127},[4420],{"type":72,"value":284},{"type":67,"tag":104,"props":4422,"children":4423},{"class":106,"line":165},[4424,4428],{"type":67,"tag":104,"props":4425,"children":4426},{"style":133},[4427],{"type":72,"value":3843},{"type":67,"tag":104,"props":4429,"children":4430},{"style":127},[4431],{"type":72,"value":284},{"type":67,"tag":104,"props":4433,"children":4434},{"class":106,"line":203},[4435,4439,4443,4448],{"type":67,"tag":104,"props":4436,"children":4437},{"style":257},[4438],{"type":72,"value":3855},{"type":67,"tag":104,"props":4440,"children":4441},{"style":127},[4442],{"type":72,"value":265},{"type":67,"tag":104,"props":4444,"children":4445},{"style":133},[4446],{"type":72,"value":4447}," [showNotificationDef]",{"type":67,"tag":104,"props":4449,"children":4450},{"style":127},[4451],{"type":72,"value":284},{"type":67,"tag":104,"props":4453,"children":4454},{"class":106,"line":213},[4455,4459],{"type":67,"tag":104,"props":4456,"children":4457},{"style":127},[4458],{"type":72,"value":721},{"type":67,"tag":104,"props":4460,"children":4461},{"style":133},[4462],{"type":72,"value":771},{"type":67,"tag":75,"props":4464,"children":4465},{},[4466,4468,4473],{"type":72,"value":4467},"Client -- pass ",{"type":67,"tag":100,"props":4469,"children":4471},{"className":4470},[],[4472],{"type":72,"value":3910},{"type":72,"value":4474}," implementation:",{"type":67,"tag":93,"props":4476,"children":4478},{"className":95,"code":4477,"language":15,"meta":97,"style":97},"import {\n  useChat,\n  fetchServerSentEvents,\n  clientTools,\n  createChatClientOptions,\n} from \"@tanstack\u002Fai-react\";\nimport { showNotificationDef } from \"@\u002Ftools\u002Fdefinitions\";\nimport { useState } from \"react\";\n\nfunction ChatPage() {\n  const [toast, setToast] = useState\u003Cstring | null>(null);\n\n  const showNotification = showNotificationDef.client((input) => {\n    setToast(input.message);\n    setTimeout(() => setToast(null), 3000);\n    return { shown: true };\n  });\n\n  const { messages, sendMessage } = useChat(\n    createChatClientOptions({\n      connection: fetchServerSentEvents(\"\u002Fapi\u002Fchat\"),\n      tools: clientTools(showNotification),\n    })\n  );\n\n  return (\n    \u003Cdiv>\n      {toast && \u003Cdiv className=\"toast\">{toast}\u003C\u002Fdiv>}\n      {messages.map((msg) => (\n        \u003Cdiv key={msg.id}>\n          {msg.parts.map((part) =>\n            part.type === \"text\" ? \u003Cp>{part.content}\u003C\u002Fp> : null\n          )}\n        \u003C\u002Fdiv>\n      ))}\n    \u003C\u002Fdiv>\n  );\n}\n",[4479],{"type":67,"tag":100,"props":4480,"children":4481},{"__ignoreMap":97},[4482,4493,4504,4515,4526,4537,4564,4604,4643,4650,4669,4745,4752,4804,4837,4890,4917,4932,4939,4978,4994,5034,5067,5079,5090,5097,5108,5123,5186,5225,5256,5300,5377,5389,5404,5415,5430,5441],{"type":67,"tag":104,"props":4483,"children":4484},{"class":106,"line":107},[4485,4489],{"type":67,"tag":104,"props":4486,"children":4487},{"style":121},[4488],{"type":72,"value":124},{"type":67,"tag":104,"props":4490,"children":4491},{"style":127},[4492],{"type":72,"value":1186},{"type":67,"tag":104,"props":4494,"children":4495},{"class":106,"line":117},[4496,4500],{"type":67,"tag":104,"props":4497,"children":4498},{"style":133},[4499],{"type":72,"value":1925},{"type":67,"tag":104,"props":4501,"children":4502},{"style":127},[4503],{"type":72,"value":284},{"type":67,"tag":104,"props":4505,"children":4506},{"class":106,"line":165},[4507,4511],{"type":67,"tag":104,"props":4508,"children":4509},{"style":133},[4510],{"type":72,"value":1937},{"type":67,"tag":104,"props":4512,"children":4513},{"style":127},[4514],{"type":72,"value":284},{"type":67,"tag":104,"props":4516,"children":4517},{"class":106,"line":203},[4518,4522],{"type":67,"tag":104,"props":4519,"children":4520},{"style":133},[4521],{"type":72,"value":1949},{"type":67,"tag":104,"props":4523,"children":4524},{"style":127},[4525],{"type":72,"value":284},{"type":67,"tag":104,"props":4527,"children":4528},{"class":106,"line":213},[4529,4533],{"type":67,"tag":104,"props":4530,"children":4531},{"style":133},[4532],{"type":72,"value":1961},{"type":67,"tag":104,"props":4534,"children":4535},{"style":127},[4536],{"type":72,"value":284},{"type":67,"tag":104,"props":4538,"children":4539},{"class":106,"line":253},[4540,4544,4548,4552,4556,4560],{"type":67,"tag":104,"props":4541,"children":4542},{"style":127},[4543],{"type":72,"value":721},{"type":67,"tag":104,"props":4545,"children":4546},{"style":121},[4547],{"type":72,"value":146},{"type":67,"tag":104,"props":4549,"children":4550},{"style":127},[4551],{"type":72,"value":1998},{"type":67,"tag":104,"props":4553,"children":4554},{"style":154},[4555],{"type":72,"value":2003},{"type":67,"tag":104,"props":4557,"children":4558},{"style":127},[4559],{"type":72,"value":2008},{"type":67,"tag":104,"props":4561,"children":4562},{"style":127},[4563],{"type":72,"value":2013},{"type":67,"tag":104,"props":4565,"children":4566},{"class":106,"line":287},[4567,4571,4575,4580,4584,4588,4592,4596,4600],{"type":67,"tag":104,"props":4568,"children":4569},{"style":121},[4570],{"type":72,"value":124},{"type":67,"tag":104,"props":4572,"children":4573},{"style":127},[4574],{"type":72,"value":130},{"type":67,"tag":104,"props":4576,"children":4577},{"style":133},[4578],{"type":72,"value":4579}," showNotificationDef",{"type":67,"tag":104,"props":4581,"children":4582},{"style":127},[4583],{"type":72,"value":141},{"type":67,"tag":104,"props":4585,"children":4586},{"style":121},[4587],{"type":72,"value":146},{"type":67,"tag":104,"props":4589,"children":4590},{"style":127},[4591],{"type":72,"value":1998},{"type":67,"tag":104,"props":4593,"children":4594},{"style":154},[4595],{"type":72,"value":1616},{"type":67,"tag":104,"props":4597,"children":4598},{"style":127},[4599],{"type":72,"value":2008},{"type":67,"tag":104,"props":4601,"children":4602},{"style":127},[4603],{"type":72,"value":2013},{"type":67,"tag":104,"props":4605,"children":4606},{"class":106,"line":317},[4607,4611,4615,4619,4623,4627,4631,4635,4639],{"type":67,"tag":104,"props":4608,"children":4609},{"style":121},[4610],{"type":72,"value":124},{"type":67,"tag":104,"props":4612,"children":4613},{"style":127},[4614],{"type":72,"value":130},{"type":67,"tag":104,"props":4616,"children":4617},{"style":133},[4618],{"type":72,"value":2068},{"type":67,"tag":104,"props":4620,"children":4621},{"style":127},[4622],{"type":72,"value":141},{"type":67,"tag":104,"props":4624,"children":4625},{"style":121},[4626],{"type":72,"value":146},{"type":67,"tag":104,"props":4628,"children":4629},{"style":127},[4630],{"type":72,"value":1998},{"type":67,"tag":104,"props":4632,"children":4633},{"style":154},[4634],{"type":72,"value":40},{"type":67,"tag":104,"props":4636,"children":4637},{"style":127},[4638],{"type":72,"value":2008},{"type":67,"tag":104,"props":4640,"children":4641},{"style":127},[4642],{"type":72,"value":2013},{"type":67,"tag":104,"props":4644,"children":4645},{"class":106,"line":352},[4646],{"type":67,"tag":104,"props":4647,"children":4648},{"emptyLinePlaceholder":207},[4649],{"type":72,"value":210},{"type":67,"tag":104,"props":4651,"children":4652},{"class":106,"line":436},[4653,4657,4661,4665],{"type":67,"tag":104,"props":4654,"children":4655},{"style":222},[4656],{"type":72,"value":2107},{"type":67,"tag":104,"props":4658,"children":4659},{"style":238},[4660],{"type":72,"value":2112},{"type":67,"tag":104,"props":4662,"children":4663},{"style":127},[4664],{"type":72,"value":380},{"type":67,"tag":104,"props":4666,"children":4667},{"style":127},[4668],{"type":72,"value":1186},{"type":67,"tag":104,"props":4670,"children":4671},{"class":106,"line":528},[4672,4676,4680,4685,4689,4694,4698,4702,4706,4710,4714,4719,4724,4728,4732,4737,4741],{"type":67,"tag":104,"props":4673,"children":4674},{"style":222},[4675],{"type":72,"value":1194},{"type":67,"tag":104,"props":4677,"children":4678},{"style":127},[4679],{"type":72,"value":1821},{"type":67,"tag":104,"props":4681,"children":4682},{"style":133},[4683],{"type":72,"value":4684},"toast",{"type":67,"tag":104,"props":4686,"children":4687},{"style":127},[4688],{"type":72,"value":661},{"type":67,"tag":104,"props":4690,"children":4691},{"style":133},[4692],{"type":72,"value":4693}," setToast",{"type":67,"tag":104,"props":4695,"children":4696},{"style":127},[4697],{"type":72,"value":1839},{"type":67,"tag":104,"props":4699,"children":4700},{"style":127},[4701],{"type":72,"value":1204},{"type":67,"tag":104,"props":4703,"children":4704},{"style":238},[4705],{"type":72,"value":2068},{"type":67,"tag":104,"props":4707,"children":4708},{"style":127},[4709],{"type":72,"value":2800},{"type":67,"tag":104,"props":4711,"children":4712},{"style":1665},[4713],{"type":72,"value":375},{"type":67,"tag":104,"props":4715,"children":4716},{"style":127},[4717],{"type":72,"value":4718}," |",{"type":67,"tag":104,"props":4720,"children":4721},{"style":1665},[4722],{"type":72,"value":4723}," null",{"type":67,"tag":104,"props":4725,"children":4726},{"style":127},[4727],{"type":72,"value":2587},{"type":67,"tag":104,"props":4729,"children":4730},{"style":257},[4731],{"type":72,"value":245},{"type":67,"tag":104,"props":4733,"children":4734},{"style":127},[4735],{"type":72,"value":4736},"null",{"type":67,"tag":104,"props":4738,"children":4739},{"style":257},[4740],{"type":72,"value":429},{"type":67,"tag":104,"props":4742,"children":4743},{"style":127},[4744],{"type":72,"value":2013},{"type":67,"tag":104,"props":4746,"children":4747},{"class":106,"line":545},[4748],{"type":67,"tag":104,"props":4749,"children":4750},{"emptyLinePlaceholder":207},[4751],{"type":72,"value":210},{"type":67,"tag":104,"props":4753,"children":4754},{"class":106,"line":578},[4755,4759,4764,4768,4772,4776,4780,4784,4788,4792,4796,4800],{"type":67,"tag":104,"props":4756,"children":4757},{"style":222},[4758],{"type":72,"value":1194},{"type":67,"tag":104,"props":4760,"children":4761},{"style":133},[4762],{"type":72,"value":4763}," showNotification",{"type":67,"tag":104,"props":4765,"children":4766},{"style":127},[4767],{"type":72,"value":1204},{"type":67,"tag":104,"props":4769,"children":4770},{"style":133},[4771],{"type":72,"value":4579},{"type":67,"tag":104,"props":4773,"children":4774},{"style":127},[4775],{"type":72,"value":336},{"type":67,"tag":104,"props":4777,"children":4778},{"style":238},[4779],{"type":72,"value":2210},{"type":67,"tag":104,"props":4781,"children":4782},{"style":257},[4783],{"type":72,"value":245},{"type":67,"tag":104,"props":4785,"children":4786},{"style":127},[4787],{"type":72,"value":245},{"type":67,"tag":104,"props":4789,"children":4790},{"style":1159},[4791],{"type":72,"value":2223},{"type":67,"tag":104,"props":4793,"children":4794},{"style":127},[4795],{"type":72,"value":429},{"type":67,"tag":104,"props":4797,"children":4798},{"style":222},[4799],{"type":72,"value":1181},{"type":67,"tag":104,"props":4801,"children":4802},{"style":127},[4803],{"type":72,"value":1186},{"type":67,"tag":104,"props":4805,"children":4806},{"class":106,"line":609},[4807,4812,4816,4820,4824,4829,4833],{"type":67,"tag":104,"props":4808,"children":4809},{"style":238},[4810],{"type":72,"value":4811},"    setToast",{"type":67,"tag":104,"props":4813,"children":4814},{"style":257},[4815],{"type":72,"value":245},{"type":67,"tag":104,"props":4817,"children":4818},{"style":133},[4819],{"type":72,"value":2223},{"type":67,"tag":104,"props":4821,"children":4822},{"style":127},[4823],{"type":72,"value":336},{"type":67,"tag":104,"props":4825,"children":4826},{"style":133},[4827],{"type":72,"value":4828},"message",{"type":67,"tag":104,"props":4830,"children":4831},{"style":257},[4832],{"type":72,"value":429},{"type":67,"tag":104,"props":4834,"children":4835},{"style":127},[4836],{"type":72,"value":2013},{"type":67,"tag":104,"props":4838,"children":4839},{"class":106,"line":732},[4840,4845,4849,4853,4857,4861,4865,4869,4873,4877,4882,4886],{"type":67,"tag":104,"props":4841,"children":4842},{"style":238},[4843],{"type":72,"value":4844},"    setTimeout",{"type":67,"tag":104,"props":4846,"children":4847},{"style":257},[4848],{"type":72,"value":245},{"type":67,"tag":104,"props":4850,"children":4851},{"style":127},[4852],{"type":72,"value":380},{"type":67,"tag":104,"props":4854,"children":4855},{"style":222},[4856],{"type":72,"value":1181},{"type":67,"tag":104,"props":4858,"children":4859},{"style":238},[4860],{"type":72,"value":4693},{"type":67,"tag":104,"props":4862,"children":4863},{"style":257},[4864],{"type":72,"value":245},{"type":67,"tag":104,"props":4866,"children":4867},{"style":127},[4868],{"type":72,"value":4736},{"type":67,"tag":104,"props":4870,"children":4871},{"style":257},[4872],{"type":72,"value":429},{"type":67,"tag":104,"props":4874,"children":4875},{"style":127},[4876],{"type":72,"value":661},{"type":67,"tag":104,"props":4878,"children":4879},{"style":1269},[4880],{"type":72,"value":4881}," 3000",{"type":67,"tag":104,"props":4883,"children":4884},{"style":257},[4885],{"type":72,"value":429},{"type":67,"tag":104,"props":4887,"children":4888},{"style":127},[4889],{"type":72,"value":2013},{"type":67,"tag":104,"props":4891,"children":4892},{"class":106,"line":745},[4893,4897,4901,4905,4909,4913],{"type":67,"tag":104,"props":4894,"children":4895},{"style":121},[4896],{"type":72,"value":2276},{"type":67,"tag":104,"props":4898,"children":4899},{"style":127},[4900],{"type":72,"value":130},{"type":67,"tag":104,"props":4902,"children":4903},{"style":257},[4904],{"type":72,"value":4299},{"type":67,"tag":104,"props":4906,"children":4907},{"style":127},[4908],{"type":72,"value":265},{"type":67,"tag":104,"props":4910,"children":4911},{"style":2291},[4912],{"type":72,"value":2294},{"type":67,"tag":104,"props":4914,"children":4915},{"style":127},[4916],{"type":72,"value":2299},{"type":67,"tag":104,"props":4918,"children":4919},{"class":106,"line":761},[4920,4924,4928],{"type":67,"tag":104,"props":4921,"children":4922},{"style":127},[4923],{"type":72,"value":534},{"type":67,"tag":104,"props":4925,"children":4926},{"style":257},[4927],{"type":72,"value":429},{"type":67,"tag":104,"props":4929,"children":4930},{"style":127},[4931],{"type":72,"value":2013},{"type":67,"tag":104,"props":4933,"children":4934},{"class":106,"line":774},[4935],{"type":67,"tag":104,"props":4936,"children":4937},{"emptyLinePlaceholder":207},[4938],{"type":72,"value":210},{"type":67,"tag":104,"props":4940,"children":4941},{"class":106,"line":782},[4942,4946,4950,4954,4958,4962,4966,4970,4974],{"type":67,"tag":104,"props":4943,"children":4944},{"style":222},[4945],{"type":72,"value":1194},{"type":67,"tag":104,"props":4947,"children":4948},{"style":127},[4949],{"type":72,"value":130},{"type":67,"tag":104,"props":4951,"children":4952},{"style":133},[4953],{"type":72,"value":1692},{"type":67,"tag":104,"props":4955,"children":4956},{"style":127},[4957],{"type":72,"value":661},{"type":67,"tag":104,"props":4959,"children":4960},{"style":133},[4961],{"type":72,"value":2481},{"type":67,"tag":104,"props":4963,"children":4964},{"style":127},[4965],{"type":72,"value":141},{"type":67,"tag":104,"props":4967,"children":4968},{"style":127},[4969],{"type":72,"value":1204},{"type":67,"tag":104,"props":4971,"children":4972},{"style":238},[4973],{"type":72,"value":2494},{"type":67,"tag":104,"props":4975,"children":4976},{"style":257},[4977],{"type":72,"value":606},{"type":67,"tag":104,"props":4979,"children":4980},{"class":106,"line":815},[4981,4986,4990],{"type":67,"tag":104,"props":4982,"children":4983},{"style":238},[4984],{"type":72,"value":4985},"    createChatClientOptions",{"type":67,"tag":104,"props":4987,"children":4988},{"style":257},[4989],{"type":72,"value":245},{"type":67,"tag":104,"props":4991,"children":4992},{"style":127},[4993],{"type":72,"value":250},{"type":67,"tag":104,"props":4995,"children":4996},{"class":106,"line":844},[4997,5002,5006,5010,5014,5018,5022,5026,5030],{"type":67,"tag":104,"props":4998,"children":4999},{"style":257},[5000],{"type":72,"value":5001},"      connection",{"type":67,"tag":104,"props":5003,"children":5004},{"style":127},[5005],{"type":72,"value":265},{"type":67,"tag":104,"props":5007,"children":5008},{"style":238},[5009],{"type":72,"value":2405},{"type":67,"tag":104,"props":5011,"children":5012},{"style":257},[5013],{"type":72,"value":245},{"type":67,"tag":104,"props":5015,"children":5016},{"style":127},[5017],{"type":72,"value":2008},{"type":67,"tag":104,"props":5019,"children":5020},{"style":154},[5021],{"type":72,"value":2418},{"type":67,"tag":104,"props":5023,"children":5024},{"style":127},[5025],{"type":72,"value":2008},{"type":67,"tag":104,"props":5027,"children":5028},{"style":257},[5029],{"type":72,"value":429},{"type":67,"tag":104,"props":5031,"children":5032},{"style":127},[5033],{"type":72,"value":284},{"type":67,"tag":104,"props":5035,"children":5036},{"class":106,"line":873},[5037,5042,5046,5050,5054,5059,5063],{"type":67,"tag":104,"props":5038,"children":5039},{"style":257},[5040],{"type":72,"value":5041},"      tools",{"type":67,"tag":104,"props":5043,"children":5044},{"style":127},[5045],{"type":72,"value":265},{"type":67,"tag":104,"props":5047,"children":5048},{"style":238},[5049],{"type":72,"value":2342},{"type":67,"tag":104,"props":5051,"children":5052},{"style":257},[5053],{"type":72,"value":245},{"type":67,"tag":104,"props":5055,"children":5056},{"style":133},[5057],{"type":72,"value":5058},"showNotification",{"type":67,"tag":104,"props":5060,"children":5061},{"style":257},[5062],{"type":72,"value":429},{"type":67,"tag":104,"props":5064,"children":5065},{"style":127},[5066],{"type":72,"value":284},{"type":67,"tag":104,"props":5068,"children":5069},{"class":106,"line":971},[5070,5075],{"type":67,"tag":104,"props":5071,"children":5072},{"style":127},[5073],{"type":72,"value":5074},"    }",{"type":67,"tag":104,"props":5076,"children":5077},{"style":257},[5078],{"type":72,"value":771},{"type":67,"tag":104,"props":5080,"children":5081},{"class":106,"line":1041},[5082,5086],{"type":67,"tag":104,"props":5083,"children":5084},{"style":257},[5085],{"type":72,"value":3075},{"type":67,"tag":104,"props":5087,"children":5088},{"style":127},[5089],{"type":72,"value":2013},{"type":67,"tag":104,"props":5091,"children":5092},{"class":106,"line":2459},[5093],{"type":67,"tag":104,"props":5094,"children":5095},{"emptyLinePlaceholder":207},[5096],{"type":72,"value":210},{"type":67,"tag":104,"props":5098,"children":5099},{"class":106,"line":2514},[5100,5104],{"type":67,"tag":104,"props":5101,"children":5102},{"style":121},[5103],{"type":72,"value":1288},{"type":67,"tag":104,"props":5105,"children":5106},{"style":257},[5107],{"type":72,"value":2550},{"type":67,"tag":104,"props":5109,"children":5110},{"class":106,"line":2523},[5111,5115,5119],{"type":67,"tag":104,"props":5112,"children":5113},{"style":257},[5114],{"type":72,"value":2559},{"type":67,"tag":104,"props":5116,"children":5117},{"style":1665},[5118],{"type":72,"value":2564},{"type":67,"tag":104,"props":5120,"children":5121},{"style":257},[5122],{"type":72,"value":2569},{"type":67,"tag":104,"props":5124,"children":5125},{"class":106,"line":2532},[5126,5130,5134,5139,5143,5148,5152,5156,5160,5164,5168,5172,5177,5181],{"type":67,"tag":104,"props":5127,"children":5128},{"style":127},[5129],{"type":72,"value":2631},{"type":67,"tag":104,"props":5131,"children":5132},{"style":1159},[5133],{"type":72,"value":4684},{"type":67,"tag":104,"props":5135,"children":5136},{"style":257},[5137],{"type":72,"value":5138}," && \u003C",{"type":67,"tag":104,"props":5140,"children":5141},{"style":1159},[5142],{"type":72,"value":2564},{"type":67,"tag":104,"props":5144,"children":5145},{"style":1159},[5146],{"type":72,"value":5147}," className",{"type":67,"tag":104,"props":5149,"children":5150},{"style":127},[5151],{"type":72,"value":235},{"type":67,"tag":104,"props":5153,"children":5154},{"style":127},[5155],{"type":72,"value":2008},{"type":67,"tag":104,"props":5157,"children":5158},{"style":154},[5159],{"type":72,"value":4684},{"type":67,"tag":104,"props":5161,"children":5162},{"style":127},[5163],{"type":72,"value":2008},{"type":67,"tag":104,"props":5165,"children":5166},{"style":127},[5167],{"type":72,"value":2809},{"type":67,"tag":104,"props":5169,"children":5170},{"style":133},[5171],{"type":72,"value":4684},{"type":67,"tag":104,"props":5173,"children":5174},{"style":127},[5175],{"type":72,"value":5176},"}\u003C\u002F",{"type":67,"tag":104,"props":5178,"children":5179},{"style":133},[5180],{"type":72,"value":2564},{"type":67,"tag":104,"props":5182,"children":5183},{"style":127},[5184],{"type":72,"value":5185},">}\n",{"type":67,"tag":104,"props":5187,"children":5188},{"class":106,"line":2540},[5189,5193,5197,5201,5205,5209,5213,5217,5221],{"type":67,"tag":104,"props":5190,"children":5191},{"style":127},[5192],{"type":72,"value":2631},{"type":67,"tag":104,"props":5194,"children":5195},{"style":1159},[5196],{"type":72,"value":2636},{"type":67,"tag":104,"props":5198,"children":5199},{"style":257},[5200],{"type":72,"value":336},{"type":67,"tag":104,"props":5202,"children":5203},{"style":1159},[5204],{"type":72,"value":1316},{"type":67,"tag":104,"props":5206,"children":5207},{"style":257},[5208],{"type":72,"value":2649},{"type":67,"tag":104,"props":5210,"children":5211},{"style":1159},[5212],{"type":72,"value":2654},{"type":67,"tag":104,"props":5214,"children":5215},{"style":257},[5216],{"type":72,"value":2659},{"type":67,"tag":104,"props":5218,"children":5219},{"style":127},[5220],{"type":72,"value":2664},{"type":67,"tag":104,"props":5222,"children":5223},{"style":257},[5224],{"type":72,"value":2550},{"type":67,"tag":104,"props":5226,"children":5227},{"class":106,"line":2553},[5228,5232,5236,5240,5244,5248,5252],{"type":67,"tag":104,"props":5229,"children":5230},{"style":127},[5231],{"type":72,"value":2677},{"type":67,"tag":104,"props":5233,"children":5234},{"style":133},[5235],{"type":72,"value":2564},{"type":67,"tag":104,"props":5237,"children":5238},{"style":133},[5239],{"type":72,"value":2686},{"type":67,"tag":104,"props":5241,"children":5242},{"style":127},[5243],{"type":72,"value":2691},{"type":67,"tag":104,"props":5245,"children":5246},{"style":257},[5247],{"type":72,"value":2696},{"type":67,"tag":104,"props":5249,"children":5250},{"style":133},[5251],{"type":72,"value":1367},{"type":67,"tag":104,"props":5253,"children":5254},{"style":127},[5255],{"type":72,"value":2705},{"type":67,"tag":104,"props":5257,"children":5258},{"class":106,"line":2572},[5259,5263,5267,5271,5275,5279,5283,5287,5291,5295],{"type":67,"tag":104,"props":5260,"children":5261},{"style":127},[5262],{"type":72,"value":2714},{"type":67,"tag":104,"props":5264,"children":5265},{"style":1159},[5266],{"type":72,"value":2654},{"type":67,"tag":104,"props":5268,"children":5269},{"style":257},[5270],{"type":72,"value":336},{"type":67,"tag":104,"props":5272,"children":5273},{"style":1159},[5274],{"type":72,"value":2727},{"type":67,"tag":104,"props":5276,"children":5277},{"style":257},[5278],{"type":72,"value":336},{"type":67,"tag":104,"props":5280,"children":5281},{"style":1159},[5282],{"type":72,"value":1316},{"type":67,"tag":104,"props":5284,"children":5285},{"style":257},[5286],{"type":72,"value":2649},{"type":67,"tag":104,"props":5288,"children":5289},{"style":1159},[5290],{"type":72,"value":2744},{"type":67,"tag":104,"props":5292,"children":5293},{"style":257},[5294],{"type":72,"value":2659},{"type":67,"tag":104,"props":5296,"children":5297},{"style":127},[5298],{"type":72,"value":5299},"=>\n",{"type":67,"tag":104,"props":5301,"children":5302},{"class":106,"line":2625},[5303,5308,5312,5317,5322,5326,5331,5335,5339,5343,5347,5351,5355,5359,5363,5367,5372],{"type":67,"tag":104,"props":5304,"children":5305},{"style":1159},[5306],{"type":72,"value":5307},"            part",{"type":67,"tag":104,"props":5309,"children":5310},{"style":257},[5311],{"type":72,"value":336},{"type":67,"tag":104,"props":5313,"children":5314},{"style":1159},[5315],{"type":72,"value":5316},"type",{"type":67,"tag":104,"props":5318,"children":5319},{"style":257},[5320],{"type":72,"value":5321}," === \"",{"type":67,"tag":104,"props":5323,"children":5324},{"style":1159},[5325],{"type":72,"value":72},{"type":67,"tag":104,"props":5327,"children":5328},{"style":257},[5329],{"type":72,"value":5330},"\" ? \u003C",{"type":67,"tag":104,"props":5332,"children":5333},{"style":1159},[5334],{"type":72,"value":75},{"type":67,"tag":104,"props":5336,"children":5337},{"style":257},[5338],{"type":72,"value":2587},{"type":67,"tag":104,"props":5340,"children":5341},{"style":127},[5342],{"type":72,"value":398},{"type":67,"tag":104,"props":5344,"children":5345},{"style":1159},[5346],{"type":72,"value":2744},{"type":67,"tag":104,"props":5348,"children":5349},{"style":257},[5350],{"type":72,"value":336},{"type":67,"tag":104,"props":5352,"children":5353},{"style":1159},[5354],{"type":72,"value":2822},{"type":67,"tag":104,"props":5356,"children":5357},{"style":127},[5358],{"type":72,"value":721},{"type":67,"tag":104,"props":5360,"children":5361},{"style":257},[5362],{"type":72,"value":2975},{"type":67,"tag":104,"props":5364,"children":5365},{"style":1159},[5366],{"type":72,"value":75},{"type":67,"tag":104,"props":5368,"children":5369},{"style":257},[5370],{"type":72,"value":5371},"> : ",{"type":67,"tag":104,"props":5373,"children":5374},{"style":1159},[5375],{"type":72,"value":5376},"null\n",{"type":67,"tag":104,"props":5378,"children":5379},{"class":106,"line":2671},[5380,5385],{"type":67,"tag":104,"props":5381,"children":5382},{"style":257},[5383],{"type":72,"value":5384},"          )",{"type":67,"tag":104,"props":5386,"children":5387},{"style":127},[5388],{"type":72,"value":1891},{"type":67,"tag":104,"props":5390,"children":5391},{"class":106,"line":2708},[5392,5396,5400],{"type":67,"tag":104,"props":5393,"children":5394},{"style":127},[5395],{"type":72,"value":3028},{"type":67,"tag":104,"props":5397,"children":5398},{"style":133},[5399],{"type":72,"value":2564},{"type":67,"tag":104,"props":5401,"children":5402},{"style":127},[5403],{"type":72,"value":2569},{"type":67,"tag":104,"props":5405,"children":5406},{"class":106,"line":2759},[5407,5411],{"type":67,"tag":104,"props":5408,"children":5409},{"style":257},[5410],{"type":72,"value":3045},{"type":67,"tag":104,"props":5412,"children":5413},{"style":127},[5414],{"type":72,"value":1891},{"type":67,"tag":104,"props":5416,"children":5417},{"class":106,"line":2834},[5418,5422,5426],{"type":67,"tag":104,"props":5419,"children":5420},{"style":127},[5421],{"type":72,"value":3058},{"type":67,"tag":104,"props":5423,"children":5424},{"style":133},[5425],{"type":72,"value":2564},{"type":67,"tag":104,"props":5427,"children":5428},{"style":127},[5429],{"type":72,"value":2569},{"type":67,"tag":104,"props":5431,"children":5432},{"class":106,"line":2871},[5433,5437],{"type":67,"tag":104,"props":5434,"children":5435},{"style":257},[5436],{"type":72,"value":3075},{"type":67,"tag":104,"props":5438,"children":5439},{"style":127},[5440],{"type":72,"value":2013},{"type":67,"tag":104,"props":5442,"children":5443},{"class":106,"line":2987},[5444],{"type":67,"tag":104,"props":5445,"children":5446},{"style":127},[5447],{"type":72,"value":1891},{"type":67,"tag":3095,"props":5449,"children":5451},{"id":5450},"pattern-3-tool-with-approval-flow",[5452],{"type":72,"value":5453},"Pattern 3: Tool with Approval Flow",{"type":67,"tag":75,"props":5455,"children":5456},{},[5457,5459,5465,5467,5473,5475,5481,5483,5489,5491,5497,5498,5504,5506,5512,5514,5520],{"type":72,"value":5458},"Set ",{"type":67,"tag":100,"props":5460,"children":5462},{"className":5461},[],[5463],{"type":72,"value":5464},"needsApproval: true",{"type":72,"value":5466}," in the definition. Execution pauses with\n",{"type":67,"tag":100,"props":5468,"children":5470},{"className":5469},[],[5471],{"type":72,"value":5472},"RUN_FINISHED.outcome.type === 'interrupt'",{"type":72,"value":5474},". The primary client API is bound\n",{"type":67,"tag":100,"props":5476,"children":5478},{"className":5477},[],[5479],{"type":72,"value":5480},"interrupts",{"type":72,"value":5482}," + ",{"type":67,"tag":100,"props":5484,"children":5486},{"className":5485},[],[5487],{"type":72,"value":5488},"resolveInterrupt",{"type":72,"value":5490}," \u002F ",{"type":67,"tag":100,"props":5492,"children":5494},{"className":5493},[],[5495],{"type":72,"value":5496},"resolveInterrupts",{"type":72,"value":5490},{"type":67,"tag":100,"props":5499,"children":5501},{"className":5500},[],[5502],{"type":72,"value":5503},"cancel",{"type":72,"value":5505},".\n",{"type":67,"tag":100,"props":5507,"children":5509},{"className":5508},[],[5510],{"type":72,"value":5511},"addToolApprovalResponse",{"type":72,"value":5513}," and ",{"type":67,"tag":100,"props":5515,"children":5517},{"className":5516},[],[5518],{"type":72,"value":5519},"pendingInterrupts",{"type":72,"value":5521}," remain as deprecated\ncompatibility shims during migration.",{"type":67,"tag":93,"props":5523,"children":5525},{"className":95,"code":5524,"language":15,"meta":97,"style":97},"import { toolDefinition } from '@tanstack\u002Fai'\nimport { z } from 'zod'\n\nexport const sendEmailDef = toolDefinition({\n  name: 'send_email',\n  description: 'Send an email to a recipient',\n  inputSchema: z.object({\n    to: z.string().email(),\n    subject: z.string(),\n    body: z.string(),\n  }),\n  outputSchema: z.object({ success: z.boolean(), messageId: z.string() }),\n  needsApproval: true,\n})\n\nexport const sendEmail = sendEmailDef.server(async ({ to, subject, body }) => {\n  const result = await emailService.send({ to, subject, body })\n  return { success: true, messageId: result.id }\n})\n",[5526],{"type":67,"tag":100,"props":5527,"children":5528},{"__ignoreMap":97},[5529,5564,5599,5606,5638,5666,5694,5725,5769,5801,5833,5848,5945,5965,5976,5983,6063,6133,6184],{"type":67,"tag":104,"props":5530,"children":5531},{"class":106,"line":107},[5532,5536,5540,5544,5548,5552,5556,5560],{"type":67,"tag":104,"props":5533,"children":5534},{"style":121},[5535],{"type":72,"value":124},{"type":67,"tag":104,"props":5537,"children":5538},{"style":127},[5539],{"type":72,"value":130},{"type":67,"tag":104,"props":5541,"children":5542},{"style":133},[5543],{"type":72,"value":136},{"type":67,"tag":104,"props":5545,"children":5546},{"style":127},[5547],{"type":72,"value":141},{"type":67,"tag":104,"props":5549,"children":5550},{"style":121},[5551],{"type":72,"value":146},{"type":67,"tag":104,"props":5553,"children":5554},{"style":127},[5555],{"type":72,"value":151},{"type":67,"tag":104,"props":5557,"children":5558},{"style":154},[5559],{"type":72,"value":157},{"type":67,"tag":104,"props":5561,"children":5562},{"style":127},[5563],{"type":72,"value":162},{"type":67,"tag":104,"props":5565,"children":5566},{"class":106,"line":117},[5567,5571,5575,5579,5583,5587,5591,5595],{"type":67,"tag":104,"props":5568,"children":5569},{"style":121},[5570],{"type":72,"value":124},{"type":67,"tag":104,"props":5572,"children":5573},{"style":127},[5574],{"type":72,"value":130},{"type":67,"tag":104,"props":5576,"children":5577},{"style":133},[5578],{"type":72,"value":179},{"type":67,"tag":104,"props":5580,"children":5581},{"style":127},[5582],{"type":72,"value":141},{"type":67,"tag":104,"props":5584,"children":5585},{"style":121},[5586],{"type":72,"value":146},{"type":67,"tag":104,"props":5588,"children":5589},{"style":127},[5590],{"type":72,"value":151},{"type":67,"tag":104,"props":5592,"children":5593},{"style":154},[5594],{"type":72,"value":196},{"type":67,"tag":104,"props":5596,"children":5597},{"style":127},[5598],{"type":72,"value":162},{"type":67,"tag":104,"props":5600,"children":5601},{"class":106,"line":165},[5602],{"type":67,"tag":104,"props":5603,"children":5604},{"emptyLinePlaceholder":207},[5605],{"type":72,"value":210},{"type":67,"tag":104,"props":5607,"children":5608},{"class":106,"line":203},[5609,5613,5617,5622,5626,5630,5634],{"type":67,"tag":104,"props":5610,"children":5611},{"style":121},[5612],{"type":72,"value":219},{"type":67,"tag":104,"props":5614,"children":5615},{"style":222},[5616],{"type":72,"value":225},{"type":67,"tag":104,"props":5618,"children":5619},{"style":133},[5620],{"type":72,"value":5621}," sendEmailDef ",{"type":67,"tag":104,"props":5623,"children":5624},{"style":127},[5625],{"type":72,"value":235},{"type":67,"tag":104,"props":5627,"children":5628},{"style":238},[5629],{"type":72,"value":136},{"type":67,"tag":104,"props":5631,"children":5632},{"style":133},[5633],{"type":72,"value":245},{"type":67,"tag":104,"props":5635,"children":5636},{"style":127},[5637],{"type":72,"value":250},{"type":67,"tag":104,"props":5639,"children":5640},{"class":106,"line":213},[5641,5645,5649,5653,5658,5662],{"type":67,"tag":104,"props":5642,"children":5643},{"style":257},[5644],{"type":72,"value":260},{"type":67,"tag":104,"props":5646,"children":5647},{"style":127},[5648],{"type":72,"value":265},{"type":67,"tag":104,"props":5650,"children":5651},{"style":127},[5652],{"type":72,"value":151},{"type":67,"tag":104,"props":5654,"children":5655},{"style":154},[5656],{"type":72,"value":5657},"send_email",{"type":67,"tag":104,"props":5659,"children":5660},{"style":127},[5661],{"type":72,"value":279},{"type":67,"tag":104,"props":5663,"children":5664},{"style":127},[5665],{"type":72,"value":284},{"type":67,"tag":104,"props":5667,"children":5668},{"class":106,"line":253},[5669,5673,5677,5681,5686,5690],{"type":67,"tag":104,"props":5670,"children":5671},{"style":257},[5672],{"type":72,"value":293},{"type":67,"tag":104,"props":5674,"children":5675},{"style":127},[5676],{"type":72,"value":265},{"type":67,"tag":104,"props":5678,"children":5679},{"style":127},[5680],{"type":72,"value":151},{"type":67,"tag":104,"props":5682,"children":5683},{"style":154},[5684],{"type":72,"value":5685},"Send an email to a recipient",{"type":67,"tag":104,"props":5687,"children":5688},{"style":127},[5689],{"type":72,"value":279},{"type":67,"tag":104,"props":5691,"children":5692},{"style":127},[5693],{"type":72,"value":284},{"type":67,"tag":104,"props":5695,"children":5696},{"class":106,"line":287},[5697,5701,5705,5709,5713,5717,5721],{"type":67,"tag":104,"props":5698,"children":5699},{"style":257},[5700],{"type":72,"value":323},{"type":67,"tag":104,"props":5702,"children":5703},{"style":127},[5704],{"type":72,"value":265},{"type":67,"tag":104,"props":5706,"children":5707},{"style":133},[5708],{"type":72,"value":179},{"type":67,"tag":104,"props":5710,"children":5711},{"style":127},[5712],{"type":72,"value":336},{"type":67,"tag":104,"props":5714,"children":5715},{"style":238},[5716],{"type":72,"value":341},{"type":67,"tag":104,"props":5718,"children":5719},{"style":133},[5720],{"type":72,"value":245},{"type":67,"tag":104,"props":5722,"children":5723},{"style":127},[5724],{"type":72,"value":250},{"type":67,"tag":104,"props":5726,"children":5727},{"class":106,"line":317},[5728,5733,5737,5741,5745,5749,5753,5757,5761,5765],{"type":67,"tag":104,"props":5729,"children":5730},{"style":257},[5731],{"type":72,"value":5732},"    to",{"type":67,"tag":104,"props":5734,"children":5735},{"style":127},[5736],{"type":72,"value":265},{"type":67,"tag":104,"props":5738,"children":5739},{"style":133},[5740],{"type":72,"value":179},{"type":67,"tag":104,"props":5742,"children":5743},{"style":127},[5744],{"type":72,"value":336},{"type":67,"tag":104,"props":5746,"children":5747},{"style":238},[5748],{"type":72,"value":375},{"type":67,"tag":104,"props":5750,"children":5751},{"style":133},[5752],{"type":72,"value":380},{"type":67,"tag":104,"props":5754,"children":5755},{"style":127},[5756],{"type":72,"value":336},{"type":67,"tag":104,"props":5758,"children":5759},{"style":238},[5760],{"type":72,"value":3736},{"type":67,"tag":104,"props":5762,"children":5763},{"style":133},[5764],{"type":72,"value":380},{"type":67,"tag":104,"props":5766,"children":5767},{"style":127},[5768],{"type":72,"value":284},{"type":67,"tag":104,"props":5770,"children":5771},{"class":106,"line":352},[5772,5777,5781,5785,5789,5793,5797],{"type":67,"tag":104,"props":5773,"children":5774},{"style":257},[5775],{"type":72,"value":5776},"    subject",{"type":67,"tag":104,"props":5778,"children":5779},{"style":127},[5780],{"type":72,"value":265},{"type":67,"tag":104,"props":5782,"children":5783},{"style":133},[5784],{"type":72,"value":179},{"type":67,"tag":104,"props":5786,"children":5787},{"style":127},[5788],{"type":72,"value":336},{"type":67,"tag":104,"props":5790,"children":5791},{"style":238},[5792],{"type":72,"value":375},{"type":67,"tag":104,"props":5794,"children":5795},{"style":133},[5796],{"type":72,"value":380},{"type":67,"tag":104,"props":5798,"children":5799},{"style":127},[5800],{"type":72,"value":284},{"type":67,"tag":104,"props":5802,"children":5803},{"class":106,"line":436},[5804,5809,5813,5817,5821,5825,5829],{"type":67,"tag":104,"props":5805,"children":5806},{"style":257},[5807],{"type":72,"value":5808},"    body",{"type":67,"tag":104,"props":5810,"children":5811},{"style":127},[5812],{"type":72,"value":265},{"type":67,"tag":104,"props":5814,"children":5815},{"style":133},[5816],{"type":72,"value":179},{"type":67,"tag":104,"props":5818,"children":5819},{"style":127},[5820],{"type":72,"value":336},{"type":67,"tag":104,"props":5822,"children":5823},{"style":238},[5824],{"type":72,"value":375},{"type":67,"tag":104,"props":5826,"children":5827},{"style":133},[5828],{"type":72,"value":380},{"type":67,"tag":104,"props":5830,"children":5831},{"style":127},[5832],{"type":72,"value":284},{"type":67,"tag":104,"props":5834,"children":5835},{"class":106,"line":528},[5836,5840,5844],{"type":67,"tag":104,"props":5837,"children":5838},{"style":127},[5839],{"type":72,"value":534},{"type":67,"tag":104,"props":5841,"children":5842},{"style":133},[5843],{"type":72,"value":429},{"type":67,"tag":104,"props":5845,"children":5846},{"style":127},[5847],{"type":72,"value":284},{"type":67,"tag":104,"props":5849,"children":5850},{"class":106,"line":545},[5851,5855,5859,5863,5867,5871,5875,5879,5884,5888,5892,5896,5900,5904,5908,5913,5917,5921,5925,5929,5933,5937,5941],{"type":67,"tag":104,"props":5852,"children":5853},{"style":257},[5854],{"type":72,"value":551},{"type":67,"tag":104,"props":5856,"children":5857},{"style":127},[5858],{"type":72,"value":265},{"type":67,"tag":104,"props":5860,"children":5861},{"style":133},[5862],{"type":72,"value":179},{"type":67,"tag":104,"props":5864,"children":5865},{"style":127},[5866],{"type":72,"value":336},{"type":67,"tag":104,"props":5868,"children":5869},{"style":238},[5870],{"type":72,"value":341},{"type":67,"tag":104,"props":5872,"children":5873},{"style":133},[5874],{"type":72,"value":245},{"type":67,"tag":104,"props":5876,"children":5877},{"style":127},[5878],{"type":72,"value":398},{"type":67,"tag":104,"props":5880,"children":5881},{"style":257},[5882],{"type":72,"value":5883}," success",{"type":67,"tag":104,"props":5885,"children":5886},{"style":127},[5887],{"type":72,"value":265},{"type":67,"tag":104,"props":5889,"children":5890},{"style":133},[5891],{"type":72,"value":179},{"type":67,"tag":104,"props":5893,"children":5894},{"style":127},[5895],{"type":72,"value":336},{"type":67,"tag":104,"props":5897,"children":5898},{"style":238},[5899],{"type":72,"value":1022},{"type":67,"tag":104,"props":5901,"children":5902},{"style":133},[5903],{"type":72,"value":380},{"type":67,"tag":104,"props":5905,"children":5906},{"style":127},[5907],{"type":72,"value":661},{"type":67,"tag":104,"props":5909,"children":5910},{"style":257},[5911],{"type":72,"value":5912}," messageId",{"type":67,"tag":104,"props":5914,"children":5915},{"style":127},[5916],{"type":72,"value":265},{"type":67,"tag":104,"props":5918,"children":5919},{"style":133},[5920],{"type":72,"value":179},{"type":67,"tag":104,"props":5922,"children":5923},{"style":127},[5924],{"type":72,"value":336},{"type":67,"tag":104,"props":5926,"children":5927},{"style":238},[5928],{"type":72,"value":375},{"type":67,"tag":104,"props":5930,"children":5931},{"style":133},[5932],{"type":72,"value":716},{"type":67,"tag":104,"props":5934,"children":5935},{"style":127},[5936],{"type":72,"value":721},{"type":67,"tag":104,"props":5938,"children":5939},{"style":133},[5940],{"type":72,"value":429},{"type":67,"tag":104,"props":5942,"children":5943},{"style":127},[5944],{"type":72,"value":284},{"type":67,"tag":104,"props":5946,"children":5947},{"class":106,"line":578},[5948,5953,5957,5961],{"type":67,"tag":104,"props":5949,"children":5950},{"style":257},[5951],{"type":72,"value":5952},"  needsApproval",{"type":67,"tag":104,"props":5954,"children":5955},{"style":127},[5956],{"type":72,"value":265},{"type":67,"tag":104,"props":5958,"children":5959},{"style":2291},[5960],{"type":72,"value":2294},{"type":67,"tag":104,"props":5962,"children":5963},{"style":127},[5964],{"type":72,"value":284},{"type":67,"tag":104,"props":5966,"children":5967},{"class":106,"line":609},[5968,5972],{"type":67,"tag":104,"props":5969,"children":5970},{"style":127},[5971],{"type":72,"value":721},{"type":67,"tag":104,"props":5973,"children":5974},{"style":133},[5975],{"type":72,"value":771},{"type":67,"tag":104,"props":5977,"children":5978},{"class":106,"line":732},[5979],{"type":67,"tag":104,"props":5980,"children":5981},{"emptyLinePlaceholder":207},[5982],{"type":72,"value":210},{"type":67,"tag":104,"props":5984,"children":5985},{"class":106,"line":745},[5986,5990,5994,5999,6003,6008,6012,6016,6020,6024,6028,6033,6037,6042,6046,6051,6055,6059],{"type":67,"tag":104,"props":5987,"children":5988},{"style":121},[5989],{"type":72,"value":219},{"type":67,"tag":104,"props":5991,"children":5992},{"style":222},[5993],{"type":72,"value":225},{"type":67,"tag":104,"props":5995,"children":5996},{"style":133},[5997],{"type":72,"value":5998}," sendEmail ",{"type":67,"tag":104,"props":6000,"children":6001},{"style":127},[6002],{"type":72,"value":235},{"type":67,"tag":104,"props":6004,"children":6005},{"style":133},[6006],{"type":72,"value":6007}," sendEmailDef",{"type":67,"tag":104,"props":6009,"children":6010},{"style":127},[6011],{"type":72,"value":336},{"type":67,"tag":104,"props":6013,"children":6014},{"style":238},[6015],{"type":72,"value":1142},{"type":67,"tag":104,"props":6017,"children":6018},{"style":133},[6019],{"type":72,"value":245},{"type":67,"tag":104,"props":6021,"children":6022},{"style":222},[6023],{"type":72,"value":1151},{"type":67,"tag":104,"props":6025,"children":6026},{"style":127},[6027],{"type":72,"value":1156},{"type":67,"tag":104,"props":6029,"children":6030},{"style":1159},[6031],{"type":72,"value":6032}," to",{"type":67,"tag":104,"props":6034,"children":6035},{"style":127},[6036],{"type":72,"value":661},{"type":67,"tag":104,"props":6038,"children":6039},{"style":1159},[6040],{"type":72,"value":6041}," subject",{"type":67,"tag":104,"props":6043,"children":6044},{"style":127},[6045],{"type":72,"value":661},{"type":67,"tag":104,"props":6047,"children":6048},{"style":1159},[6049],{"type":72,"value":6050}," body",{"type":67,"tag":104,"props":6052,"children":6053},{"style":127},[6054],{"type":72,"value":1176},{"type":67,"tag":104,"props":6056,"children":6057},{"style":222},[6058],{"type":72,"value":1181},{"type":67,"tag":104,"props":6060,"children":6061},{"style":127},[6062],{"type":72,"value":1186},{"type":67,"tag":104,"props":6064,"children":6065},{"class":106,"line":761},[6066,6070,6075,6079,6083,6088,6092,6097,6101,6105,6109,6113,6117,6121,6125,6129],{"type":67,"tag":104,"props":6067,"children":6068},{"style":222},[6069],{"type":72,"value":1194},{"type":67,"tag":104,"props":6071,"children":6072},{"style":133},[6073],{"type":72,"value":6074}," result",{"type":67,"tag":104,"props":6076,"children":6077},{"style":127},[6078],{"type":72,"value":1204},{"type":67,"tag":104,"props":6080,"children":6081},{"style":121},[6082],{"type":72,"value":1209},{"type":67,"tag":104,"props":6084,"children":6085},{"style":133},[6086],{"type":72,"value":6087}," emailService",{"type":67,"tag":104,"props":6089,"children":6090},{"style":127},[6091],{"type":72,"value":336},{"type":67,"tag":104,"props":6093,"children":6094},{"style":238},[6095],{"type":72,"value":6096},"send",{"type":67,"tag":104,"props":6098,"children":6099},{"style":257},[6100],{"type":72,"value":245},{"type":67,"tag":104,"props":6102,"children":6103},{"style":127},[6104],{"type":72,"value":398},{"type":67,"tag":104,"props":6106,"children":6107},{"style":133},[6108],{"type":72,"value":6032},{"type":67,"tag":104,"props":6110,"children":6111},{"style":127},[6112],{"type":72,"value":661},{"type":67,"tag":104,"props":6114,"children":6115},{"style":133},[6116],{"type":72,"value":6041},{"type":67,"tag":104,"props":6118,"children":6119},{"style":127},[6120],{"type":72,"value":661},{"type":67,"tag":104,"props":6122,"children":6123},{"style":133},[6124],{"type":72,"value":6050},{"type":67,"tag":104,"props":6126,"children":6127},{"style":127},[6128],{"type":72,"value":141},{"type":67,"tag":104,"props":6130,"children":6131},{"style":257},[6132],{"type":72,"value":771},{"type":67,"tag":104,"props":6134,"children":6135},{"class":106,"line":774},[6136,6140,6144,6148,6152,6156,6160,6164,6168,6172,6176,6180],{"type":67,"tag":104,"props":6137,"children":6138},{"style":121},[6139],{"type":72,"value":1288},{"type":67,"tag":104,"props":6141,"children":6142},{"style":127},[6143],{"type":72,"value":130},{"type":67,"tag":104,"props":6145,"children":6146},{"style":257},[6147],{"type":72,"value":5883},{"type":67,"tag":104,"props":6149,"children":6150},{"style":127},[6151],{"type":72,"value":265},{"type":67,"tag":104,"props":6153,"children":6154},{"style":2291},[6155],{"type":72,"value":2294},{"type":67,"tag":104,"props":6157,"children":6158},{"style":127},[6159],{"type":72,"value":661},{"type":67,"tag":104,"props":6161,"children":6162},{"style":257},[6163],{"type":72,"value":5912},{"type":67,"tag":104,"props":6165,"children":6166},{"style":127},[6167],{"type":72,"value":265},{"type":67,"tag":104,"props":6169,"children":6170},{"style":133},[6171],{"type":72,"value":6074},{"type":67,"tag":104,"props":6173,"children":6174},{"style":127},[6175],{"type":72,"value":336},{"type":67,"tag":104,"props":6177,"children":6178},{"style":133},[6179],{"type":72,"value":1367},{"type":67,"tag":104,"props":6181,"children":6182},{"style":127},[6183],{"type":72,"value":3741},{"type":67,"tag":104,"props":6185,"children":6186},{"class":106,"line":782},[6187,6191],{"type":67,"tag":104,"props":6188,"children":6189},{"style":127},[6190],{"type":72,"value":721},{"type":67,"tag":104,"props":6192,"children":6193},{"style":133},[6194],{"type":72,"value":771},{"type":67,"tag":75,"props":6196,"children":6197},{},[6198,6200,6206,6207,6213,6215,6221],{"type":72,"value":6199},"Server route must forward ",{"type":67,"tag":100,"props":6201,"children":6203},{"className":6202},[],[6204],{"type":72,"value":6205},"resume",{"type":72,"value":5490},{"type":67,"tag":100,"props":6208,"children":6210},{"className":6209},[],[6211],{"type":72,"value":6212},"parentRunId",{"type":72,"value":6214}," (via ",{"type":67,"tag":100,"props":6216,"children":6218},{"className":6217},[],[6219],{"type":72,"value":6220},"chatParamsFromRequest",{"type":72,"value":6222},"\nor equivalent). Client -- render bound interrupts:",{"type":67,"tag":93,"props":6224,"children":6226},{"className":95,"code":6225,"language":15,"meta":97,"style":97},"import { useChat, fetchServerSentEvents } from \"@tanstack\u002Fai-react\";\n\nfunction ChatPage() {\n  const { messages, interrupts, sendMessage } = useChat({\n    connection: fetchServerSentEvents(\"\u002Fapi\u002Fchat\"),\n  });\n\n  return (\n    \u003Cdiv>\n      {interrupts.map((interrupt) => {\n        if (interrupt.kind !== \"tool-approval\") return null;\n        return (\n          \u003Cdiv key={interrupt.id}>\n            \u003Cp>Approve \"{interrupt.toolName}\"?\u003C\u002Fp>\n            \u003Cpre>{JSON.stringify(interrupt.originalArgs, null, 2)}\u003C\u002Fpre>\n            \u003Cbutton onClick={() => interrupt.resolveInterrupt(true)}>\n              Approve\n            \u003C\u002Fbutton>\n            \u003Cbutton onClick={() => interrupt.resolveInterrupt(false)}>\n              Deny\n            \u003C\u002Fbutton>\n            \u003Cbutton onClick={() => interrupt.cancel()}>Cancel\u003C\u002Fbutton>\n          \u003C\u002Fdiv>\n        );\n      })}\n      {messages.map((msg) => (\n        \u003Cdiv key={msg.id}>\n          {msg.parts.map((part) =>\n            part.type === \"text\" ? \u003Cp key={part.content}>{part.content}\u003C\u002Fp> : null\n          )}\n        \u003C\u002Fdiv>\n      ))}\n    \u003C\u002Fdiv>\n  );\n}\n",[6227],{"type":67,"tag":100,"props":6228,"children":6229},{"__ignoreMap":97},[6230,6277,6284,6303,6355,6394,6409,6416,6427,6442,6482,6521,6533,6566,6613,6696,6726,6734,6750,6778,6786,6801,6847,6863,6875,6891,6930,6961,7004,7085,7096,7111,7122,7137,7148],{"type":67,"tag":104,"props":6231,"children":6232},{"class":106,"line":107},[6233,6237,6241,6245,6249,6253,6257,6261,6265,6269,6273],{"type":67,"tag":104,"props":6234,"children":6235},{"style":121},[6236],{"type":72,"value":124},{"type":67,"tag":104,"props":6238,"children":6239},{"style":127},[6240],{"type":72,"value":130},{"type":67,"tag":104,"props":6242,"children":6243},{"style":133},[6244],{"type":72,"value":2494},{"type":67,"tag":104,"props":6246,"children":6247},{"style":127},[6248],{"type":72,"value":661},{"type":67,"tag":104,"props":6250,"children":6251},{"style":133},[6252],{"type":72,"value":2405},{"type":67,"tag":104,"props":6254,"children":6255},{"style":127},[6256],{"type":72,"value":141},{"type":67,"tag":104,"props":6258,"children":6259},{"style":121},[6260],{"type":72,"value":146},{"type":67,"tag":104,"props":6262,"children":6263},{"style":127},[6264],{"type":72,"value":1998},{"type":67,"tag":104,"props":6266,"children":6267},{"style":154},[6268],{"type":72,"value":2003},{"type":67,"tag":104,"props":6270,"children":6271},{"style":127},[6272],{"type":72,"value":2008},{"type":67,"tag":104,"props":6274,"children":6275},{"style":127},[6276],{"type":72,"value":2013},{"type":67,"tag":104,"props":6278,"children":6279},{"class":106,"line":117},[6280],{"type":67,"tag":104,"props":6281,"children":6282},{"emptyLinePlaceholder":207},[6283],{"type":72,"value":210},{"type":67,"tag":104,"props":6285,"children":6286},{"class":106,"line":165},[6287,6291,6295,6299],{"type":67,"tag":104,"props":6288,"children":6289},{"style":222},[6290],{"type":72,"value":2107},{"type":67,"tag":104,"props":6292,"children":6293},{"style":238},[6294],{"type":72,"value":2112},{"type":67,"tag":104,"props":6296,"children":6297},{"style":127},[6298],{"type":72,"value":380},{"type":67,"tag":104,"props":6300,"children":6301},{"style":127},[6302],{"type":72,"value":1186},{"type":67,"tag":104,"props":6304,"children":6305},{"class":106,"line":203},[6306,6310,6314,6318,6322,6327,6331,6335,6339,6343,6347,6351],{"type":67,"tag":104,"props":6307,"children":6308},{"style":222},[6309],{"type":72,"value":1194},{"type":67,"tag":104,"props":6311,"children":6312},{"style":127},[6313],{"type":72,"value":130},{"type":67,"tag":104,"props":6315,"children":6316},{"style":133},[6317],{"type":72,"value":1692},{"type":67,"tag":104,"props":6319,"children":6320},{"style":127},[6321],{"type":72,"value":661},{"type":67,"tag":104,"props":6323,"children":6324},{"style":133},[6325],{"type":72,"value":6326}," interrupts",{"type":67,"tag":104,"props":6328,"children":6329},{"style":127},[6330],{"type":72,"value":661},{"type":67,"tag":104,"props":6332,"children":6333},{"style":133},[6334],{"type":72,"value":2481},{"type":67,"tag":104,"props":6336,"children":6337},{"style":127},[6338],{"type":72,"value":141},{"type":67,"tag":104,"props":6340,"children":6341},{"style":127},[6342],{"type":72,"value":1204},{"type":67,"tag":104,"props":6344,"children":6345},{"style":238},[6346],{"type":72,"value":2494},{"type":67,"tag":104,"props":6348,"children":6349},{"style":257},[6350],{"type":72,"value":245},{"type":67,"tag":104,"props":6352,"children":6353},{"style":127},[6354],{"type":72,"value":250},{"type":67,"tag":104,"props":6356,"children":6357},{"class":106,"line":213},[6358,6362,6366,6370,6374,6378,6382,6386,6390],{"type":67,"tag":104,"props":6359,"children":6360},{"style":257},[6361],{"type":72,"value":2396},{"type":67,"tag":104,"props":6363,"children":6364},{"style":127},[6365],{"type":72,"value":265},{"type":67,"tag":104,"props":6367,"children":6368},{"style":238},[6369],{"type":72,"value":2405},{"type":67,"tag":104,"props":6371,"children":6372},{"style":257},[6373],{"type":72,"value":245},{"type":67,"tag":104,"props":6375,"children":6376},{"style":127},[6377],{"type":72,"value":2008},{"type":67,"tag":104,"props":6379,"children":6380},{"style":154},[6381],{"type":72,"value":2418},{"type":67,"tag":104,"props":6383,"children":6384},{"style":127},[6385],{"type":72,"value":2008},{"type":67,"tag":104,"props":6387,"children":6388},{"style":257},[6389],{"type":72,"value":429},{"type":67,"tag":104,"props":6391,"children":6392},{"style":127},[6393],{"type":72,"value":284},{"type":67,"tag":104,"props":6395,"children":6396},{"class":106,"line":253},[6397,6401,6405],{"type":67,"tag":104,"props":6398,"children":6399},{"style":127},[6400],{"type":72,"value":534},{"type":67,"tag":104,"props":6402,"children":6403},{"style":257},[6404],{"type":72,"value":429},{"type":67,"tag":104,"props":6406,"children":6407},{"style":127},[6408],{"type":72,"value":2013},{"type":67,"tag":104,"props":6410,"children":6411},{"class":106,"line":287},[6412],{"type":67,"tag":104,"props":6413,"children":6414},{"emptyLinePlaceholder":207},[6415],{"type":72,"value":210},{"type":67,"tag":104,"props":6417,"children":6418},{"class":106,"line":317},[6419,6423],{"type":67,"tag":104,"props":6420,"children":6421},{"style":121},[6422],{"type":72,"value":1288},{"type":67,"tag":104,"props":6424,"children":6425},{"style":257},[6426],{"type":72,"value":2550},{"type":67,"tag":104,"props":6428,"children":6429},{"class":106,"line":352},[6430,6434,6438],{"type":67,"tag":104,"props":6431,"children":6432},{"style":257},[6433],{"type":72,"value":2559},{"type":67,"tag":104,"props":6435,"children":6436},{"style":1665},[6437],{"type":72,"value":2564},{"type":67,"tag":104,"props":6439,"children":6440},{"style":257},[6441],{"type":72,"value":2569},{"type":67,"tag":104,"props":6443,"children":6444},{"class":106,"line":436},[6445,6449,6453,6457,6461,6465,6470,6474,6478],{"type":67,"tag":104,"props":6446,"children":6447},{"style":127},[6448],{"type":72,"value":2631},{"type":67,"tag":104,"props":6450,"children":6451},{"style":1159},[6452],{"type":72,"value":5480},{"type":67,"tag":104,"props":6454,"children":6455},{"style":257},[6456],{"type":72,"value":336},{"type":67,"tag":104,"props":6458,"children":6459},{"style":1159},[6460],{"type":72,"value":1316},{"type":67,"tag":104,"props":6462,"children":6463},{"style":257},[6464],{"type":72,"value":2649},{"type":67,"tag":104,"props":6466,"children":6467},{"style":1159},[6468],{"type":72,"value":6469},"interrupt",{"type":67,"tag":104,"props":6471,"children":6472},{"style":257},[6473],{"type":72,"value":2659},{"type":67,"tag":104,"props":6475,"children":6476},{"style":127},[6477],{"type":72,"value":2664},{"type":67,"tag":104,"props":6479,"children":6480},{"style":127},[6481],{"type":72,"value":1186},{"type":67,"tag":104,"props":6483,"children":6484},{"class":106,"line":528},[6485,6490,6494,6499,6503,6508,6512,6516],{"type":67,"tag":104,"props":6486,"children":6487},{"style":257},[6488],{"type":72,"value":6489},"        if ",{"type":67,"tag":104,"props":6491,"children":6492},{"style":127},[6493],{"type":72,"value":245},{"type":67,"tag":104,"props":6495,"children":6496},{"style":257},[6497],{"type":72,"value":6498},"interrupt.kind !== ",{"type":67,"tag":104,"props":6500,"children":6501},{"style":127},[6502],{"type":72,"value":2008},{"type":67,"tag":104,"props":6504,"children":6505},{"style":154},[6506],{"type":72,"value":6507},"tool-approval",{"type":67,"tag":104,"props":6509,"children":6510},{"style":127},[6511],{"type":72,"value":2008},{"type":67,"tag":104,"props":6513,"children":6514},{"style":127},[6515],{"type":72,"value":429},{"type":67,"tag":104,"props":6517,"children":6518},{"style":257},[6519],{"type":72,"value":6520}," return null;\n",{"type":67,"tag":104,"props":6522,"children":6523},{"class":106,"line":545},[6524,6529],{"type":67,"tag":104,"props":6525,"children":6526},{"style":257},[6527],{"type":72,"value":6528},"        return ",{"type":67,"tag":104,"props":6530,"children":6531},{"style":127},[6532],{"type":72,"value":606},{"type":67,"tag":104,"props":6534,"children":6535},{"class":106,"line":578},[6536,6541,6545,6549,6553,6558,6562],{"type":67,"tag":104,"props":6537,"children":6538},{"style":257},[6539],{"type":72,"value":6540},"          \u003C",{"type":67,"tag":104,"props":6542,"children":6543},{"style":1159},[6544],{"type":72,"value":2564},{"type":67,"tag":104,"props":6546,"children":6547},{"style":1159},[6548],{"type":72,"value":2686},{"type":67,"tag":104,"props":6550,"children":6551},{"style":127},[6552],{"type":72,"value":2691},{"type":67,"tag":104,"props":6554,"children":6555},{"style":257},[6556],{"type":72,"value":6557},"interrupt.",{"type":67,"tag":104,"props":6559,"children":6560},{"style":133},[6561],{"type":72,"value":1367},{"type":67,"tag":104,"props":6563,"children":6564},{"style":127},[6565],{"type":72,"value":2705},{"type":67,"tag":104,"props":6567,"children":6568},{"class":106,"line":609},[6569,6574,6578,6582,6587,6591,6596,6600,6605,6609],{"type":67,"tag":104,"props":6570,"children":6571},{"style":257},[6572],{"type":72,"value":6573},"            \u003C",{"type":67,"tag":104,"props":6575,"children":6576},{"style":1159},[6577],{"type":72,"value":75},{"type":67,"tag":104,"props":6579,"children":6580},{"style":257},[6581],{"type":72,"value":2587},{"type":67,"tag":104,"props":6583,"children":6584},{"style":1159},[6585],{"type":72,"value":6586},"Approve",{"type":67,"tag":104,"props":6588,"children":6589},{"style":127},[6590],{"type":72,"value":1998},{"type":67,"tag":104,"props":6592,"children":6593},{"style":154},[6594],{"type":72,"value":6595},"{interrupt.toolName}",{"type":67,"tag":104,"props":6597,"children":6598},{"style":127},[6599],{"type":72,"value":2008},{"type":67,"tag":104,"props":6601,"children":6602},{"style":257},[6603],{"type":72,"value":6604},"?\u003C\u002F",{"type":67,"tag":104,"props":6606,"children":6607},{"style":1159},[6608],{"type":72,"value":75},{"type":67,"tag":104,"props":6610,"children":6611},{"style":257},[6612],{"type":72,"value":2569},{"type":67,"tag":104,"props":6614,"children":6615},{"class":106,"line":732},[6616,6620,6624,6628,6632,6637,6641,6646,6650,6654,6658,6663,6667,6671,6675,6680,6684,6688,6692],{"type":67,"tag":104,"props":6617,"children":6618},{"style":257},[6619],{"type":72,"value":6573},{"type":67,"tag":104,"props":6621,"children":6622},{"style":1159},[6623],{"type":72,"value":93},{"type":67,"tag":104,"props":6625,"children":6626},{"style":257},[6627],{"type":72,"value":2587},{"type":67,"tag":104,"props":6629,"children":6630},{"style":127},[6631],{"type":72,"value":398},{"type":67,"tag":104,"props":6633,"children":6634},{"style":1159},[6635],{"type":72,"value":6636},"JSON",{"type":67,"tag":104,"props":6638,"children":6639},{"style":257},[6640],{"type":72,"value":336},{"type":67,"tag":104,"props":6642,"children":6643},{"style":1159},[6644],{"type":72,"value":6645},"stringify",{"type":67,"tag":104,"props":6647,"children":6648},{"style":257},[6649],{"type":72,"value":245},{"type":67,"tag":104,"props":6651,"children":6652},{"style":1159},[6653],{"type":72,"value":6469},{"type":67,"tag":104,"props":6655,"children":6656},{"style":257},[6657],{"type":72,"value":336},{"type":67,"tag":104,"props":6659,"children":6660},{"style":1159},[6661],{"type":72,"value":6662},"originalArgs",{"type":67,"tag":104,"props":6664,"children":6665},{"style":127},[6666],{"type":72,"value":661},{"type":67,"tag":104,"props":6668,"children":6669},{"style":1159},[6670],{"type":72,"value":4723},{"type":67,"tag":104,"props":6672,"children":6673},{"style":127},[6674],{"type":72,"value":661},{"type":67,"tag":104,"props":6676,"children":6677},{"style":257},[6678],{"type":72,"value":6679}," 2)",{"type":67,"tag":104,"props":6681,"children":6682},{"style":127},[6683],{"type":72,"value":721},{"type":67,"tag":104,"props":6685,"children":6686},{"style":257},[6687],{"type":72,"value":2975},{"type":67,"tag":104,"props":6689,"children":6690},{"style":1159},[6691],{"type":72,"value":93},{"type":67,"tag":104,"props":6693,"children":6694},{"style":257},[6695],{"type":72,"value":2569},{"type":67,"tag":104,"props":6697,"children":6698},{"class":106,"line":745},[6699,6703,6708,6713,6717,6722],{"type":67,"tag":104,"props":6700,"children":6701},{"style":257},[6702],{"type":72,"value":6573},{"type":67,"tag":104,"props":6704,"children":6705},{"style":1159},[6706],{"type":72,"value":6707},"button",{"type":67,"tag":104,"props":6709,"children":6710},{"style":1159},[6711],{"type":72,"value":6712}," onClick",{"type":67,"tag":104,"props":6714,"children":6715},{"style":127},[6716],{"type":72,"value":2691},{"type":67,"tag":104,"props":6718,"children":6719},{"style":257},[6720],{"type":72,"value":6721},"() => interrupt.resolveInterrupt(true)",{"type":67,"tag":104,"props":6723,"children":6724},{"style":127},[6725],{"type":72,"value":2705},{"type":67,"tag":104,"props":6727,"children":6728},{"class":106,"line":761},[6729],{"type":67,"tag":104,"props":6730,"children":6731},{"style":1159},[6732],{"type":72,"value":6733},"              Approve\n",{"type":67,"tag":104,"props":6735,"children":6736},{"class":106,"line":774},[6737,6742,6746],{"type":67,"tag":104,"props":6738,"children":6739},{"style":257},[6740],{"type":72,"value":6741},"            \u003C\u002F",{"type":67,"tag":104,"props":6743,"children":6744},{"style":1159},[6745],{"type":72,"value":6707},{"type":67,"tag":104,"props":6747,"children":6748},{"style":257},[6749],{"type":72,"value":2569},{"type":67,"tag":104,"props":6751,"children":6752},{"class":106,"line":782},[6753,6757,6761,6765,6769,6774],{"type":67,"tag":104,"props":6754,"children":6755},{"style":257},[6756],{"type":72,"value":6573},{"type":67,"tag":104,"props":6758,"children":6759},{"style":1159},[6760],{"type":72,"value":6707},{"type":67,"tag":104,"props":6762,"children":6763},{"style":1159},[6764],{"type":72,"value":6712},{"type":67,"tag":104,"props":6766,"children":6767},{"style":127},[6768],{"type":72,"value":2691},{"type":67,"tag":104,"props":6770,"children":6771},{"style":257},[6772],{"type":72,"value":6773},"() => interrupt.resolveInterrupt(false)",{"type":67,"tag":104,"props":6775,"children":6776},{"style":127},[6777],{"type":72,"value":2705},{"type":67,"tag":104,"props":6779,"children":6780},{"class":106,"line":815},[6781],{"type":67,"tag":104,"props":6782,"children":6783},{"style":1159},[6784],{"type":72,"value":6785},"              Deny\n",{"type":67,"tag":104,"props":6787,"children":6788},{"class":106,"line":844},[6789,6793,6797],{"type":67,"tag":104,"props":6790,"children":6791},{"style":257},[6792],{"type":72,"value":6741},{"type":67,"tag":104,"props":6794,"children":6795},{"style":1159},[6796],{"type":72,"value":6707},{"type":67,"tag":104,"props":6798,"children":6799},{"style":257},[6800],{"type":72,"value":2569},{"type":67,"tag":104,"props":6802,"children":6803},{"class":106,"line":873},[6804,6808,6812,6816,6820,6825,6830,6835,6839,6843],{"type":67,"tag":104,"props":6805,"children":6806},{"style":257},[6807],{"type":72,"value":6573},{"type":67,"tag":104,"props":6809,"children":6810},{"style":1159},[6811],{"type":72,"value":6707},{"type":67,"tag":104,"props":6813,"children":6814},{"style":1159},[6815],{"type":72,"value":6712},{"type":67,"tag":104,"props":6817,"children":6818},{"style":127},[6819],{"type":72,"value":2691},{"type":67,"tag":104,"props":6821,"children":6822},{"style":257},[6823],{"type":72,"value":6824},"() => interrupt.cancel()",{"type":67,"tag":104,"props":6826,"children":6827},{"style":127},[6828],{"type":72,"value":6829},"}>",{"type":67,"tag":104,"props":6831,"children":6832},{"style":133},[6833],{"type":72,"value":6834},"Cancel",{"type":67,"tag":104,"props":6836,"children":6837},{"style":127},[6838],{"type":72,"value":2975},{"type":67,"tag":104,"props":6840,"children":6841},{"style":133},[6842],{"type":72,"value":6707},{"type":67,"tag":104,"props":6844,"children":6845},{"style":127},[6846],{"type":72,"value":2569},{"type":67,"tag":104,"props":6848,"children":6849},{"class":106,"line":971},[6850,6855,6859],{"type":67,"tag":104,"props":6851,"children":6852},{"style":257},[6853],{"type":72,"value":6854},"          \u003C\u002F",{"type":67,"tag":104,"props":6856,"children":6857},{"style":1159},[6858],{"type":72,"value":2564},{"type":67,"tag":104,"props":6860,"children":6861},{"style":257},[6862],{"type":72,"value":2569},{"type":67,"tag":104,"props":6864,"children":6865},{"class":106,"line":1041},[6866,6871],{"type":67,"tag":104,"props":6867,"children":6868},{"style":127},[6869],{"type":72,"value":6870},"        )",{"type":67,"tag":104,"props":6872,"children":6873},{"style":257},[6874],{"type":72,"value":2013},{"type":67,"tag":104,"props":6876,"children":6877},{"class":106,"line":2459},[6878,6883,6887],{"type":67,"tag":104,"props":6879,"children":6880},{"style":127},[6881],{"type":72,"value":6882},"      }",{"type":67,"tag":104,"props":6884,"children":6885},{"style":257},[6886],{"type":72,"value":429},{"type":67,"tag":104,"props":6888,"children":6889},{"style":127},[6890],{"type":72,"value":1891},{"type":67,"tag":104,"props":6892,"children":6893},{"class":106,"line":2514},[6894,6898,6902,6906,6910,6914,6918,6922,6926],{"type":67,"tag":104,"props":6895,"children":6896},{"style":127},[6897],{"type":72,"value":2631},{"type":67,"tag":104,"props":6899,"children":6900},{"style":1159},[6901],{"type":72,"value":2636},{"type":67,"tag":104,"props":6903,"children":6904},{"style":257},[6905],{"type":72,"value":336},{"type":67,"tag":104,"props":6907,"children":6908},{"style":1159},[6909],{"type":72,"value":1316},{"type":67,"tag":104,"props":6911,"children":6912},{"style":257},[6913],{"type":72,"value":2649},{"type":67,"tag":104,"props":6915,"children":6916},{"style":1159},[6917],{"type":72,"value":2654},{"type":67,"tag":104,"props":6919,"children":6920},{"style":257},[6921],{"type":72,"value":2659},{"type":67,"tag":104,"props":6923,"children":6924},{"style":127},[6925],{"type":72,"value":2664},{"type":67,"tag":104,"props":6927,"children":6928},{"style":257},[6929],{"type":72,"value":2550},{"type":67,"tag":104,"props":6931,"children":6932},{"class":106,"line":2523},[6933,6937,6941,6945,6949,6953,6957],{"type":67,"tag":104,"props":6934,"children":6935},{"style":127},[6936],{"type":72,"value":2677},{"type":67,"tag":104,"props":6938,"children":6939},{"style":133},[6940],{"type":72,"value":2564},{"type":67,"tag":104,"props":6942,"children":6943},{"style":133},[6944],{"type":72,"value":2686},{"type":67,"tag":104,"props":6946,"children":6947},{"style":127},[6948],{"type":72,"value":2691},{"type":67,"tag":104,"props":6950,"children":6951},{"style":257},[6952],{"type":72,"value":2696},{"type":67,"tag":104,"props":6954,"children":6955},{"style":133},[6956],{"type":72,"value":1367},{"type":67,"tag":104,"props":6958,"children":6959},{"style":127},[6960],{"type":72,"value":2705},{"type":67,"tag":104,"props":6962,"children":6963},{"class":106,"line":2532},[6964,6968,6972,6976,6980,6984,6988,6992,6996,7000],{"type":67,"tag":104,"props":6965,"children":6966},{"style":127},[6967],{"type":72,"value":2714},{"type":67,"tag":104,"props":6969,"children":6970},{"style":1159},[6971],{"type":72,"value":2654},{"type":67,"tag":104,"props":6973,"children":6974},{"style":257},[6975],{"type":72,"value":336},{"type":67,"tag":104,"props":6977,"children":6978},{"style":1159},[6979],{"type":72,"value":2727},{"type":67,"tag":104,"props":6981,"children":6982},{"style":257},[6983],{"type":72,"value":336},{"type":67,"tag":104,"props":6985,"children":6986},{"style":1159},[6987],{"type":72,"value":1316},{"type":67,"tag":104,"props":6989,"children":6990},{"style":257},[6991],{"type":72,"value":2649},{"type":67,"tag":104,"props":6993,"children":6994},{"style":1159},[6995],{"type":72,"value":2744},{"type":67,"tag":104,"props":6997,"children":6998},{"style":257},[6999],{"type":72,"value":2659},{"type":67,"tag":104,"props":7001,"children":7002},{"style":127},[7003],{"type":72,"value":5299},{"type":67,"tag":104,"props":7005,"children":7006},{"class":106,"line":2540},[7007,7011,7015,7019,7023,7027,7031,7035,7039,7043,7047,7051,7056,7060,7064,7068,7072,7076,7081],{"type":67,"tag":104,"props":7008,"children":7009},{"style":1159},[7010],{"type":72,"value":5307},{"type":67,"tag":104,"props":7012,"children":7013},{"style":257},[7014],{"type":72,"value":336},{"type":67,"tag":104,"props":7016,"children":7017},{"style":1159},[7018],{"type":72,"value":5316},{"type":67,"tag":104,"props":7020,"children":7021},{"style":257},[7022],{"type":72,"value":5321},{"type":67,"tag":104,"props":7024,"children":7025},{"style":1159},[7026],{"type":72,"value":72},{"type":67,"tag":104,"props":7028,"children":7029},{"style":257},[7030],{"type":72,"value":5330},{"type":67,"tag":104,"props":7032,"children":7033},{"style":1159},[7034],{"type":72,"value":75},{"type":67,"tag":104,"props":7036,"children":7037},{"style":1159},[7038],{"type":72,"value":2686},{"type":67,"tag":104,"props":7040,"children":7041},{"style":127},[7042],{"type":72,"value":2691},{"type":67,"tag":104,"props":7044,"children":7045},{"style":257},[7046],{"type":72,"value":2937},{"type":67,"tag":104,"props":7048,"children":7049},{"style":133},[7050],{"type":72,"value":2822},{"type":67,"tag":104,"props":7052,"children":7053},{"style":127},[7054],{"type":72,"value":7055},"}>{",{"type":67,"tag":104,"props":7057,"children":7058},{"style":257},[7059],{"type":72,"value":2937},{"type":67,"tag":104,"props":7061,"children":7062},{"style":133},[7063],{"type":72,"value":2822},{"type":67,"tag":104,"props":7065,"children":7066},{"style":127},[7067],{"type":72,"value":5176},{"type":67,"tag":104,"props":7069,"children":7070},{"style":133},[7071],{"type":72,"value":75},{"type":67,"tag":104,"props":7073,"children":7074},{"style":127},[7075],{"type":72,"value":2587},{"type":67,"tag":104,"props":7077,"children":7078},{"style":257},[7079],{"type":72,"value":7080}," : ",{"type":67,"tag":104,"props":7082,"children":7083},{"style":127},[7084],{"type":72,"value":5376},{"type":67,"tag":104,"props":7086,"children":7087},{"class":106,"line":2553},[7088,7092],{"type":67,"tag":104,"props":7089,"children":7090},{"style":257},[7091],{"type":72,"value":5384},{"type":67,"tag":104,"props":7093,"children":7094},{"style":127},[7095],{"type":72,"value":1891},{"type":67,"tag":104,"props":7097,"children":7098},{"class":106,"line":2572},[7099,7103,7107],{"type":67,"tag":104,"props":7100,"children":7101},{"style":127},[7102],{"type":72,"value":3028},{"type":67,"tag":104,"props":7104,"children":7105},{"style":133},[7106],{"type":72,"value":2564},{"type":67,"tag":104,"props":7108,"children":7109},{"style":127},[7110],{"type":72,"value":2569},{"type":67,"tag":104,"props":7112,"children":7113},{"class":106,"line":2625},[7114,7118],{"type":67,"tag":104,"props":7115,"children":7116},{"style":257},[7117],{"type":72,"value":3045},{"type":67,"tag":104,"props":7119,"children":7120},{"style":127},[7121],{"type":72,"value":1891},{"type":67,"tag":104,"props":7123,"children":7124},{"class":106,"line":2671},[7125,7129,7133],{"type":67,"tag":104,"props":7126,"children":7127},{"style":127},[7128],{"type":72,"value":3058},{"type":67,"tag":104,"props":7130,"children":7131},{"style":133},[7132],{"type":72,"value":2564},{"type":67,"tag":104,"props":7134,"children":7135},{"style":127},[7136],{"type":72,"value":2569},{"type":67,"tag":104,"props":7138,"children":7139},{"class":106,"line":2708},[7140,7144],{"type":67,"tag":104,"props":7141,"children":7142},{"style":257},[7143],{"type":72,"value":3075},{"type":67,"tag":104,"props":7145,"children":7146},{"style":127},[7147],{"type":72,"value":2013},{"type":67,"tag":104,"props":7149,"children":7150},{"class":106,"line":2759},[7151],{"type":67,"tag":104,"props":7152,"children":7153},{"style":127},[7154],{"type":72,"value":1891},{"type":67,"tag":75,"props":7156,"children":7157},{},[7158,7160,7165,7167,7173,7174,7180],{"type":72,"value":7159},"Batch all pending approvals with ",{"type":67,"tag":100,"props":7161,"children":7163},{"className":7162},[],[7164],{"type":72,"value":5496},{"type":72,"value":7166}," (void — submission is\nasync; watch ",{"type":67,"tag":100,"props":7168,"children":7170},{"className":7169},[],[7171],{"type":72,"value":7172},"resuming",{"type":72,"value":5490},{"type":67,"tag":100,"props":7175,"children":7177},{"className":7176},[],[7178],{"type":72,"value":7179},"interruptErrors",{"type":72,"value":7181},"):",{"type":67,"tag":93,"props":7183,"children":7185},{"className":95,"code":7184,"language":15,"meta":97,"style":97},"\u002F\u002F Payloadless tool-approvals only\nresolveInterrupts(true)\n\n\u002F\u002F Or per-item:\nresolveInterrupts((interrupt) => {\n  if (interrupt.kind === 'tool-approval') {\n    interrupt.resolveInterrupt(true)\n  }\n})\n",[7186],{"type":67,"tag":100,"props":7187,"children":7188},{"__ignoreMap":97},[7189,7197,7217,7224,7232,7263,7313,7341,7348],{"type":67,"tag":104,"props":7190,"children":7191},{"class":106,"line":107},[7192],{"type":67,"tag":104,"props":7193,"children":7194},{"style":111},[7195],{"type":72,"value":7196},"\u002F\u002F Payloadless tool-approvals only\n",{"type":67,"tag":104,"props":7198,"children":7199},{"class":106,"line":117},[7200,7204,7208,7213],{"type":67,"tag":104,"props":7201,"children":7202},{"style":238},[7203],{"type":72,"value":5496},{"type":67,"tag":104,"props":7205,"children":7206},{"style":133},[7207],{"type":72,"value":245},{"type":67,"tag":104,"props":7209,"children":7210},{"style":2291},[7211],{"type":72,"value":7212},"true",{"type":67,"tag":104,"props":7214,"children":7215},{"style":133},[7216],{"type":72,"value":771},{"type":67,"tag":104,"props":7218,"children":7219},{"class":106,"line":165},[7220],{"type":67,"tag":104,"props":7221,"children":7222},{"emptyLinePlaceholder":207},[7223],{"type":72,"value":210},{"type":67,"tag":104,"props":7225,"children":7226},{"class":106,"line":203},[7227],{"type":67,"tag":104,"props":7228,"children":7229},{"style":111},[7230],{"type":72,"value":7231},"\u002F\u002F Or per-item:\n",{"type":67,"tag":104,"props":7233,"children":7234},{"class":106,"line":213},[7235,7239,7243,7247,7251,7255,7259],{"type":67,"tag":104,"props":7236,"children":7237},{"style":238},[7238],{"type":72,"value":5496},{"type":67,"tag":104,"props":7240,"children":7241},{"style":133},[7242],{"type":72,"value":245},{"type":67,"tag":104,"props":7244,"children":7245},{"style":127},[7246],{"type":72,"value":245},{"type":67,"tag":104,"props":7248,"children":7249},{"style":1159},[7250],{"type":72,"value":6469},{"type":67,"tag":104,"props":7252,"children":7253},{"style":127},[7254],{"type":72,"value":429},{"type":67,"tag":104,"props":7256,"children":7257},{"style":222},[7258],{"type":72,"value":1181},{"type":67,"tag":104,"props":7260,"children":7261},{"style":127},[7262],{"type":72,"value":1186},{"type":67,"tag":104,"props":7264,"children":7265},{"class":106,"line":253},[7266,7271,7275,7279,7283,7288,7293,7297,7301,7305,7309],{"type":67,"tag":104,"props":7267,"children":7268},{"style":121},[7269],{"type":72,"value":7270},"  if",{"type":67,"tag":104,"props":7272,"children":7273},{"style":257},[7274],{"type":72,"value":1341},{"type":67,"tag":104,"props":7276,"children":7277},{"style":133},[7278],{"type":72,"value":6469},{"type":67,"tag":104,"props":7280,"children":7281},{"style":127},[7282],{"type":72,"value":336},{"type":67,"tag":104,"props":7284,"children":7285},{"style":133},[7286],{"type":72,"value":7287},"kind",{"type":67,"tag":104,"props":7289,"children":7290},{"style":127},[7291],{"type":72,"value":7292}," ===",{"type":67,"tag":104,"props":7294,"children":7295},{"style":127},[7296],{"type":72,"value":151},{"type":67,"tag":104,"props":7298,"children":7299},{"style":154},[7300],{"type":72,"value":6507},{"type":67,"tag":104,"props":7302,"children":7303},{"style":127},[7304],{"type":72,"value":279},{"type":67,"tag":104,"props":7306,"children":7307},{"style":257},[7308],{"type":72,"value":2659},{"type":67,"tag":104,"props":7310,"children":7311},{"style":127},[7312],{"type":72,"value":250},{"type":67,"tag":104,"props":7314,"children":7315},{"class":106,"line":287},[7316,7321,7325,7329,7333,7337],{"type":67,"tag":104,"props":7317,"children":7318},{"style":133},[7319],{"type":72,"value":7320},"    interrupt",{"type":67,"tag":104,"props":7322,"children":7323},{"style":127},[7324],{"type":72,"value":336},{"type":67,"tag":104,"props":7326,"children":7327},{"style":238},[7328],{"type":72,"value":5488},{"type":67,"tag":104,"props":7330,"children":7331},{"style":257},[7332],{"type":72,"value":245},{"type":67,"tag":104,"props":7334,"children":7335},{"style":2291},[7336],{"type":72,"value":7212},{"type":67,"tag":104,"props":7338,"children":7339},{"style":257},[7340],{"type":72,"value":771},{"type":67,"tag":104,"props":7342,"children":7343},{"class":106,"line":317},[7344],{"type":67,"tag":104,"props":7345,"children":7346},{"style":127},[7347],{"type":72,"value":1438},{"type":67,"tag":104,"props":7349,"children":7350},{"class":106,"line":352},[7351,7355],{"type":67,"tag":104,"props":7352,"children":7353},{"style":127},[7354],{"type":72,"value":721},{"type":67,"tag":104,"props":7356,"children":7357},{"style":133},[7358],{"type":72,"value":771},{"type":67,"tag":75,"props":7360,"children":7361},{},[7362,7364,7369,7371,7376,7378,7383,7385,7391],{"type":72,"value":7363},"Migration: ",{"type":67,"tag":100,"props":7365,"children":7367},{"className":7366},[],[7368],{"type":72,"value":5519},{"type":72,"value":7370}," aliases ",{"type":67,"tag":100,"props":7372,"children":7374},{"className":7373},[],[7375],{"type":72,"value":5480},{"type":72,"value":7377},"; ",{"type":67,"tag":100,"props":7379,"children":7381},{"className":7380},[],[7382],{"type":72,"value":5511},{"type":72,"value":7384},"\nforwards to the matching bound approval when present. Prefer the bound methods\nabove for new code. See ",{"type":67,"tag":100,"props":7386,"children":7388},{"className":7387},[],[7389],{"type":72,"value":7390},"docs\u002Finterrupts\u002F",{"type":72,"value":336},{"type":67,"tag":3095,"props":7393,"children":7395},{"id":7394},"pattern-4-lazy-tool-discovery",[7396],{"type":72,"value":7397},"Pattern 4: Lazy Tool Discovery",{"type":67,"tag":75,"props":7399,"children":7400},{},[7401,7402,7408,7410,7416],{"type":72,"value":5458},{"type":67,"tag":100,"props":7403,"children":7405},{"className":7404},[],[7406],{"type":72,"value":7407},"lazy: true",{"type":72,"value":7409}," on rarely-needed tools. The LLM sees their names via a synthetic\n",{"type":67,"tag":100,"props":7411,"children":7413},{"className":7412},[],[7414],{"type":72,"value":7415},"__lazy__tool__discovery__",{"type":72,"value":7417}," tool and discovers schemas on demand. Saves tokens.",{"type":67,"tag":93,"props":7419,"children":7421},{"className":95,"code":7420,"language":15,"meta":97,"style":97},"import {\n  toolDefinition,\n  chat,\n  toServerSentEventsResponse,\n  maxIterations,\n} from '@tanstack\u002Fai'\nimport { openaiText } from '@tanstack\u002Fai-openai'\nimport { z } from 'zod'\n\nconst getProductsDef = toolDefinition({\n  name: 'getProducts',\n  description: 'List all products',\n  inputSchema: z.object({}),\n  outputSchema: z.array(\n    z.object({ id: z.number(), name: z.string(), price: z.number() }),\n  ),\n})\nconst getProducts = getProductsDef.server(async () => db.products.findMany())\n\nconst compareProductsDef = toolDefinition({\n  name: 'compareProducts',\n  description: 'Compare two or more products side by side',\n  inputSchema: z.object({ productIds: z.array(z.number()).min(2) }),\n  lazy: true, \u002F\u002F not sent to LLM upfront\n})\nconst compareProducts = compareProductsDef.server(async ({ productIds }) => {\n  return db.products.findMany({ where: { id: { in: productIds } } })\n})\n\nexport async function POST(request: Request) {\n  const { messages } = await request.json()\n  const stream = chat({\n    adapter: openaiText('gpt-5.5'),\n    messages,\n    tools: [getProducts, compareProducts],\n    \u002F\u002F maxIterations bounds model turns, not tool calls. For tool budgets,\n    \u002F\u002F use middleware onBeforeToolCall + onShouldContinue (see agentic-cycle docs).\n    agentLoopStrategy: maxIterations(20),\n  })\n  return toServerSentEventsResponse(stream)\n}\n",[7422],{"type":67,"tag":100,"props":7423,"children":7424},{"__ignoreMap":97},[7425,7436,7448,7460,7472,7484,7507,7542,7577,7584,7611,7638,7666,7706,7733,7849,7860,7871,7941,7948,7976,8004,8032,8136,8161,8172,8229,8317,8328,8335,8378,8421,8448,8487,8498,8534,8542,8550,8584,8595,8618],{"type":67,"tag":104,"props":7426,"children":7427},{"class":106,"line":107},[7428,7432],{"type":67,"tag":104,"props":7429,"children":7430},{"style":121},[7431],{"type":72,"value":124},{"type":67,"tag":104,"props":7433,"children":7434},{"style":127},[7435],{"type":72,"value":1186},{"type":67,"tag":104,"props":7437,"children":7438},{"class":106,"line":117},[7439,7444],{"type":67,"tag":104,"props":7440,"children":7441},{"style":133},[7442],{"type":72,"value":7443},"  toolDefinition",{"type":67,"tag":104,"props":7445,"children":7446},{"style":127},[7447],{"type":72,"value":284},{"type":67,"tag":104,"props":7449,"children":7450},{"class":106,"line":165},[7451,7456],{"type":67,"tag":104,"props":7452,"children":7453},{"style":133},[7454],{"type":72,"value":7455},"  chat",{"type":67,"tag":104,"props":7457,"children":7458},{"style":127},[7459],{"type":72,"value":284},{"type":67,"tag":104,"props":7461,"children":7462},{"class":106,"line":203},[7463,7468],{"type":67,"tag":104,"props":7464,"children":7465},{"style":133},[7466],{"type":72,"value":7467},"  toServerSentEventsResponse",{"type":67,"tag":104,"props":7469,"children":7470},{"style":127},[7471],{"type":72,"value":284},{"type":67,"tag":104,"props":7473,"children":7474},{"class":106,"line":213},[7475,7480],{"type":67,"tag":104,"props":7476,"children":7477},{"style":133},[7478],{"type":72,"value":7479},"  maxIterations",{"type":67,"tag":104,"props":7481,"children":7482},{"style":127},[7483],{"type":72,"value":284},{"type":67,"tag":104,"props":7485,"children":7486},{"class":106,"line":253},[7487,7491,7495,7499,7503],{"type":67,"tag":104,"props":7488,"children":7489},{"style":127},[7490],{"type":72,"value":721},{"type":67,"tag":104,"props":7492,"children":7493},{"style":121},[7494],{"type":72,"value":146},{"type":67,"tag":104,"props":7496,"children":7497},{"style":127},[7498],{"type":72,"value":151},{"type":67,"tag":104,"props":7500,"children":7501},{"style":154},[7502],{"type":72,"value":157},{"type":67,"tag":104,"props":7504,"children":7505},{"style":127},[7506],{"type":72,"value":162},{"type":67,"tag":104,"props":7508,"children":7509},{"class":106,"line":287},[7510,7514,7518,7522,7526,7530,7534,7538],{"type":67,"tag":104,"props":7511,"children":7512},{"style":121},[7513],{"type":72,"value":124},{"type":67,"tag":104,"props":7515,"children":7516},{"style":127},[7517],{"type":72,"value":130},{"type":67,"tag":104,"props":7519,"children":7520},{"style":133},[7521],{"type":72,"value":1525},{"type":67,"tag":104,"props":7523,"children":7524},{"style":127},[7525],{"type":72,"value":141},{"type":67,"tag":104,"props":7527,"children":7528},{"style":121},[7529],{"type":72,"value":146},{"type":67,"tag":104,"props":7531,"children":7532},{"style":127},[7533],{"type":72,"value":151},{"type":67,"tag":104,"props":7535,"children":7536},{"style":154},[7537],{"type":72,"value":1542},{"type":67,"tag":104,"props":7539,"children":7540},{"style":127},[7541],{"type":72,"value":162},{"type":67,"tag":104,"props":7543,"children":7544},{"class":106,"line":317},[7545,7549,7553,7557,7561,7565,7569,7573],{"type":67,"tag":104,"props":7546,"children":7547},{"style":121},[7548],{"type":72,"value":124},{"type":67,"tag":104,"props":7550,"children":7551},{"style":127},[7552],{"type":72,"value":130},{"type":67,"tag":104,"props":7554,"children":7555},{"style":133},[7556],{"type":72,"value":179},{"type":67,"tag":104,"props":7558,"children":7559},{"style":127},[7560],{"type":72,"value":141},{"type":67,"tag":104,"props":7562,"children":7563},{"style":121},[7564],{"type":72,"value":146},{"type":67,"tag":104,"props":7566,"children":7567},{"style":127},[7568],{"type":72,"value":151},{"type":67,"tag":104,"props":7570,"children":7571},{"style":154},[7572],{"type":72,"value":196},{"type":67,"tag":104,"props":7574,"children":7575},{"style":127},[7576],{"type":72,"value":162},{"type":67,"tag":104,"props":7578,"children":7579},{"class":106,"line":352},[7580],{"type":67,"tag":104,"props":7581,"children":7582},{"emptyLinePlaceholder":207},[7583],{"type":72,"value":210},{"type":67,"tag":104,"props":7585,"children":7586},{"class":106,"line":436},[7587,7591,7595,7599,7603,7607],{"type":67,"tag":104,"props":7588,"children":7589},{"style":222},[7590],{"type":72,"value":3221},{"type":67,"tag":104,"props":7592,"children":7593},{"style":133},[7594],{"type":72,"value":230},{"type":67,"tag":104,"props":7596,"children":7597},{"style":127},[7598],{"type":72,"value":235},{"type":67,"tag":104,"props":7600,"children":7601},{"style":238},[7602],{"type":72,"value":136},{"type":67,"tag":104,"props":7604,"children":7605},{"style":133},[7606],{"type":72,"value":245},{"type":67,"tag":104,"props":7608,"children":7609},{"style":127},[7610],{"type":72,"value":250},{"type":67,"tag":104,"props":7612,"children":7613},{"class":106,"line":528},[7614,7618,7622,7626,7630,7634],{"type":67,"tag":104,"props":7615,"children":7616},{"style":257},[7617],{"type":72,"value":260},{"type":67,"tag":104,"props":7619,"children":7620},{"style":127},[7621],{"type":72,"value":265},{"type":67,"tag":104,"props":7623,"children":7624},{"style":127},[7625],{"type":72,"value":151},{"type":67,"tag":104,"props":7627,"children":7628},{"style":154},[7629],{"type":72,"value":1826},{"type":67,"tag":104,"props":7631,"children":7632},{"style":127},[7633],{"type":72,"value":279},{"type":67,"tag":104,"props":7635,"children":7636},{"style":127},[7637],{"type":72,"value":284},{"type":67,"tag":104,"props":7639,"children":7640},{"class":106,"line":545},[7641,7645,7649,7653,7658,7662],{"type":67,"tag":104,"props":7642,"children":7643},{"style":257},[7644],{"type":72,"value":293},{"type":67,"tag":104,"props":7646,"children":7647},{"style":127},[7648],{"type":72,"value":265},{"type":67,"tag":104,"props":7650,"children":7651},{"style":127},[7652],{"type":72,"value":151},{"type":67,"tag":104,"props":7654,"children":7655},{"style":154},[7656],{"type":72,"value":7657},"List all products",{"type":67,"tag":104,"props":7659,"children":7660},{"style":127},[7661],{"type":72,"value":279},{"type":67,"tag":104,"props":7663,"children":7664},{"style":127},[7665],{"type":72,"value":284},{"type":67,"tag":104,"props":7667,"children":7668},{"class":106,"line":578},[7669,7673,7677,7681,7685,7689,7693,7698,7702],{"type":67,"tag":104,"props":7670,"children":7671},{"style":257},[7672],{"type":72,"value":323},{"type":67,"tag":104,"props":7674,"children":7675},{"style":127},[7676],{"type":72,"value":265},{"type":67,"tag":104,"props":7678,"children":7679},{"style":133},[7680],{"type":72,"value":179},{"type":67,"tag":104,"props":7682,"children":7683},{"style":127},[7684],{"type":72,"value":336},{"type":67,"tag":104,"props":7686,"children":7687},{"style":238},[7688],{"type":72,"value":341},{"type":67,"tag":104,"props":7690,"children":7691},{"style":133},[7692],{"type":72,"value":245},{"type":67,"tag":104,"props":7694,"children":7695},{"style":127},[7696],{"type":72,"value":7697},"{}",{"type":67,"tag":104,"props":7699,"children":7700},{"style":133},[7701],{"type":72,"value":429},{"type":67,"tag":104,"props":7703,"children":7704},{"style":127},[7705],{"type":72,"value":284},{"type":67,"tag":104,"props":7707,"children":7708},{"class":106,"line":609},[7709,7713,7717,7721,7725,7729],{"type":67,"tag":104,"props":7710,"children":7711},{"style":257},[7712],{"type":72,"value":551},{"type":67,"tag":104,"props":7714,"children":7715},{"style":127},[7716],{"type":72,"value":265},{"type":67,"tag":104,"props":7718,"children":7719},{"style":133},[7720],{"type":72,"value":179},{"type":67,"tag":104,"props":7722,"children":7723},{"style":127},[7724],{"type":72,"value":336},{"type":67,"tag":104,"props":7726,"children":7727},{"style":238},[7728],{"type":72,"value":601},{"type":67,"tag":104,"props":7730,"children":7731},{"style":133},[7732],{"type":72,"value":606},{"type":67,"tag":104,"props":7734,"children":7735},{"class":106,"line":732},[7736,7741,7745,7749,7753,7757,7761,7765,7769,7773,7777,7781,7785,7789,7793,7797,7801,7805,7809,7813,7817,7821,7825,7829,7833,7837,7841,7845],{"type":67,"tag":104,"props":7737,"children":7738},{"style":133},[7739],{"type":72,"value":7740},"    z",{"type":67,"tag":104,"props":7742,"children":7743},{"style":127},[7744],{"type":72,"value":336},{"type":67,"tag":104,"props":7746,"children":7747},{"style":238},[7748],{"type":72,"value":341},{"type":67,"tag":104,"props":7750,"children":7751},{"style":133},[7752],{"type":72,"value":245},{"type":67,"tag":104,"props":7754,"children":7755},{"style":127},[7756],{"type":72,"value":398},{"type":67,"tag":104,"props":7758,"children":7759},{"style":257},[7760],{"type":72,"value":636},{"type":67,"tag":104,"props":7762,"children":7763},{"style":127},[7764],{"type":72,"value":265},{"type":67,"tag":104,"props":7766,"children":7767},{"style":133},[7768],{"type":72,"value":179},{"type":67,"tag":104,"props":7770,"children":7771},{"style":127},[7772],{"type":72,"value":336},{"type":67,"tag":104,"props":7774,"children":7775},{"style":238},[7776],{"type":72,"value":459},{"type":67,"tag":104,"props":7778,"children":7779},{"style":133},[7780],{"type":72,"value":380},{"type":67,"tag":104,"props":7782,"children":7783},{"style":127},[7784],{"type":72,"value":661},{"type":67,"tag":104,"props":7786,"children":7787},{"style":257},[7788],{"type":72,"value":666},{"type":67,"tag":104,"props":7790,"children":7791},{"style":127},[7792],{"type":72,"value":265},{"type":67,"tag":104,"props":7794,"children":7795},{"style":133},[7796],{"type":72,"value":179},{"type":67,"tag":104,"props":7798,"children":7799},{"style":127},[7800],{"type":72,"value":336},{"type":67,"tag":104,"props":7802,"children":7803},{"style":238},[7804],{"type":72,"value":375},{"type":67,"tag":104,"props":7806,"children":7807},{"style":133},[7808],{"type":72,"value":380},{"type":67,"tag":104,"props":7810,"children":7811},{"style":127},[7812],{"type":72,"value":661},{"type":67,"tag":104,"props":7814,"children":7815},{"style":257},[7816],{"type":72,"value":695},{"type":67,"tag":104,"props":7818,"children":7819},{"style":127},[7820],{"type":72,"value":265},{"type":67,"tag":104,"props":7822,"children":7823},{"style":133},[7824],{"type":72,"value":179},{"type":67,"tag":104,"props":7826,"children":7827},{"style":127},[7828],{"type":72,"value":336},{"type":67,"tag":104,"props":7830,"children":7831},{"style":238},[7832],{"type":72,"value":459},{"type":67,"tag":104,"props":7834,"children":7835},{"style":133},[7836],{"type":72,"value":716},{"type":67,"tag":104,"props":7838,"children":7839},{"style":127},[7840],{"type":72,"value":721},{"type":67,"tag":104,"props":7842,"children":7843},{"style":133},[7844],{"type":72,"value":429},{"type":67,"tag":104,"props":7846,"children":7847},{"style":127},[7848],{"type":72,"value":284},{"type":67,"tag":104,"props":7850,"children":7851},{"class":106,"line":745},[7852,7856],{"type":67,"tag":104,"props":7853,"children":7854},{"style":133},[7855],{"type":72,"value":3075},{"type":67,"tag":104,"props":7857,"children":7858},{"style":127},[7859],{"type":72,"value":284},{"type":67,"tag":104,"props":7861,"children":7862},{"class":106,"line":761},[7863,7867],{"type":67,"tag":104,"props":7864,"children":7865},{"style":127},[7866],{"type":72,"value":721},{"type":67,"tag":104,"props":7868,"children":7869},{"style":133},[7870],{"type":72,"value":771},{"type":67,"tag":104,"props":7872,"children":7873},{"class":106,"line":774},[7874,7878,7882,7886,7890,7894,7898,7902,7906,7911,7915,7919,7923,7927,7931,7936],{"type":67,"tag":104,"props":7875,"children":7876},{"style":222},[7877],{"type":72,"value":3221},{"type":67,"tag":104,"props":7879,"children":7880},{"style":133},[7881],{"type":72,"value":1125},{"type":67,"tag":104,"props":7883,"children":7884},{"style":127},[7885],{"type":72,"value":235},{"type":67,"tag":104,"props":7887,"children":7888},{"style":133},[7889],{"type":72,"value":1081},{"type":67,"tag":104,"props":7891,"children":7892},{"style":127},[7893],{"type":72,"value":336},{"type":67,"tag":104,"props":7895,"children":7896},{"style":238},[7897],{"type":72,"value":1142},{"type":67,"tag":104,"props":7899,"children":7900},{"style":133},[7901],{"type":72,"value":245},{"type":67,"tag":104,"props":7903,"children":7904},{"style":222},[7905],{"type":72,"value":1151},{"type":67,"tag":104,"props":7907,"children":7908},{"style":127},[7909],{"type":72,"value":7910}," ()",{"type":67,"tag":104,"props":7912,"children":7913},{"style":222},[7914],{"type":72,"value":1181},{"type":67,"tag":104,"props":7916,"children":7917},{"style":133},[7918],{"type":72,"value":1214},{"type":67,"tag":104,"props":7920,"children":7921},{"style":127},[7922],{"type":72,"value":336},{"type":67,"tag":104,"props":7924,"children":7925},{"style":133},[7926],{"type":72,"value":1223},{"type":67,"tag":104,"props":7928,"children":7929},{"style":127},[7930],{"type":72,"value":336},{"type":67,"tag":104,"props":7932,"children":7933},{"style":238},[7934],{"type":72,"value":7935},"findMany",{"type":67,"tag":104,"props":7937,"children":7938},{"style":133},[7939],{"type":72,"value":7940},"())\n",{"type":67,"tag":104,"props":7942,"children":7943},{"class":106,"line":782},[7944],{"type":67,"tag":104,"props":7945,"children":7946},{"emptyLinePlaceholder":207},[7947],{"type":72,"value":210},{"type":67,"tag":104,"props":7949,"children":7950},{"class":106,"line":815},[7951,7955,7960,7964,7968,7972],{"type":67,"tag":104,"props":7952,"children":7953},{"style":222},[7954],{"type":72,"value":3221},{"type":67,"tag":104,"props":7956,"children":7957},{"style":133},[7958],{"type":72,"value":7959}," compareProductsDef ",{"type":67,"tag":104,"props":7961,"children":7962},{"style":127},[7963],{"type":72,"value":235},{"type":67,"tag":104,"props":7965,"children":7966},{"style":238},[7967],{"type":72,"value":136},{"type":67,"tag":104,"props":7969,"children":7970},{"style":133},[7971],{"type":72,"value":245},{"type":67,"tag":104,"props":7973,"children":7974},{"style":127},[7975],{"type":72,"value":250},{"type":67,"tag":104,"props":7977,"children":7978},{"class":106,"line":844},[7979,7983,7987,7991,7996,8000],{"type":67,"tag":104,"props":7980,"children":7981},{"style":257},[7982],{"type":72,"value":260},{"type":67,"tag":104,"props":7984,"children":7985},{"style":127},[7986],{"type":72,"value":265},{"type":67,"tag":104,"props":7988,"children":7989},{"style":127},[7990],{"type":72,"value":151},{"type":67,"tag":104,"props":7992,"children":7993},{"style":154},[7994],{"type":72,"value":7995},"compareProducts",{"type":67,"tag":104,"props":7997,"children":7998},{"style":127},[7999],{"type":72,"value":279},{"type":67,"tag":104,"props":8001,"children":8002},{"style":127},[8003],{"type":72,"value":284},{"type":67,"tag":104,"props":8005,"children":8006},{"class":106,"line":873},[8007,8011,8015,8019,8024,8028],{"type":67,"tag":104,"props":8008,"children":8009},{"style":257},[8010],{"type":72,"value":293},{"type":67,"tag":104,"props":8012,"children":8013},{"style":127},[8014],{"type":72,"value":265},{"type":67,"tag":104,"props":8016,"children":8017},{"style":127},[8018],{"type":72,"value":151},{"type":67,"tag":104,"props":8020,"children":8021},{"style":154},[8022],{"type":72,"value":8023},"Compare two or more products side by side",{"type":67,"tag":104,"props":8025,"children":8026},{"style":127},[8027],{"type":72,"value":279},{"type":67,"tag":104,"props":8029,"children":8030},{"style":127},[8031],{"type":72,"value":284},{"type":67,"tag":104,"props":8033,"children":8034},{"class":106,"line":971},[8035,8039,8043,8047,8051,8055,8059,8063,8068,8072,8076,8080,8084,8089,8093,8097,8102,8106,8111,8115,8120,8124,8128,8132],{"type":67,"tag":104,"props":8036,"children":8037},{"style":257},[8038],{"type":72,"value":323},{"type":67,"tag":104,"props":8040,"children":8041},{"style":127},[8042],{"type":72,"value":265},{"type":67,"tag":104,"props":8044,"children":8045},{"style":133},[8046],{"type":72,"value":179},{"type":67,"tag":104,"props":8048,"children":8049},{"style":127},[8050],{"type":72,"value":336},{"type":67,"tag":104,"props":8052,"children":8053},{"style":238},[8054],{"type":72,"value":341},{"type":67,"tag":104,"props":8056,"children":8057},{"style":133},[8058],{"type":72,"value":245},{"type":67,"tag":104,"props":8060,"children":8061},{"style":127},[8062],{"type":72,"value":398},{"type":67,"tag":104,"props":8064,"children":8065},{"style":257},[8066],{"type":72,"value":8067}," productIds",{"type":67,"tag":104,"props":8069,"children":8070},{"style":127},[8071],{"type":72,"value":265},{"type":67,"tag":104,"props":8073,"children":8074},{"style":133},[8075],{"type":72,"value":179},{"type":67,"tag":104,"props":8077,"children":8078},{"style":127},[8079],{"type":72,"value":336},{"type":67,"tag":104,"props":8081,"children":8082},{"style":238},[8083],{"type":72,"value":601},{"type":67,"tag":104,"props":8085,"children":8086},{"style":133},[8087],{"type":72,"value":8088},"(z",{"type":67,"tag":104,"props":8090,"children":8091},{"style":127},[8092],{"type":72,"value":336},{"type":67,"tag":104,"props":8094,"children":8095},{"style":238},[8096],{"type":72,"value":459},{"type":67,"tag":104,"props":8098,"children":8099},{"style":133},[8100],{"type":72,"value":8101},"())",{"type":67,"tag":104,"props":8103,"children":8104},{"style":127},[8105],{"type":72,"value":336},{"type":67,"tag":104,"props":8107,"children":8108},{"style":238},[8109],{"type":72,"value":8110},"min",{"type":67,"tag":104,"props":8112,"children":8113},{"style":133},[8114],{"type":72,"value":245},{"type":67,"tag":104,"props":8116,"children":8117},{"style":1269},[8118],{"type":72,"value":8119},"2",{"type":67,"tag":104,"props":8121,"children":8122},{"style":133},[8123],{"type":72,"value":2659},{"type":67,"tag":104,"props":8125,"children":8126},{"style":127},[8127],{"type":72,"value":721},{"type":67,"tag":104,"props":8129,"children":8130},{"style":133},[8131],{"type":72,"value":429},{"type":67,"tag":104,"props":8133,"children":8134},{"style":127},[8135],{"type":72,"value":284},{"type":67,"tag":104,"props":8137,"children":8138},{"class":106,"line":1041},[8139,8144,8148,8152,8156],{"type":67,"tag":104,"props":8140,"children":8141},{"style":257},[8142],{"type":72,"value":8143},"  lazy",{"type":67,"tag":104,"props":8145,"children":8146},{"style":127},[8147],{"type":72,"value":265},{"type":67,"tag":104,"props":8149,"children":8150},{"style":2291},[8151],{"type":72,"value":2294},{"type":67,"tag":104,"props":8153,"children":8154},{"style":127},[8155],{"type":72,"value":661},{"type":67,"tag":104,"props":8157,"children":8158},{"style":111},[8159],{"type":72,"value":8160}," \u002F\u002F not sent to LLM upfront\n",{"type":67,"tag":104,"props":8162,"children":8163},{"class":106,"line":2459},[8164,8168],{"type":67,"tag":104,"props":8165,"children":8166},{"style":127},[8167],{"type":72,"value":721},{"type":67,"tag":104,"props":8169,"children":8170},{"style":133},[8171],{"type":72,"value":771},{"type":67,"tag":104,"props":8173,"children":8174},{"class":106,"line":2514},[8175,8179,8184,8188,8193,8197,8201,8205,8209,8213,8217,8221,8225],{"type":67,"tag":104,"props":8176,"children":8177},{"style":222},[8178],{"type":72,"value":3221},{"type":67,"tag":104,"props":8180,"children":8181},{"style":133},[8182],{"type":72,"value":8183}," compareProducts ",{"type":67,"tag":104,"props":8185,"children":8186},{"style":127},[8187],{"type":72,"value":235},{"type":67,"tag":104,"props":8189,"children":8190},{"style":133},[8191],{"type":72,"value":8192}," compareProductsDef",{"type":67,"tag":104,"props":8194,"children":8195},{"style":127},[8196],{"type":72,"value":336},{"type":67,"tag":104,"props":8198,"children":8199},{"style":238},[8200],{"type":72,"value":1142},{"type":67,"tag":104,"props":8202,"children":8203},{"style":133},[8204],{"type":72,"value":245},{"type":67,"tag":104,"props":8206,"children":8207},{"style":222},[8208],{"type":72,"value":1151},{"type":67,"tag":104,"props":8210,"children":8211},{"style":127},[8212],{"type":72,"value":1156},{"type":67,"tag":104,"props":8214,"children":8215},{"style":1159},[8216],{"type":72,"value":8067},{"type":67,"tag":104,"props":8218,"children":8219},{"style":127},[8220],{"type":72,"value":1176},{"type":67,"tag":104,"props":8222,"children":8223},{"style":222},[8224],{"type":72,"value":1181},{"type":67,"tag":104,"props":8226,"children":8227},{"style":127},[8228],{"type":72,"value":1186},{"type":67,"tag":104,"props":8230,"children":8231},{"class":106,"line":2523},[8232,8236,8240,8244,8248,8252,8256,8260,8264,8268,8272,8276,8280,8284,8288,8293,8297,8301,8305,8309,8313],{"type":67,"tag":104,"props":8233,"children":8234},{"style":121},[8235],{"type":72,"value":1288},{"type":67,"tag":104,"props":8237,"children":8238},{"style":133},[8239],{"type":72,"value":1214},{"type":67,"tag":104,"props":8241,"children":8242},{"style":127},[8243],{"type":72,"value":336},{"type":67,"tag":104,"props":8245,"children":8246},{"style":133},[8247],{"type":72,"value":1223},{"type":67,"tag":104,"props":8249,"children":8250},{"style":127},[8251],{"type":72,"value":336},{"type":67,"tag":104,"props":8253,"children":8254},{"style":238},[8255],{"type":72,"value":7935},{"type":67,"tag":104,"props":8257,"children":8258},{"style":257},[8259],{"type":72,"value":245},{"type":67,"tag":104,"props":8261,"children":8262},{"style":127},[8263],{"type":72,"value":398},{"type":67,"tag":104,"props":8265,"children":8266},{"style":257},[8267],{"type":72,"value":3648},{"type":67,"tag":104,"props":8269,"children":8270},{"style":127},[8271],{"type":72,"value":265},{"type":67,"tag":104,"props":8273,"children":8274},{"style":127},[8275],{"type":72,"value":130},{"type":67,"tag":104,"props":8277,"children":8278},{"style":257},[8279],{"type":72,"value":636},{"type":67,"tag":104,"props":8281,"children":8282},{"style":127},[8283],{"type":72,"value":265},{"type":67,"tag":104,"props":8285,"children":8286},{"style":127},[8287],{"type":72,"value":130},{"type":67,"tag":104,"props":8289,"children":8290},{"style":257},[8291],{"type":72,"value":8292}," in",{"type":67,"tag":104,"props":8294,"children":8295},{"style":127},[8296],{"type":72,"value":265},{"type":67,"tag":104,"props":8298,"children":8299},{"style":133},[8300],{"type":72,"value":8067},{"type":67,"tag":104,"props":8302,"children":8303},{"style":127},[8304],{"type":72,"value":141},{"type":67,"tag":104,"props":8306,"children":8307},{"style":127},[8308],{"type":72,"value":141},{"type":67,"tag":104,"props":8310,"children":8311},{"style":127},[8312],{"type":72,"value":141},{"type":67,"tag":104,"props":8314,"children":8315},{"style":257},[8316],{"type":72,"value":771},{"type":67,"tag":104,"props":8318,"children":8319},{"class":106,"line":2532},[8320,8324],{"type":67,"tag":104,"props":8321,"children":8322},{"style":127},[8323],{"type":72,"value":721},{"type":67,"tag":104,"props":8325,"children":8326},{"style":133},[8327],{"type":72,"value":771},{"type":67,"tag":104,"props":8329,"children":8330},{"class":106,"line":2540},[8331],{"type":67,"tag":104,"props":8332,"children":8333},{"emptyLinePlaceholder":207},[8334],{"type":72,"value":210},{"type":67,"tag":104,"props":8336,"children":8337},{"class":106,"line":2553},[8338,8342,8346,8350,8354,8358,8362,8366,8370,8374],{"type":67,"tag":104,"props":8339,"children":8340},{"style":121},[8341],{"type":72,"value":219},{"type":67,"tag":104,"props":8343,"children":8344},{"style":222},[8345],{"type":72,"value":1639},{"type":67,"tag":104,"props":8347,"children":8348},{"style":222},[8349],{"type":72,"value":1644},{"type":67,"tag":104,"props":8351,"children":8352},{"style":238},[8353],{"type":72,"value":1649},{"type":67,"tag":104,"props":8355,"children":8356},{"style":127},[8357],{"type":72,"value":245},{"type":67,"tag":104,"props":8359,"children":8360},{"style":1159},[8361],{"type":72,"value":1658},{"type":67,"tag":104,"props":8363,"children":8364},{"style":127},[8365],{"type":72,"value":265},{"type":67,"tag":104,"props":8367,"children":8368},{"style":1665},[8369],{"type":72,"value":1668},{"type":67,"tag":104,"props":8371,"children":8372},{"style":127},[8373],{"type":72,"value":429},{"type":67,"tag":104,"props":8375,"children":8376},{"style":127},[8377],{"type":72,"value":1186},{"type":67,"tag":104,"props":8379,"children":8380},{"class":106,"line":2572},[8381,8385,8389,8393,8397,8401,8405,8409,8413,8417],{"type":67,"tag":104,"props":8382,"children":8383},{"style":222},[8384],{"type":72,"value":1194},{"type":67,"tag":104,"props":8386,"children":8387},{"style":127},[8388],{"type":72,"value":130},{"type":67,"tag":104,"props":8390,"children":8391},{"style":133},[8392],{"type":72,"value":1692},{"type":67,"tag":104,"props":8394,"children":8395},{"style":127},[8396],{"type":72,"value":141},{"type":67,"tag":104,"props":8398,"children":8399},{"style":127},[8400],{"type":72,"value":1204},{"type":67,"tag":104,"props":8402,"children":8403},{"style":121},[8404],{"type":72,"value":1209},{"type":67,"tag":104,"props":8406,"children":8407},{"style":133},[8408],{"type":72,"value":1709},{"type":67,"tag":104,"props":8410,"children":8411},{"style":127},[8412],{"type":72,"value":336},{"type":67,"tag":104,"props":8414,"children":8415},{"style":238},[8416],{"type":72,"value":1718},{"type":67,"tag":104,"props":8418,"children":8419},{"style":257},[8420],{"type":72,"value":1723},{"type":67,"tag":104,"props":8422,"children":8423},{"class":106,"line":2625},[8424,8428,8432,8436,8440,8444],{"type":67,"tag":104,"props":8425,"children":8426},{"style":222},[8427],{"type":72,"value":1194},{"type":67,"tag":104,"props":8429,"children":8430},{"style":133},[8431],{"type":72,"value":1735},{"type":67,"tag":104,"props":8433,"children":8434},{"style":127},[8435],{"type":72,"value":1204},{"type":67,"tag":104,"props":8437,"children":8438},{"style":238},[8439],{"type":72,"value":1480},{"type":67,"tag":104,"props":8441,"children":8442},{"style":257},[8443],{"type":72,"value":245},{"type":67,"tag":104,"props":8445,"children":8446},{"style":127},[8447],{"type":72,"value":250},{"type":67,"tag":104,"props":8449,"children":8450},{"class":106,"line":2671},[8451,8455,8459,8463,8467,8471,8475,8479,8483],{"type":67,"tag":104,"props":8452,"children":8453},{"style":257},[8454],{"type":72,"value":1759},{"type":67,"tag":104,"props":8456,"children":8457},{"style":127},[8458],{"type":72,"value":265},{"type":67,"tag":104,"props":8460,"children":8461},{"style":238},[8462],{"type":72,"value":1525},{"type":67,"tag":104,"props":8464,"children":8465},{"style":257},[8466],{"type":72,"value":245},{"type":67,"tag":104,"props":8468,"children":8469},{"style":127},[8470],{"type":72,"value":279},{"type":67,"tag":104,"props":8472,"children":8473},{"style":154},[8474],{"type":72,"value":1780},{"type":67,"tag":104,"props":8476,"children":8477},{"style":127},[8478],{"type":72,"value":279},{"type":67,"tag":104,"props":8480,"children":8481},{"style":257},[8482],{"type":72,"value":429},{"type":67,"tag":104,"props":8484,"children":8485},{"style":127},[8486],{"type":72,"value":284},{"type":67,"tag":104,"props":8488,"children":8489},{"class":106,"line":2708},[8490,8494],{"type":67,"tag":104,"props":8491,"children":8492},{"style":133},[8493],{"type":72,"value":1800},{"type":67,"tag":104,"props":8495,"children":8496},{"style":127},[8497],{"type":72,"value":284},{"type":67,"tag":104,"props":8499,"children":8500},{"class":106,"line":2759},[8501,8505,8509,8513,8517,8521,8526,8530],{"type":67,"tag":104,"props":8502,"children":8503},{"style":257},[8504],{"type":72,"value":1812},{"type":67,"tag":104,"props":8506,"children":8507},{"style":127},[8508],{"type":72,"value":265},{"type":67,"tag":104,"props":8510,"children":8511},{"style":257},[8512],{"type":72,"value":1821},{"type":67,"tag":104,"props":8514,"children":8515},{"style":133},[8516],{"type":72,"value":1826},{"type":67,"tag":104,"props":8518,"children":8519},{"style":127},[8520],{"type":72,"value":661},{"type":67,"tag":104,"props":8522,"children":8523},{"style":133},[8524],{"type":72,"value":8525}," compareProducts",{"type":67,"tag":104,"props":8527,"children":8528},{"style":257},[8529],{"type":72,"value":1839},{"type":67,"tag":104,"props":8531,"children":8532},{"style":127},[8533],{"type":72,"value":284},{"type":67,"tag":104,"props":8535,"children":8536},{"class":106,"line":2834},[8537],{"type":67,"tag":104,"props":8538,"children":8539},{"style":111},[8540],{"type":72,"value":8541},"    \u002F\u002F maxIterations bounds model turns, not tool calls. For tool budgets,\n",{"type":67,"tag":104,"props":8543,"children":8544},{"class":106,"line":2871},[8545],{"type":67,"tag":104,"props":8546,"children":8547},{"style":111},[8548],{"type":72,"value":8549},"    \u002F\u002F use middleware onBeforeToolCall + onShouldContinue (see agentic-cycle docs).\n",{"type":67,"tag":104,"props":8551,"children":8552},{"class":106,"line":2987},[8553,8558,8562,8567,8571,8576,8580],{"type":67,"tag":104,"props":8554,"children":8555},{"style":257},[8556],{"type":72,"value":8557},"    agentLoopStrategy",{"type":67,"tag":104,"props":8559,"children":8560},{"style":127},[8561],{"type":72,"value":265},{"type":67,"tag":104,"props":8563,"children":8564},{"style":238},[8565],{"type":72,"value":8566}," maxIterations",{"type":67,"tag":104,"props":8568,"children":8569},{"style":257},[8570],{"type":72,"value":245},{"type":67,"tag":104,"props":8572,"children":8573},{"style":1269},[8574],{"type":72,"value":8575},"20",{"type":67,"tag":104,"props":8577,"children":8578},{"style":257},[8579],{"type":72,"value":429},{"type":67,"tag":104,"props":8581,"children":8582},{"style":127},[8583],{"type":72,"value":284},{"type":67,"tag":104,"props":8585,"children":8586},{"class":106,"line":2996},[8587,8591],{"type":67,"tag":104,"props":8588,"children":8589},{"style":127},[8590],{"type":72,"value":534},{"type":67,"tag":104,"props":8592,"children":8593},{"style":257},[8594],{"type":72,"value":771},{"type":67,"tag":104,"props":8596,"children":8597},{"class":106,"line":3005},[8598,8602,8606,8610,8614],{"type":67,"tag":104,"props":8599,"children":8600},{"style":121},[8601],{"type":72,"value":1288},{"type":67,"tag":104,"props":8603,"children":8604},{"style":238},[8605],{"type":72,"value":1489},{"type":67,"tag":104,"props":8607,"children":8608},{"style":257},[8609],{"type":72,"value":245},{"type":67,"tag":104,"props":8611,"children":8612},{"style":133},[8613],{"type":72,"value":1879},{"type":67,"tag":104,"props":8615,"children":8616},{"style":257},[8617],{"type":72,"value":771},{"type":67,"tag":104,"props":8619,"children":8620},{"class":106,"line":3022},[8621],{"type":67,"tag":104,"props":8622,"children":8623},{"style":127},[8624],{"type":72,"value":1891},{"type":67,"tag":75,"props":8626,"children":8627},{},[8628,8630,8635,8636,8641,8643,8649,8651,8656],{"type":72,"value":8629},"The LLM sees ",{"type":67,"tag":100,"props":8631,"children":8633},{"className":8632},[],[8634],{"type":72,"value":1826},{"type":72,"value":5513},{"type":67,"tag":100,"props":8637,"children":8639},{"className":8638},[],[8640],{"type":72,"value":7415},{"type":72,"value":8642}," upfront.\nTo compare, it first calls ",{"type":67,"tag":100,"props":8644,"children":8646},{"className":8645},[],[8647],{"type":72,"value":8648},"__lazy__tool__discovery__({ toolNames: [\"compareProducts\"] })",{"type":72,"value":8650},",\ngets the full schema, then calls ",{"type":67,"tag":100,"props":8652,"children":8654},{"className":8653},[],[8655],{"type":72,"value":7995},{"type":72,"value":8657}," directly.\nOnce discovered, a tool stays available for the conversation.\nWhen all lazy tools are discovered, the discovery tool is removed automatically.",{"type":67,"tag":3095,"props":8659,"children":8661},{"id":8660},"tuning-the-lazy-catalog-with-lazytoolsconfig",[8662,8664],{"type":72,"value":8663},"Tuning the lazy catalog with ",{"type":67,"tag":100,"props":8665,"children":8667},{"className":8666},[],[8668],{"type":72,"value":8669},"lazyToolsConfig",{"type":67,"tag":75,"props":8671,"children":8672},{},[8673,8675,8681,8683,8688,8690,8696],{"type":72,"value":8674},"By default the discovery-tool catalog lists only bare names (",{"type":67,"tag":100,"props":8676,"children":8678},{"className":8677},[],[8679],{"type":72,"value":8680},"'none'",{"type":72,"value":8682},"). Pass\n",{"type":67,"tag":100,"props":8684,"children":8686},{"className":8685},[],[8687],{"type":72,"value":8669},{"type":72,"value":8689}," to ",{"type":67,"tag":100,"props":8691,"children":8693},{"className":8692},[],[8694],{"type":72,"value":8695},"chat()",{"type":72,"value":8697}," to include more context:",{"type":67,"tag":93,"props":8699,"children":8701},{"className":95,"code":8700,"language":15,"meta":97,"style":97},"const stream = chat({\n  adapter: openaiText('gpt-5.5'),\n  messages,\n  tools: [getProducts, compareProducts],\n  agentLoopStrategy: maxIterations(20),\n  lazyToolsConfig: { includeDescription: 'first-sentence' },\n})\n",[8702],{"type":67,"tag":100,"props":8703,"children":8704},{"__ignoreMap":97},[8705,8732,8771,8782,8811,8843,8886],{"type":67,"tag":104,"props":8706,"children":8707},{"class":106,"line":107},[8708,8712,8716,8720,8724,8728],{"type":67,"tag":104,"props":8709,"children":8710},{"style":222},[8711],{"type":72,"value":3221},{"type":67,"tag":104,"props":8713,"children":8714},{"style":133},[8715],{"type":72,"value":3779},{"type":67,"tag":104,"props":8717,"children":8718},{"style":127},[8719],{"type":72,"value":235},{"type":67,"tag":104,"props":8721,"children":8722},{"style":238},[8723],{"type":72,"value":1480},{"type":67,"tag":104,"props":8725,"children":8726},{"style":133},[8727],{"type":72,"value":245},{"type":67,"tag":104,"props":8729,"children":8730},{"style":127},[8731],{"type":72,"value":250},{"type":67,"tag":104,"props":8733,"children":8734},{"class":106,"line":117},[8735,8739,8743,8747,8751,8755,8759,8763,8767],{"type":67,"tag":104,"props":8736,"children":8737},{"style":257},[8738],{"type":72,"value":3803},{"type":67,"tag":104,"props":8740,"children":8741},{"style":127},[8742],{"type":72,"value":265},{"type":67,"tag":104,"props":8744,"children":8745},{"style":238},[8746],{"type":72,"value":1525},{"type":67,"tag":104,"props":8748,"children":8749},{"style":133},[8750],{"type":72,"value":245},{"type":67,"tag":104,"props":8752,"children":8753},{"style":127},[8754],{"type":72,"value":279},{"type":67,"tag":104,"props":8756,"children":8757},{"style":154},[8758],{"type":72,"value":1780},{"type":67,"tag":104,"props":8760,"children":8761},{"style":127},[8762],{"type":72,"value":279},{"type":67,"tag":104,"props":8764,"children":8765},{"style":133},[8766],{"type":72,"value":429},{"type":67,"tag":104,"props":8768,"children":8769},{"style":127},[8770],{"type":72,"value":284},{"type":67,"tag":104,"props":8772,"children":8773},{"class":106,"line":165},[8774,8778],{"type":67,"tag":104,"props":8775,"children":8776},{"style":133},[8777],{"type":72,"value":3843},{"type":67,"tag":104,"props":8779,"children":8780},{"style":127},[8781],{"type":72,"value":284},{"type":67,"tag":104,"props":8783,"children":8784},{"class":106,"line":203},[8785,8789,8793,8798,8802,8807],{"type":67,"tag":104,"props":8786,"children":8787},{"style":257},[8788],{"type":72,"value":3855},{"type":67,"tag":104,"props":8790,"children":8791},{"style":127},[8792],{"type":72,"value":265},{"type":67,"tag":104,"props":8794,"children":8795},{"style":133},[8796],{"type":72,"value":8797}," [getProducts",{"type":67,"tag":104,"props":8799,"children":8800},{"style":127},[8801],{"type":72,"value":661},{"type":67,"tag":104,"props":8803,"children":8804},{"style":133},[8805],{"type":72,"value":8806}," compareProducts]",{"type":67,"tag":104,"props":8808,"children":8809},{"style":127},[8810],{"type":72,"value":284},{"type":67,"tag":104,"props":8812,"children":8813},{"class":106,"line":213},[8814,8819,8823,8827,8831,8835,8839],{"type":67,"tag":104,"props":8815,"children":8816},{"style":257},[8817],{"type":72,"value":8818},"  agentLoopStrategy",{"type":67,"tag":104,"props":8820,"children":8821},{"style":127},[8822],{"type":72,"value":265},{"type":67,"tag":104,"props":8824,"children":8825},{"style":238},[8826],{"type":72,"value":8566},{"type":67,"tag":104,"props":8828,"children":8829},{"style":133},[8830],{"type":72,"value":245},{"type":67,"tag":104,"props":8832,"children":8833},{"style":1269},[8834],{"type":72,"value":8575},{"type":67,"tag":104,"props":8836,"children":8837},{"style":133},[8838],{"type":72,"value":429},{"type":67,"tag":104,"props":8840,"children":8841},{"style":127},[8842],{"type":72,"value":284},{"type":67,"tag":104,"props":8844,"children":8845},{"class":106,"line":253},[8846,8851,8855,8859,8864,8868,8872,8877,8881],{"type":67,"tag":104,"props":8847,"children":8848},{"style":257},[8849],{"type":72,"value":8850},"  lazyToolsConfig",{"type":67,"tag":104,"props":8852,"children":8853},{"style":127},[8854],{"type":72,"value":265},{"type":67,"tag":104,"props":8856,"children":8857},{"style":127},[8858],{"type":72,"value":130},{"type":67,"tag":104,"props":8860,"children":8861},{"style":257},[8862],{"type":72,"value":8863}," includeDescription",{"type":67,"tag":104,"props":8865,"children":8866},{"style":127},[8867],{"type":72,"value":265},{"type":67,"tag":104,"props":8869,"children":8870},{"style":127},[8871],{"type":72,"value":151},{"type":67,"tag":104,"props":8873,"children":8874},{"style":154},[8875],{"type":72,"value":8876},"first-sentence",{"type":67,"tag":104,"props":8878,"children":8879},{"style":127},[8880],{"type":72,"value":279},{"type":67,"tag":104,"props":8882,"children":8883},{"style":127},[8884],{"type":72,"value":8885}," },\n",{"type":67,"tag":104,"props":8887,"children":8888},{"class":106,"line":287},[8889,8893],{"type":67,"tag":104,"props":8890,"children":8891},{"style":127},[8892],{"type":72,"value":721},{"type":67,"tag":104,"props":8894,"children":8895},{"style":133},[8896],{"type":72,"value":771},{"type":67,"tag":75,"props":8898,"children":8899},{},[8900,8906],{"type":67,"tag":100,"props":8901,"children":8903},{"className":8902},[],[8904],{"type":72,"value":8905},"includeDescription",{"type":72,"value":8907}," values:",{"type":67,"tag":8909,"props":8910,"children":8911},"table",{},[8912,8936],{"type":67,"tag":8913,"props":8914,"children":8915},"thead",{},[8916],{"type":67,"tag":8917,"props":8918,"children":8919},"tr",{},[8920,8926,8931],{"type":67,"tag":8921,"props":8922,"children":8923},"th",{},[8924],{"type":72,"value":8925},"Value",{"type":67,"tag":8921,"props":8927,"children":8928},{},[8929],{"type":72,"value":8930},"Catalog entry",{"type":67,"tag":8921,"props":8932,"children":8933},{},[8934],{"type":72,"value":8935},"When to use",{"type":67,"tag":8937,"props":8938,"children":8939},"tbody",{},[8940,8967,8993],{"type":67,"tag":8917,"props":8941,"children":8942},{},[8943,8954,8962],{"type":67,"tag":8944,"props":8945,"children":8946},"td",{},[8947,8952],{"type":67,"tag":100,"props":8948,"children":8950},{"className":8949},[],[8951],{"type":72,"value":8680},{"type":72,"value":8953}," (default)",{"type":67,"tag":8944,"props":8955,"children":8956},{},[8957],{"type":67,"tag":100,"props":8958,"children":8960},{"className":8959},[],[8961],{"type":72,"value":7995},{"type":67,"tag":8944,"props":8963,"children":8964},{},[8965],{"type":72,"value":8966},"Smallest prompt; model discovers by name",{"type":67,"tag":8917,"props":8968,"children":8969},{},[8970,8979,8988],{"type":67,"tag":8944,"props":8971,"children":8972},{},[8973],{"type":67,"tag":100,"props":8974,"children":8976},{"className":8975},[],[8977],{"type":72,"value":8978},"'first-sentence'",{"type":67,"tag":8944,"props":8980,"children":8981},{},[8982],{"type":67,"tag":100,"props":8983,"children":8985},{"className":8984},[],[8986],{"type":72,"value":8987},"compareProducts — Compare two or more products side by side.",{"type":67,"tag":8944,"props":8989,"children":8990},{},[8991],{"type":72,"value":8992},"Helps the model decide whether to discover without extra tokens",{"type":67,"tag":8917,"props":8994,"children":8995},{},[8996,9005,9014],{"type":67,"tag":8944,"props":8997,"children":8998},{},[8999],{"type":67,"tag":100,"props":9000,"children":9002},{"className":9001},[],[9003],{"type":72,"value":9004},"'full'",{"type":67,"tag":8944,"props":9006,"children":9007},{},[9008],{"type":67,"tag":100,"props":9009,"children":9011},{"className":9010},[],[9012],{"type":72,"value":9013},"compareProducts — Compare two or more products side by side. Accepts productIds array.",{"type":67,"tag":8944,"props":9015,"children":9016},{},[9017],{"type":72,"value":9018},"Use when descriptions are short or the model needs full context to route correctly",{"type":67,"tag":75,"props":9020,"children":9021},{},[9022],{"type":72,"value":9023},"The post-discovery payload always returns the full description and schema regardless of this setting.",{"type":67,"tag":81,"props":9025,"children":9027},{"id":9026},"mcp-tools",[9028],{"type":72,"value":9029},"MCP Tools",{"type":67,"tag":75,"props":9031,"children":9032},{},[9033,9039,9041,9046],{"type":67,"tag":100,"props":9034,"children":9036},{"className":9035},[],[9037],{"type":72,"value":9038},"@tanstack\u002Fai-mcp",{"type":72,"value":9040}," lets a server-side ",{"type":67,"tag":100,"props":9042,"children":9044},{"className":9043},[],[9045],{"type":72,"value":8695},{"type":72,"value":9047}," call discover and invoke tools\nhosted on any MCP server (Streamable HTTP, SSE, or stdio).",{"type":67,"tag":75,"props":9049,"children":9050},{},[9051,9057,9059,9065,9067,9073,9075,9081,9083,9089,9091,9096,9098,9103,9105,9111,9113,9119,9120,9126],{"type":67,"tag":9052,"props":9053,"children":9054},"strong",{},[9055],{"type":72,"value":9056},"MCP tools and UI resources:",{"type":72,"value":9058}," When an MCP tool result carries a ",{"type":67,"tag":100,"props":9060,"children":9062},{"className":9061},[],[9063],{"type":72,"value":9064},"ui:\u002F\u002F",{"type":72,"value":9066},"\nresource URI (via ",{"type":67,"tag":100,"props":9068,"children":9070},{"className":9069},[],[9071],{"type":72,"value":9072},"_meta.ui.resourceUri",{"type":72,"value":9074},"), TanStack AI surfaces it as a\n",{"type":67,"tag":100,"props":9076,"children":9078},{"className":9077},[],[9079],{"type":72,"value":9080},"UIResourcePart",{"type":72,"value":9082}," on the assistant ",{"type":67,"tag":100,"props":9084,"children":9086},{"className":9085},[],[9087],{"type":72,"value":9088},"UIMessage",{"type":72,"value":9090}," in the client message list.\n",{"type":67,"tag":100,"props":9092,"children":9094},{"className":9093},[],[9095],{"type":72,"value":9080},{"type":72,"value":9097}," is a presentational-only part — it never enters model input.\nSee the ",{"type":67,"tag":100,"props":9099,"children":9101},{"className":9100},[],[9102],{"type":72,"value":9038},{"type":72,"value":9104}," skill for the full MCP Apps API\n(",{"type":67,"tag":100,"props":9106,"children":9108},{"className":9107},[],[9109],{"type":72,"value":9110},"createMcpAppCallHandler",{"type":72,"value":9112},", ",{"type":67,"tag":100,"props":9114,"children":9116},{"className":9115},[],[9117],{"type":72,"value":9118},"createMcpAppBridge",{"type":72,"value":9112},{"type":67,"tag":100,"props":9121,"children":9123},{"className":9122},[],[9124],{"type":72,"value":9125},"MCPAppResource",{"type":72,"value":9127},").",{"type":67,"tag":3095,"props":9129,"children":9131},{"id":9130},"basic-usage-auto-discovery",[9132],{"type":72,"value":9133},"Basic usage — auto-discovery",{"type":67,"tag":93,"props":9135,"children":9137},{"className":95,"code":9136,"language":15,"meta":97,"style":97},"\u002F\u002F src\u002Froutes\u002Fapi.chat.ts\nimport { createFileRoute } from '@tanstack\u002Freact-router'\nimport { chat, toServerSentEventsResponse } from '@tanstack\u002Fai'\nimport { openaiText } from '@tanstack\u002Fai-openai'\nimport { createMCPClient } from '@tanstack\u002Fai-mcp'\n\nexport const Route = createFileRoute('\u002Fapi\u002Fchat')({\n  server: {\n    handlers: {\n      POST: async ({ request }) => {\n        const { messages } = await request.json()\n\n        \u002F\u002F 1. Connect to the MCP server.\n        const mcp = await createMCPClient({\n          transport: { type: 'http', url: 'https:\u002F\u002Fmcp.example.com\u002Fmcp' },\n        })\n\n        \u002F\u002F 2. Discover all tools from the server (returns ServerTool[]).\n        const mcpTools = await mcp.tools()\n\n        \u002F\u002F 3. Spread them into chat() — they work exactly like hand-written tools.\n        \u002F\u002F Caller owns the lifecycle — chat() never closes the client. Tools run\n        \u002F\u002F while the response streams, so close in a middleware terminal hook\n        \u002F\u002F (a try\u002Ffinally around the return would close before tools execute).\n        const stream = chat({\n          adapter: openaiText('gpt-5.5'),\n          messages,\n          tools: [...mcpTools],\n          middleware: [\n            {\n              name: 'mcp-close',\n              onFinish: () => mcp.close(),\n              onAbort: () => mcp.close(),\n              onError: () => mcp.close(),\n            },\n          ],\n        })\n        return toServerSentEventsResponse(stream)\n      },\n    },\n  },\n})\n",[9138],{"type":67,"tag":100,"props":9139,"children":9140},{"__ignoreMap":97},[9141,9149,9186,9229,9264,9300,9307,9356,9372,9388,9424,9468,9475,9483,9515,9583,9595,9602,9610,9647,9654,9662,9670,9678,9686,9713,9753,9765,9799,9816,9824,9853,9894,9934,9974,9982,9994,10005,10029,10037,10045,10053],{"type":67,"tag":104,"props":9142,"children":9143},{"class":106,"line":107},[9144],{"type":67,"tag":104,"props":9145,"children":9146},{"style":111},[9147],{"type":72,"value":9148},"\u002F\u002F src\u002Froutes\u002Fapi.chat.ts\n",{"type":67,"tag":104,"props":9150,"children":9151},{"class":106,"line":117},[9152,9156,9160,9165,9169,9173,9177,9182],{"type":67,"tag":104,"props":9153,"children":9154},{"style":121},[9155],{"type":72,"value":124},{"type":67,"tag":104,"props":9157,"children":9158},{"style":127},[9159],{"type":72,"value":130},{"type":67,"tag":104,"props":9161,"children":9162},{"style":133},[9163],{"type":72,"value":9164}," createFileRoute",{"type":67,"tag":104,"props":9166,"children":9167},{"style":127},[9168],{"type":72,"value":141},{"type":67,"tag":104,"props":9170,"children":9171},{"style":121},[9172],{"type":72,"value":146},{"type":67,"tag":104,"props":9174,"children":9175},{"style":127},[9176],{"type":72,"value":151},{"type":67,"tag":104,"props":9178,"children":9179},{"style":154},[9180],{"type":72,"value":9181},"@tanstack\u002Freact-router",{"type":67,"tag":104,"props":9183,"children":9184},{"style":127},[9185],{"type":72,"value":162},{"type":67,"tag":104,"props":9187,"children":9188},{"class":106,"line":165},[9189,9193,9197,9201,9205,9209,9213,9217,9221,9225],{"type":67,"tag":104,"props":9190,"children":9191},{"style":121},[9192],{"type":72,"value":124},{"type":67,"tag":104,"props":9194,"children":9195},{"style":127},[9196],{"type":72,"value":130},{"type":67,"tag":104,"props":9198,"children":9199},{"style":133},[9200],{"type":72,"value":1480},{"type":67,"tag":104,"props":9202,"children":9203},{"style":127},[9204],{"type":72,"value":661},{"type":67,"tag":104,"props":9206,"children":9207},{"style":133},[9208],{"type":72,"value":1489},{"type":67,"tag":104,"props":9210,"children":9211},{"style":127},[9212],{"type":72,"value":141},{"type":67,"tag":104,"props":9214,"children":9215},{"style":121},[9216],{"type":72,"value":146},{"type":67,"tag":104,"props":9218,"children":9219},{"style":127},[9220],{"type":72,"value":151},{"type":67,"tag":104,"props":9222,"children":9223},{"style":154},[9224],{"type":72,"value":157},{"type":67,"tag":104,"props":9226,"children":9227},{"style":127},[9228],{"type":72,"value":162},{"type":67,"tag":104,"props":9230,"children":9231},{"class":106,"line":203},[9232,9236,9240,9244,9248,9252,9256,9260],{"type":67,"tag":104,"props":9233,"children":9234},{"style":121},[9235],{"type":72,"value":124},{"type":67,"tag":104,"props":9237,"children":9238},{"style":127},[9239],{"type":72,"value":130},{"type":67,"tag":104,"props":9241,"children":9242},{"style":133},[9243],{"type":72,"value":1525},{"type":67,"tag":104,"props":9245,"children":9246},{"style":127},[9247],{"type":72,"value":141},{"type":67,"tag":104,"props":9249,"children":9250},{"style":121},[9251],{"type":72,"value":146},{"type":67,"tag":104,"props":9253,"children":9254},{"style":127},[9255],{"type":72,"value":151},{"type":67,"tag":104,"props":9257,"children":9258},{"style":154},[9259],{"type":72,"value":1542},{"type":67,"tag":104,"props":9261,"children":9262},{"style":127},[9263],{"type":72,"value":162},{"type":67,"tag":104,"props":9265,"children":9266},{"class":106,"line":213},[9267,9271,9275,9280,9284,9288,9292,9296],{"type":67,"tag":104,"props":9268,"children":9269},{"style":121},[9270],{"type":72,"value":124},{"type":67,"tag":104,"props":9272,"children":9273},{"style":127},[9274],{"type":72,"value":130},{"type":67,"tag":104,"props":9276,"children":9277},{"style":133},[9278],{"type":72,"value":9279}," createMCPClient",{"type":67,"tag":104,"props":9281,"children":9282},{"style":127},[9283],{"type":72,"value":141},{"type":67,"tag":104,"props":9285,"children":9286},{"style":121},[9287],{"type":72,"value":146},{"type":67,"tag":104,"props":9289,"children":9290},{"style":127},[9291],{"type":72,"value":151},{"type":67,"tag":104,"props":9293,"children":9294},{"style":154},[9295],{"type":72,"value":9038},{"type":67,"tag":104,"props":9297,"children":9298},{"style":127},[9299],{"type":72,"value":162},{"type":67,"tag":104,"props":9301,"children":9302},{"class":106,"line":253},[9303],{"type":67,"tag":104,"props":9304,"children":9305},{"emptyLinePlaceholder":207},[9306],{"type":72,"value":210},{"type":67,"tag":104,"props":9308,"children":9309},{"class":106,"line":287},[9310,9314,9318,9323,9327,9331,9335,9339,9343,9347,9352],{"type":67,"tag":104,"props":9311,"children":9312},{"style":121},[9313],{"type":72,"value":219},{"type":67,"tag":104,"props":9315,"children":9316},{"style":222},[9317],{"type":72,"value":225},{"type":67,"tag":104,"props":9319,"children":9320},{"style":133},[9321],{"type":72,"value":9322}," Route ",{"type":67,"tag":104,"props":9324,"children":9325},{"style":127},[9326],{"type":72,"value":235},{"type":67,"tag":104,"props":9328,"children":9329},{"style":238},[9330],{"type":72,"value":9164},{"type":67,"tag":104,"props":9332,"children":9333},{"style":133},[9334],{"type":72,"value":245},{"type":67,"tag":104,"props":9336,"children":9337},{"style":127},[9338],{"type":72,"value":279},{"type":67,"tag":104,"props":9340,"children":9341},{"style":154},[9342],{"type":72,"value":2418},{"type":67,"tag":104,"props":9344,"children":9345},{"style":127},[9346],{"type":72,"value":279},{"type":67,"tag":104,"props":9348,"children":9349},{"style":133},[9350],{"type":72,"value":9351},")(",{"type":67,"tag":104,"props":9353,"children":9354},{"style":127},[9355],{"type":72,"value":250},{"type":67,"tag":104,"props":9357,"children":9358},{"class":106,"line":317},[9359,9364,9368],{"type":67,"tag":104,"props":9360,"children":9361},{"style":257},[9362],{"type":72,"value":9363},"  server",{"type":67,"tag":104,"props":9365,"children":9366},{"style":127},[9367],{"type":72,"value":265},{"type":67,"tag":104,"props":9369,"children":9370},{"style":127},[9371],{"type":72,"value":1186},{"type":67,"tag":104,"props":9373,"children":9374},{"class":106,"line":352},[9375,9380,9384],{"type":67,"tag":104,"props":9376,"children":9377},{"style":257},[9378],{"type":72,"value":9379},"    handlers",{"type":67,"tag":104,"props":9381,"children":9382},{"style":127},[9383],{"type":72,"value":265},{"type":67,"tag":104,"props":9385,"children":9386},{"style":127},[9387],{"type":72,"value":1186},{"type":67,"tag":104,"props":9389,"children":9390},{"class":106,"line":436},[9391,9396,9400,9404,9408,9412,9416,9420],{"type":67,"tag":104,"props":9392,"children":9393},{"style":238},[9394],{"type":72,"value":9395},"      POST",{"type":67,"tag":104,"props":9397,"children":9398},{"style":127},[9399],{"type":72,"value":265},{"type":67,"tag":104,"props":9401,"children":9402},{"style":222},[9403],{"type":72,"value":1639},{"type":67,"tag":104,"props":9405,"children":9406},{"style":127},[9407],{"type":72,"value":1156},{"type":67,"tag":104,"props":9409,"children":9410},{"style":1159},[9411],{"type":72,"value":1709},{"type":67,"tag":104,"props":9413,"children":9414},{"style":127},[9415],{"type":72,"value":1176},{"type":67,"tag":104,"props":9417,"children":9418},{"style":222},[9419],{"type":72,"value":1181},{"type":67,"tag":104,"props":9421,"children":9422},{"style":127},[9423],{"type":72,"value":1186},{"type":67,"tag":104,"props":9425,"children":9426},{"class":106,"line":528},[9427,9432,9436,9440,9444,9448,9452,9456,9460,9464],{"type":67,"tag":104,"props":9428,"children":9429},{"style":222},[9430],{"type":72,"value":9431},"        const",{"type":67,"tag":104,"props":9433,"children":9434},{"style":127},[9435],{"type":72,"value":130},{"type":67,"tag":104,"props":9437,"children":9438},{"style":133},[9439],{"type":72,"value":1692},{"type":67,"tag":104,"props":9441,"children":9442},{"style":127},[9443],{"type":72,"value":141},{"type":67,"tag":104,"props":9445,"children":9446},{"style":127},[9447],{"type":72,"value":1204},{"type":67,"tag":104,"props":9449,"children":9450},{"style":121},[9451],{"type":72,"value":1209},{"type":67,"tag":104,"props":9453,"children":9454},{"style":133},[9455],{"type":72,"value":1709},{"type":67,"tag":104,"props":9457,"children":9458},{"style":127},[9459],{"type":72,"value":336},{"type":67,"tag":104,"props":9461,"children":9462},{"style":238},[9463],{"type":72,"value":1718},{"type":67,"tag":104,"props":9465,"children":9466},{"style":257},[9467],{"type":72,"value":1723},{"type":67,"tag":104,"props":9469,"children":9470},{"class":106,"line":545},[9471],{"type":67,"tag":104,"props":9472,"children":9473},{"emptyLinePlaceholder":207},[9474],{"type":72,"value":210},{"type":67,"tag":104,"props":9476,"children":9477},{"class":106,"line":578},[9478],{"type":67,"tag":104,"props":9479,"children":9480},{"style":111},[9481],{"type":72,"value":9482},"        \u002F\u002F 1. Connect to the MCP server.\n",{"type":67,"tag":104,"props":9484,"children":9485},{"class":106,"line":609},[9486,9490,9495,9499,9503,9507,9511],{"type":67,"tag":104,"props":9487,"children":9488},{"style":222},[9489],{"type":72,"value":9431},{"type":67,"tag":104,"props":9491,"children":9492},{"style":133},[9493],{"type":72,"value":9494}," mcp",{"type":67,"tag":104,"props":9496,"children":9497},{"style":127},[9498],{"type":72,"value":1204},{"type":67,"tag":104,"props":9500,"children":9501},{"style":121},[9502],{"type":72,"value":1209},{"type":67,"tag":104,"props":9504,"children":9505},{"style":238},[9506],{"type":72,"value":9279},{"type":67,"tag":104,"props":9508,"children":9509},{"style":257},[9510],{"type":72,"value":245},{"type":67,"tag":104,"props":9512,"children":9513},{"style":127},[9514],{"type":72,"value":250},{"type":67,"tag":104,"props":9516,"children":9517},{"class":106,"line":732},[9518,9523,9527,9531,9536,9540,9544,9549,9553,9557,9562,9566,9570,9575,9579],{"type":67,"tag":104,"props":9519,"children":9520},{"style":257},[9521],{"type":72,"value":9522},"          transport",{"type":67,"tag":104,"props":9524,"children":9525},{"style":127},[9526],{"type":72,"value":265},{"type":67,"tag":104,"props":9528,"children":9529},{"style":127},[9530],{"type":72,"value":130},{"type":67,"tag":104,"props":9532,"children":9533},{"style":257},[9534],{"type":72,"value":9535}," type",{"type":67,"tag":104,"props":9537,"children":9538},{"style":127},[9539],{"type":72,"value":265},{"type":67,"tag":104,"props":9541,"children":9542},{"style":127},[9543],{"type":72,"value":151},{"type":67,"tag":104,"props":9545,"children":9546},{"style":154},[9547],{"type":72,"value":9548},"http",{"type":67,"tag":104,"props":9550,"children":9551},{"style":127},[9552],{"type":72,"value":279},{"type":67,"tag":104,"props":9554,"children":9555},{"style":127},[9556],{"type":72,"value":661},{"type":67,"tag":104,"props":9558,"children":9559},{"style":257},[9560],{"type":72,"value":9561}," url",{"type":67,"tag":104,"props":9563,"children":9564},{"style":127},[9565],{"type":72,"value":265},{"type":67,"tag":104,"props":9567,"children":9568},{"style":127},[9569],{"type":72,"value":151},{"type":67,"tag":104,"props":9571,"children":9572},{"style":154},[9573],{"type":72,"value":9574},"https:\u002F\u002Fmcp.example.com\u002Fmcp",{"type":67,"tag":104,"props":9576,"children":9577},{"style":127},[9578],{"type":72,"value":279},{"type":67,"tag":104,"props":9580,"children":9581},{"style":127},[9582],{"type":72,"value":8885},{"type":67,"tag":104,"props":9584,"children":9585},{"class":106,"line":745},[9586,9591],{"type":67,"tag":104,"props":9587,"children":9588},{"style":127},[9589],{"type":72,"value":9590},"        }",{"type":67,"tag":104,"props":9592,"children":9593},{"style":257},[9594],{"type":72,"value":771},{"type":67,"tag":104,"props":9596,"children":9597},{"class":106,"line":761},[9598],{"type":67,"tag":104,"props":9599,"children":9600},{"emptyLinePlaceholder":207},[9601],{"type":72,"value":210},{"type":67,"tag":104,"props":9603,"children":9604},{"class":106,"line":774},[9605],{"type":67,"tag":104,"props":9606,"children":9607},{"style":111},[9608],{"type":72,"value":9609},"        \u002F\u002F 2. Discover all tools from the server (returns ServerTool[]).\n",{"type":67,"tag":104,"props":9611,"children":9612},{"class":106,"line":782},[9613,9617,9622,9626,9630,9634,9638,9643],{"type":67,"tag":104,"props":9614,"children":9615},{"style":222},[9616],{"type":72,"value":9431},{"type":67,"tag":104,"props":9618,"children":9619},{"style":133},[9620],{"type":72,"value":9621}," mcpTools",{"type":67,"tag":104,"props":9623,"children":9624},{"style":127},[9625],{"type":72,"value":1204},{"type":67,"tag":104,"props":9627,"children":9628},{"style":121},[9629],{"type":72,"value":1209},{"type":67,"tag":104,"props":9631,"children":9632},{"style":133},[9633],{"type":72,"value":9494},{"type":67,"tag":104,"props":9635,"children":9636},{"style":127},[9637],{"type":72,"value":336},{"type":67,"tag":104,"props":9639,"children":9640},{"style":238},[9641],{"type":72,"value":9642},"tools",{"type":67,"tag":104,"props":9644,"children":9645},{"style":257},[9646],{"type":72,"value":1723},{"type":67,"tag":104,"props":9648,"children":9649},{"class":106,"line":815},[9650],{"type":67,"tag":104,"props":9651,"children":9652},{"emptyLinePlaceholder":207},[9653],{"type":72,"value":210},{"type":67,"tag":104,"props":9655,"children":9656},{"class":106,"line":844},[9657],{"type":67,"tag":104,"props":9658,"children":9659},{"style":111},[9660],{"type":72,"value":9661},"        \u002F\u002F 3. Spread them into chat() — they work exactly like hand-written tools.\n",{"type":67,"tag":104,"props":9663,"children":9664},{"class":106,"line":873},[9665],{"type":67,"tag":104,"props":9666,"children":9667},{"style":111},[9668],{"type":72,"value":9669},"        \u002F\u002F Caller owns the lifecycle — chat() never closes the client. Tools run\n",{"type":67,"tag":104,"props":9671,"children":9672},{"class":106,"line":971},[9673],{"type":67,"tag":104,"props":9674,"children":9675},{"style":111},[9676],{"type":72,"value":9677},"        \u002F\u002F while the response streams, so close in a middleware terminal hook\n",{"type":67,"tag":104,"props":9679,"children":9680},{"class":106,"line":1041},[9681],{"type":67,"tag":104,"props":9682,"children":9683},{"style":111},[9684],{"type":72,"value":9685},"        \u002F\u002F (a try\u002Ffinally around the return would close before tools execute).\n",{"type":67,"tag":104,"props":9687,"children":9688},{"class":106,"line":2459},[9689,9693,9697,9701,9705,9709],{"type":67,"tag":104,"props":9690,"children":9691},{"style":222},[9692],{"type":72,"value":9431},{"type":67,"tag":104,"props":9694,"children":9695},{"style":133},[9696],{"type":72,"value":1735},{"type":67,"tag":104,"props":9698,"children":9699},{"style":127},[9700],{"type":72,"value":1204},{"type":67,"tag":104,"props":9702,"children":9703},{"style":238},[9704],{"type":72,"value":1480},{"type":67,"tag":104,"props":9706,"children":9707},{"style":257},[9708],{"type":72,"value":245},{"type":67,"tag":104,"props":9710,"children":9711},{"style":127},[9712],{"type":72,"value":250},{"type":67,"tag":104,"props":9714,"children":9715},{"class":106,"line":2514},[9716,9721,9725,9729,9733,9737,9741,9745,9749],{"type":67,"tag":104,"props":9717,"children":9718},{"style":257},[9719],{"type":72,"value":9720},"          adapter",{"type":67,"tag":104,"props":9722,"children":9723},{"style":127},[9724],{"type":72,"value":265},{"type":67,"tag":104,"props":9726,"children":9727},{"style":238},[9728],{"type":72,"value":1525},{"type":67,"tag":104,"props":9730,"children":9731},{"style":257},[9732],{"type":72,"value":245},{"type":67,"tag":104,"props":9734,"children":9735},{"style":127},[9736],{"type":72,"value":279},{"type":67,"tag":104,"props":9738,"children":9739},{"style":154},[9740],{"type":72,"value":1780},{"type":67,"tag":104,"props":9742,"children":9743},{"style":127},[9744],{"type":72,"value":279},{"type":67,"tag":104,"props":9746,"children":9747},{"style":257},[9748],{"type":72,"value":429},{"type":67,"tag":104,"props":9750,"children":9751},{"style":127},[9752],{"type":72,"value":284},{"type":67,"tag":104,"props":9754,"children":9755},{"class":106,"line":2523},[9756,9761],{"type":67,"tag":104,"props":9757,"children":9758},{"style":133},[9759],{"type":72,"value":9760},"          messages",{"type":67,"tag":104,"props":9762,"children":9763},{"style":127},[9764],{"type":72,"value":284},{"type":67,"tag":104,"props":9766,"children":9767},{"class":106,"line":2532},[9768,9773,9777,9781,9786,9791,9795],{"type":67,"tag":104,"props":9769,"children":9770},{"style":257},[9771],{"type":72,"value":9772},"          tools",{"type":67,"tag":104,"props":9774,"children":9775},{"style":127},[9776],{"type":72,"value":265},{"type":67,"tag":104,"props":9778,"children":9779},{"style":257},[9780],{"type":72,"value":1821},{"type":67,"tag":104,"props":9782,"children":9783},{"style":127},[9784],{"type":72,"value":9785},"...",{"type":67,"tag":104,"props":9787,"children":9788},{"style":133},[9789],{"type":72,"value":9790},"mcpTools",{"type":67,"tag":104,"props":9792,"children":9793},{"style":257},[9794],{"type":72,"value":1839},{"type":67,"tag":104,"props":9796,"children":9797},{"style":127},[9798],{"type":72,"value":284},{"type":67,"tag":104,"props":9800,"children":9801},{"class":106,"line":2540},[9802,9807,9811],{"type":67,"tag":104,"props":9803,"children":9804},{"style":257},[9805],{"type":72,"value":9806},"          middleware",{"type":67,"tag":104,"props":9808,"children":9809},{"style":127},[9810],{"type":72,"value":265},{"type":67,"tag":104,"props":9812,"children":9813},{"style":257},[9814],{"type":72,"value":9815}," [\n",{"type":67,"tag":104,"props":9817,"children":9818},{"class":106,"line":2553},[9819],{"type":67,"tag":104,"props":9820,"children":9821},{"style":127},[9822],{"type":72,"value":9823},"            {\n",{"type":67,"tag":104,"props":9825,"children":9826},{"class":106,"line":2572},[9827,9832,9836,9840,9845,9849],{"type":67,"tag":104,"props":9828,"children":9829},{"style":257},[9830],{"type":72,"value":9831},"              name",{"type":67,"tag":104,"props":9833,"children":9834},{"style":127},[9835],{"type":72,"value":265},{"type":67,"tag":104,"props":9837,"children":9838},{"style":127},[9839],{"type":72,"value":151},{"type":67,"tag":104,"props":9841,"children":9842},{"style":154},[9843],{"type":72,"value":9844},"mcp-close",{"type":67,"tag":104,"props":9846,"children":9847},{"style":127},[9848],{"type":72,"value":279},{"type":67,"tag":104,"props":9850,"children":9851},{"style":127},[9852],{"type":72,"value":284},{"type":67,"tag":104,"props":9854,"children":9855},{"class":106,"line":2625},[9856,9861,9865,9869,9873,9877,9881,9886,9890],{"type":67,"tag":104,"props":9857,"children":9858},{"style":238},[9859],{"type":72,"value":9860},"              onFinish",{"type":67,"tag":104,"props":9862,"children":9863},{"style":127},[9864],{"type":72,"value":265},{"type":67,"tag":104,"props":9866,"children":9867},{"style":127},[9868],{"type":72,"value":7910},{"type":67,"tag":104,"props":9870,"children":9871},{"style":222},[9872],{"type":72,"value":1181},{"type":67,"tag":104,"props":9874,"children":9875},{"style":133},[9876],{"type":72,"value":9494},{"type":67,"tag":104,"props":9878,"children":9879},{"style":127},[9880],{"type":72,"value":336},{"type":67,"tag":104,"props":9882,"children":9883},{"style":238},[9884],{"type":72,"value":9885},"close",{"type":67,"tag":104,"props":9887,"children":9888},{"style":257},[9889],{"type":72,"value":380},{"type":67,"tag":104,"props":9891,"children":9892},{"style":127},[9893],{"type":72,"value":284},{"type":67,"tag":104,"props":9895,"children":9896},{"class":106,"line":2671},[9897,9902,9906,9910,9914,9918,9922,9926,9930],{"type":67,"tag":104,"props":9898,"children":9899},{"style":238},[9900],{"type":72,"value":9901},"              onAbort",{"type":67,"tag":104,"props":9903,"children":9904},{"style":127},[9905],{"type":72,"value":265},{"type":67,"tag":104,"props":9907,"children":9908},{"style":127},[9909],{"type":72,"value":7910},{"type":67,"tag":104,"props":9911,"children":9912},{"style":222},[9913],{"type":72,"value":1181},{"type":67,"tag":104,"props":9915,"children":9916},{"style":133},[9917],{"type":72,"value":9494},{"type":67,"tag":104,"props":9919,"children":9920},{"style":127},[9921],{"type":72,"value":336},{"type":67,"tag":104,"props":9923,"children":9924},{"style":238},[9925],{"type":72,"value":9885},{"type":67,"tag":104,"props":9927,"children":9928},{"style":257},[9929],{"type":72,"value":380},{"type":67,"tag":104,"props":9931,"children":9932},{"style":127},[9933],{"type":72,"value":284},{"type":67,"tag":104,"props":9935,"children":9936},{"class":106,"line":2708},[9937,9942,9946,9950,9954,9958,9962,9966,9970],{"type":67,"tag":104,"props":9938,"children":9939},{"style":238},[9940],{"type":72,"value":9941},"              onError",{"type":67,"tag":104,"props":9943,"children":9944},{"style":127},[9945],{"type":72,"value":265},{"type":67,"tag":104,"props":9947,"children":9948},{"style":127},[9949],{"type":72,"value":7910},{"type":67,"tag":104,"props":9951,"children":9952},{"style":222},[9953],{"type":72,"value":1181},{"type":67,"tag":104,"props":9955,"children":9956},{"style":133},[9957],{"type":72,"value":9494},{"type":67,"tag":104,"props":9959,"children":9960},{"style":127},[9961],{"type":72,"value":336},{"type":67,"tag":104,"props":9963,"children":9964},{"style":238},[9965],{"type":72,"value":9885},{"type":67,"tag":104,"props":9967,"children":9968},{"style":257},[9969],{"type":72,"value":380},{"type":67,"tag":104,"props":9971,"children":9972},{"style":127},[9973],{"type":72,"value":284},{"type":67,"tag":104,"props":9975,"children":9976},{"class":106,"line":2759},[9977],{"type":67,"tag":104,"props":9978,"children":9979},{"style":127},[9980],{"type":72,"value":9981},"            },\n",{"type":67,"tag":104,"props":9983,"children":9984},{"class":106,"line":2834},[9985,9990],{"type":67,"tag":104,"props":9986,"children":9987},{"style":257},[9988],{"type":72,"value":9989},"          ]",{"type":67,"tag":104,"props":9991,"children":9992},{"style":127},[9993],{"type":72,"value":284},{"type":67,"tag":104,"props":9995,"children":9996},{"class":106,"line":2871},[9997,10001],{"type":67,"tag":104,"props":9998,"children":9999},{"style":127},[10000],{"type":72,"value":9590},{"type":67,"tag":104,"props":10002,"children":10003},{"style":257},[10004],{"type":72,"value":771},{"type":67,"tag":104,"props":10006,"children":10007},{"class":106,"line":2987},[10008,10013,10017,10021,10025],{"type":67,"tag":104,"props":10009,"children":10010},{"style":121},[10011],{"type":72,"value":10012},"        return",{"type":67,"tag":104,"props":10014,"children":10015},{"style":238},[10016],{"type":72,"value":1489},{"type":67,"tag":104,"props":10018,"children":10019},{"style":257},[10020],{"type":72,"value":245},{"type":67,"tag":104,"props":10022,"children":10023},{"style":133},[10024],{"type":72,"value":1879},{"type":67,"tag":104,"props":10026,"children":10027},{"style":257},[10028],{"type":72,"value":771},{"type":67,"tag":104,"props":10030,"children":10031},{"class":106,"line":2996},[10032],{"type":67,"tag":104,"props":10033,"children":10034},{"style":127},[10035],{"type":72,"value":10036},"      },\n",{"type":67,"tag":104,"props":10038,"children":10039},{"class":106,"line":3005},[10040],{"type":67,"tag":104,"props":10041,"children":10042},{"style":127},[10043],{"type":72,"value":10044},"    },\n",{"type":67,"tag":104,"props":10046,"children":10047},{"class":106,"line":3022},[10048],{"type":67,"tag":104,"props":10049,"children":10050},{"style":127},[10051],{"type":72,"value":10052},"  },\n",{"type":67,"tag":104,"props":10054,"children":10055},{"class":106,"line":3039},[10056,10060],{"type":67,"tag":104,"props":10057,"children":10058},{"style":127},[10059],{"type":72,"value":721},{"type":67,"tag":104,"props":10061,"children":10062},{"style":133},[10063],{"type":72,"value":771},{"type":67,"tag":3095,"props":10065,"children":10067},{"id":10066},"typed-path-pass-tooldefinition-instances",[10068],{"type":72,"value":10069},"Typed path — pass toolDefinition instances",{"type":67,"tag":75,"props":10071,"children":10072},{},[10073,10075,10080,10082,10087,10088,10094,10096,10102],{"type":72,"value":10074},"Pass bare ",{"type":67,"tag":100,"props":10076,"children":10078},{"className":10077},[],[10079],{"type":72,"value":3111},{"type":72,"value":10081}," instances (no ",{"type":67,"tag":100,"props":10083,"children":10085},{"className":10084},[],[10086],{"type":72,"value":3119},{"type":72,"value":3897},{"type":67,"tag":100,"props":10089,"children":10091},{"className":10090},[],[10092],{"type":72,"value":10093},"client.tools([...])",{"type":72,"value":10095},".\nThe MCP client supplies a ",{"type":67,"tag":100,"props":10097,"children":10099},{"className":10098},[],[10100],{"type":72,"value":10101},"callTool",{"type":72,"value":10103}," proxy as the execute function, while\ninput\u002Foutput validation and types come from the definitions' Zod schemas.",{"type":67,"tag":93,"props":10105,"children":10107},{"className":95,"code":10106,"language":15,"meta":97,"style":97},"import { toolDefinition } from '@tanstack\u002Fai'\nimport { createMCPClient } from '@tanstack\u002Fai-mcp'\nimport { z } from 'zod'\n\nconst getWeather = toolDefinition({\n  name: 'get_weather',\n  description: 'Current weather for a city',\n  inputSchema: z.object({ city: z.string() }),\n  outputSchema: z.object({ temperature: z.number(), conditions: z.string() }),\n})\n\nconst mcp = await createMCPClient({\n  transport: { type: 'http', url: 'https:\u002F\u002Fmcp.example.com\u002Fmcp' },\n})\n\n\u002F\u002F Returns ServerTool[] typed to the definitions' input\u002Foutput schemas.\n\u002F\u002F Throws MCPToolNotFoundError if the server does not expose a tool with that name.\nconst tools = await mcp.tools([getWeather])\n\nconst stream = chat({ adapter: openaiText('gpt-5.5'), messages, tools })\n",[10108],{"type":67,"tag":100,"props":10109,"children":10110},{"__ignoreMap":97},[10111,10146,10181,10216,10223,10251,10279,10307,10375,10472,10483,10490,10522,10586,10597,10604,10612,10620,10657,10664],{"type":67,"tag":104,"props":10112,"children":10113},{"class":106,"line":107},[10114,10118,10122,10126,10130,10134,10138,10142],{"type":67,"tag":104,"props":10115,"children":10116},{"style":121},[10117],{"type":72,"value":124},{"type":67,"tag":104,"props":10119,"children":10120},{"style":127},[10121],{"type":72,"value":130},{"type":67,"tag":104,"props":10123,"children":10124},{"style":133},[10125],{"type":72,"value":136},{"type":67,"tag":104,"props":10127,"children":10128},{"style":127},[10129],{"type":72,"value":141},{"type":67,"tag":104,"props":10131,"children":10132},{"style":121},[10133],{"type":72,"value":146},{"type":67,"tag":104,"props":10135,"children":10136},{"style":127},[10137],{"type":72,"value":151},{"type":67,"tag":104,"props":10139,"children":10140},{"style":154},[10141],{"type":72,"value":157},{"type":67,"tag":104,"props":10143,"children":10144},{"style":127},[10145],{"type":72,"value":162},{"type":67,"tag":104,"props":10147,"children":10148},{"class":106,"line":117},[10149,10153,10157,10161,10165,10169,10173,10177],{"type":67,"tag":104,"props":10150,"children":10151},{"style":121},[10152],{"type":72,"value":124},{"type":67,"tag":104,"props":10154,"children":10155},{"style":127},[10156],{"type":72,"value":130},{"type":67,"tag":104,"props":10158,"children":10159},{"style":133},[10160],{"type":72,"value":9279},{"type":67,"tag":104,"props":10162,"children":10163},{"style":127},[10164],{"type":72,"value":141},{"type":67,"tag":104,"props":10166,"children":10167},{"style":121},[10168],{"type":72,"value":146},{"type":67,"tag":104,"props":10170,"children":10171},{"style":127},[10172],{"type":72,"value":151},{"type":67,"tag":104,"props":10174,"children":10175},{"style":154},[10176],{"type":72,"value":9038},{"type":67,"tag":104,"props":10178,"children":10179},{"style":127},[10180],{"type":72,"value":162},{"type":67,"tag":104,"props":10182,"children":10183},{"class":106,"line":165},[10184,10188,10192,10196,10200,10204,10208,10212],{"type":67,"tag":104,"props":10185,"children":10186},{"style":121},[10187],{"type":72,"value":124},{"type":67,"tag":104,"props":10189,"children":10190},{"style":127},[10191],{"type":72,"value":130},{"type":67,"tag":104,"props":10193,"children":10194},{"style":133},[10195],{"type":72,"value":179},{"type":67,"tag":104,"props":10197,"children":10198},{"style":127},[10199],{"type":72,"value":141},{"type":67,"tag":104,"props":10201,"children":10202},{"style":121},[10203],{"type":72,"value":146},{"type":67,"tag":104,"props":10205,"children":10206},{"style":127},[10207],{"type":72,"value":151},{"type":67,"tag":104,"props":10209,"children":10210},{"style":154},[10211],{"type":72,"value":196},{"type":67,"tag":104,"props":10213,"children":10214},{"style":127},[10215],{"type":72,"value":162},{"type":67,"tag":104,"props":10217,"children":10218},{"class":106,"line":203},[10219],{"type":67,"tag":104,"props":10220,"children":10221},{"emptyLinePlaceholder":207},[10222],{"type":72,"value":210},{"type":67,"tag":104,"props":10224,"children":10225},{"class":106,"line":213},[10226,10230,10235,10239,10243,10247],{"type":67,"tag":104,"props":10227,"children":10228},{"style":222},[10229],{"type":72,"value":3221},{"type":67,"tag":104,"props":10231,"children":10232},{"style":133},[10233],{"type":72,"value":10234}," getWeather ",{"type":67,"tag":104,"props":10236,"children":10237},{"style":127},[10238],{"type":72,"value":235},{"type":67,"tag":104,"props":10240,"children":10241},{"style":238},[10242],{"type":72,"value":136},{"type":67,"tag":104,"props":10244,"children":10245},{"style":133},[10246],{"type":72,"value":245},{"type":67,"tag":104,"props":10248,"children":10249},{"style":127},[10250],{"type":72,"value":250},{"type":67,"tag":104,"props":10252,"children":10253},{"class":106,"line":253},[10254,10258,10262,10266,10271,10275],{"type":67,"tag":104,"props":10255,"children":10256},{"style":257},[10257],{"type":72,"value":260},{"type":67,"tag":104,"props":10259,"children":10260},{"style":127},[10261],{"type":72,"value":265},{"type":67,"tag":104,"props":10263,"children":10264},{"style":127},[10265],{"type":72,"value":151},{"type":67,"tag":104,"props":10267,"children":10268},{"style":154},[10269],{"type":72,"value":10270},"get_weather",{"type":67,"tag":104,"props":10272,"children":10273},{"style":127},[10274],{"type":72,"value":279},{"type":67,"tag":104,"props":10276,"children":10277},{"style":127},[10278],{"type":72,"value":284},{"type":67,"tag":104,"props":10280,"children":10281},{"class":106,"line":287},[10282,10286,10290,10294,10299,10303],{"type":67,"tag":104,"props":10283,"children":10284},{"style":257},[10285],{"type":72,"value":293},{"type":67,"tag":104,"props":10287,"children":10288},{"style":127},[10289],{"type":72,"value":265},{"type":67,"tag":104,"props":10291,"children":10292},{"style":127},[10293],{"type":72,"value":151},{"type":67,"tag":104,"props":10295,"children":10296},{"style":154},[10297],{"type":72,"value":10298},"Current weather for a city",{"type":67,"tag":104,"props":10300,"children":10301},{"style":127},[10302],{"type":72,"value":279},{"type":67,"tag":104,"props":10304,"children":10305},{"style":127},[10306],{"type":72,"value":284},{"type":67,"tag":104,"props":10308,"children":10309},{"class":106,"line":317},[10310,10314,10318,10322,10326,10330,10334,10338,10343,10347,10351,10355,10359,10363,10367,10371],{"type":67,"tag":104,"props":10311,"children":10312},{"style":257},[10313],{"type":72,"value":323},{"type":67,"tag":104,"props":10315,"children":10316},{"style":127},[10317],{"type":72,"value":265},{"type":67,"tag":104,"props":10319,"children":10320},{"style":133},[10321],{"type":72,"value":179},{"type":67,"tag":104,"props":10323,"children":10324},{"style":127},[10325],{"type":72,"value":336},{"type":67,"tag":104,"props":10327,"children":10328},{"style":238},[10329],{"type":72,"value":341},{"type":67,"tag":104,"props":10331,"children":10332},{"style":133},[10333],{"type":72,"value":245},{"type":67,"tag":104,"props":10335,"children":10336},{"style":127},[10337],{"type":72,"value":398},{"type":67,"tag":104,"props":10339,"children":10340},{"style":257},[10341],{"type":72,"value":10342}," city",{"type":67,"tag":104,"props":10344,"children":10345},{"style":127},[10346],{"type":72,"value":265},{"type":67,"tag":104,"props":10348,"children":10349},{"style":133},[10350],{"type":72,"value":179},{"type":67,"tag":104,"props":10352,"children":10353},{"style":127},[10354],{"type":72,"value":336},{"type":67,"tag":104,"props":10356,"children":10357},{"style":238},[10358],{"type":72,"value":375},{"type":67,"tag":104,"props":10360,"children":10361},{"style":133},[10362],{"type":72,"value":716},{"type":67,"tag":104,"props":10364,"children":10365},{"style":127},[10366],{"type":72,"value":721},{"type":67,"tag":104,"props":10368,"children":10369},{"style":133},[10370],{"type":72,"value":429},{"type":67,"tag":104,"props":10372,"children":10373},{"style":127},[10374],{"type":72,"value":284},{"type":67,"tag":104,"props":10376,"children":10377},{"class":106,"line":352},[10378,10382,10386,10390,10394,10398,10402,10406,10411,10415,10419,10423,10427,10431,10435,10440,10444,10448,10452,10456,10460,10464,10468],{"type":67,"tag":104,"props":10379,"children":10380},{"style":257},[10381],{"type":72,"value":551},{"type":67,"tag":104,"props":10383,"children":10384},{"style":127},[10385],{"type":72,"value":265},{"type":67,"tag":104,"props":10387,"children":10388},{"style":133},[10389],{"type":72,"value":179},{"type":67,"tag":104,"props":10391,"children":10392},{"style":127},[10393],{"type":72,"value":336},{"type":67,"tag":104,"props":10395,"children":10396},{"style":238},[10397],{"type":72,"value":341},{"type":67,"tag":104,"props":10399,"children":10400},{"style":133},[10401],{"type":72,"value":245},{"type":67,"tag":104,"props":10403,"children":10404},{"style":127},[10405],{"type":72,"value":398},{"type":67,"tag":104,"props":10407,"children":10408},{"style":257},[10409],{"type":72,"value":10410}," temperature",{"type":67,"tag":104,"props":10412,"children":10413},{"style":127},[10414],{"type":72,"value":265},{"type":67,"tag":104,"props":10416,"children":10417},{"style":133},[10418],{"type":72,"value":179},{"type":67,"tag":104,"props":10420,"children":10421},{"style":127},[10422],{"type":72,"value":336},{"type":67,"tag":104,"props":10424,"children":10425},{"style":238},[10426],{"type":72,"value":459},{"type":67,"tag":104,"props":10428,"children":10429},{"style":133},[10430],{"type":72,"value":380},{"type":67,"tag":104,"props":10432,"children":10433},{"style":127},[10434],{"type":72,"value":661},{"type":67,"tag":104,"props":10436,"children":10437},{"style":257},[10438],{"type":72,"value":10439}," conditions",{"type":67,"tag":104,"props":10441,"children":10442},{"style":127},[10443],{"type":72,"value":265},{"type":67,"tag":104,"props":10445,"children":10446},{"style":133},[10447],{"type":72,"value":179},{"type":67,"tag":104,"props":10449,"children":10450},{"style":127},[10451],{"type":72,"value":336},{"type":67,"tag":104,"props":10453,"children":10454},{"style":238},[10455],{"type":72,"value":375},{"type":67,"tag":104,"props":10457,"children":10458},{"style":133},[10459],{"type":72,"value":716},{"type":67,"tag":104,"props":10461,"children":10462},{"style":127},[10463],{"type":72,"value":721},{"type":67,"tag":104,"props":10465,"children":10466},{"style":133},[10467],{"type":72,"value":429},{"type":67,"tag":104,"props":10469,"children":10470},{"style":127},[10471],{"type":72,"value":284},{"type":67,"tag":104,"props":10473,"children":10474},{"class":106,"line":436},[10475,10479],{"type":67,"tag":104,"props":10476,"children":10477},{"style":127},[10478],{"type":72,"value":721},{"type":67,"tag":104,"props":10480,"children":10481},{"style":133},[10482],{"type":72,"value":771},{"type":67,"tag":104,"props":10484,"children":10485},{"class":106,"line":528},[10486],{"type":67,"tag":104,"props":10487,"children":10488},{"emptyLinePlaceholder":207},[10489],{"type":72,"value":210},{"type":67,"tag":104,"props":10491,"children":10492},{"class":106,"line":545},[10493,10497,10502,10506,10510,10514,10518],{"type":67,"tag":104,"props":10494,"children":10495},{"style":222},[10496],{"type":72,"value":3221},{"type":67,"tag":104,"props":10498,"children":10499},{"style":133},[10500],{"type":72,"value":10501}," mcp ",{"type":67,"tag":104,"props":10503,"children":10504},{"style":127},[10505],{"type":72,"value":235},{"type":67,"tag":104,"props":10507,"children":10508},{"style":121},[10509],{"type":72,"value":1209},{"type":67,"tag":104,"props":10511,"children":10512},{"style":238},[10513],{"type":72,"value":9279},{"type":67,"tag":104,"props":10515,"children":10516},{"style":133},[10517],{"type":72,"value":245},{"type":67,"tag":104,"props":10519,"children":10520},{"style":127},[10521],{"type":72,"value":250},{"type":67,"tag":104,"props":10523,"children":10524},{"class":106,"line":578},[10525,10530,10534,10538,10542,10546,10550,10554,10558,10562,10566,10570,10574,10578,10582],{"type":67,"tag":104,"props":10526,"children":10527},{"style":257},[10528],{"type":72,"value":10529},"  transport",{"type":67,"tag":104,"props":10531,"children":10532},{"style":127},[10533],{"type":72,"value":265},{"type":67,"tag":104,"props":10535,"children":10536},{"style":127},[10537],{"type":72,"value":130},{"type":67,"tag":104,"props":10539,"children":10540},{"style":257},[10541],{"type":72,"value":9535},{"type":67,"tag":104,"props":10543,"children":10544},{"style":127},[10545],{"type":72,"value":265},{"type":67,"tag":104,"props":10547,"children":10548},{"style":127},[10549],{"type":72,"value":151},{"type":67,"tag":104,"props":10551,"children":10552},{"style":154},[10553],{"type":72,"value":9548},{"type":67,"tag":104,"props":10555,"children":10556},{"style":127},[10557],{"type":72,"value":279},{"type":67,"tag":104,"props":10559,"children":10560},{"style":127},[10561],{"type":72,"value":661},{"type":67,"tag":104,"props":10563,"children":10564},{"style":257},[10565],{"type":72,"value":9561},{"type":67,"tag":104,"props":10567,"children":10568},{"style":127},[10569],{"type":72,"value":265},{"type":67,"tag":104,"props":10571,"children":10572},{"style":127},[10573],{"type":72,"value":151},{"type":67,"tag":104,"props":10575,"children":10576},{"style":154},[10577],{"type":72,"value":9574},{"type":67,"tag":104,"props":10579,"children":10580},{"style":127},[10581],{"type":72,"value":279},{"type":67,"tag":104,"props":10583,"children":10584},{"style":127},[10585],{"type":72,"value":8885},{"type":67,"tag":104,"props":10587,"children":10588},{"class":106,"line":609},[10589,10593],{"type":67,"tag":104,"props":10590,"children":10591},{"style":127},[10592],{"type":72,"value":721},{"type":67,"tag":104,"props":10594,"children":10595},{"style":133},[10596],{"type":72,"value":771},{"type":67,"tag":104,"props":10598,"children":10599},{"class":106,"line":732},[10600],{"type":67,"tag":104,"props":10601,"children":10602},{"emptyLinePlaceholder":207},[10603],{"type":72,"value":210},{"type":67,"tag":104,"props":10605,"children":10606},{"class":106,"line":745},[10607],{"type":67,"tag":104,"props":10608,"children":10609},{"style":111},[10610],{"type":72,"value":10611},"\u002F\u002F Returns ServerTool[] typed to the definitions' input\u002Foutput schemas.\n",{"type":67,"tag":104,"props":10613,"children":10614},{"class":106,"line":761},[10615],{"type":67,"tag":104,"props":10616,"children":10617},{"style":111},[10618],{"type":72,"value":10619},"\u002F\u002F Throws MCPToolNotFoundError if the server does not expose a tool with that name.\n",{"type":67,"tag":104,"props":10621,"children":10622},{"class":106,"line":774},[10623,10627,10632,10636,10640,10644,10648,10652],{"type":67,"tag":104,"props":10624,"children":10625},{"style":222},[10626],{"type":72,"value":3221},{"type":67,"tag":104,"props":10628,"children":10629},{"style":133},[10630],{"type":72,"value":10631}," tools ",{"type":67,"tag":104,"props":10633,"children":10634},{"style":127},[10635],{"type":72,"value":235},{"type":67,"tag":104,"props":10637,"children":10638},{"style":121},[10639],{"type":72,"value":1209},{"type":67,"tag":104,"props":10641,"children":10642},{"style":133},[10643],{"type":72,"value":9494},{"type":67,"tag":104,"props":10645,"children":10646},{"style":127},[10647],{"type":72,"value":336},{"type":67,"tag":104,"props":10649,"children":10650},{"style":238},[10651],{"type":72,"value":9642},{"type":67,"tag":104,"props":10653,"children":10654},{"style":133},[10655],{"type":72,"value":10656},"([getWeather])\n",{"type":67,"tag":104,"props":10658,"children":10659},{"class":106,"line":782},[10660],{"type":67,"tag":104,"props":10661,"children":10662},{"emptyLinePlaceholder":207},[10663],{"type":72,"value":210},{"type":67,"tag":104,"props":10665,"children":10666},{"class":106,"line":815},[10667,10671,10675,10679,10683,10687,10691,10696,10700,10704,10708,10712,10716,10720,10724,10728,10732,10736,10740,10744],{"type":67,"tag":104,"props":10668,"children":10669},{"style":222},[10670],{"type":72,"value":3221},{"type":67,"tag":104,"props":10672,"children":10673},{"style":133},[10674],{"type":72,"value":3779},{"type":67,"tag":104,"props":10676,"children":10677},{"style":127},[10678],{"type":72,"value":235},{"type":67,"tag":104,"props":10680,"children":10681},{"style":238},[10682],{"type":72,"value":1480},{"type":67,"tag":104,"props":10684,"children":10685},{"style":133},[10686],{"type":72,"value":245},{"type":67,"tag":104,"props":10688,"children":10689},{"style":127},[10690],{"type":72,"value":398},{"type":67,"tag":104,"props":10692,"children":10693},{"style":257},[10694],{"type":72,"value":10695}," adapter",{"type":67,"tag":104,"props":10697,"children":10698},{"style":127},[10699],{"type":72,"value":265},{"type":67,"tag":104,"props":10701,"children":10702},{"style":238},[10703],{"type":72,"value":1525},{"type":67,"tag":104,"props":10705,"children":10706},{"style":133},[10707],{"type":72,"value":245},{"type":67,"tag":104,"props":10709,"children":10710},{"style":127},[10711],{"type":72,"value":279},{"type":67,"tag":104,"props":10713,"children":10714},{"style":154},[10715],{"type":72,"value":1780},{"type":67,"tag":104,"props":10717,"children":10718},{"style":127},[10719],{"type":72,"value":279},{"type":67,"tag":104,"props":10721,"children":10722},{"style":133},[10723],{"type":72,"value":429},{"type":67,"tag":104,"props":10725,"children":10726},{"style":127},[10727],{"type":72,"value":661},{"type":67,"tag":104,"props":10729,"children":10730},{"style":133},[10731],{"type":72,"value":1692},{"type":67,"tag":104,"props":10733,"children":10734},{"style":127},[10735],{"type":72,"value":661},{"type":67,"tag":104,"props":10737,"children":10738},{"style":133},[10739],{"type":72,"value":10631},{"type":67,"tag":104,"props":10741,"children":10742},{"style":127},[10743],{"type":72,"value":721},{"type":67,"tag":104,"props":10745,"children":10746},{"style":133},[10747],{"type":72,"value":771},{"type":67,"tag":3095,"props":10749,"children":10751},{"id":10750},"multiple-servers-with-createmcpclients",[10752,10754],{"type":72,"value":10753},"Multiple servers with ",{"type":67,"tag":100,"props":10755,"children":10757},{"className":10756},[],[10758],{"type":72,"value":10759},"createMCPClients",{"type":67,"tag":93,"props":10761,"children":10763},{"className":95,"code":10762,"language":15,"meta":97,"style":97},"import { createMCPClients } from '@tanstack\u002Fai-mcp'\n\n\u002F\u002F Each key becomes the default prefix for that server's tools.\nawait using pool = await createMCPClients({\n  github: { transport: { type: 'http', url: 'https:\u002F\u002Fmcp.github.com\u002Fmcp' } },\n  linear: { transport: { type: 'http', url: 'https:\u002F\u002Fmcp.linear.app\u002Fmcp' } },\n})\n\n\u002F\u002F Tools auto-prefixed: 'github_search_repos', 'linear_create_issue', etc.\nconst tools = await pool.tools()\n\nconst stream = chat({ adapter: openaiText('gpt-5.5'), messages, tools })\n",[10764],{"type":67,"tag":100,"props":10765,"children":10766},{"__ignoreMap":97},[10767,10803,10810,10818,10851,10933,11014,11025,11032,11040,11076,11083],{"type":67,"tag":104,"props":10768,"children":10769},{"class":106,"line":107},[10770,10774,10778,10783,10787,10791,10795,10799],{"type":67,"tag":104,"props":10771,"children":10772},{"style":121},[10773],{"type":72,"value":124},{"type":67,"tag":104,"props":10775,"children":10776},{"style":127},[10777],{"type":72,"value":130},{"type":67,"tag":104,"props":10779,"children":10780},{"style":133},[10781],{"type":72,"value":10782}," createMCPClients",{"type":67,"tag":104,"props":10784,"children":10785},{"style":127},[10786],{"type":72,"value":141},{"type":67,"tag":104,"props":10788,"children":10789},{"style":121},[10790],{"type":72,"value":146},{"type":67,"tag":104,"props":10792,"children":10793},{"style":127},[10794],{"type":72,"value":151},{"type":67,"tag":104,"props":10796,"children":10797},{"style":154},[10798],{"type":72,"value":9038},{"type":67,"tag":104,"props":10800,"children":10801},{"style":127},[10802],{"type":72,"value":162},{"type":67,"tag":104,"props":10804,"children":10805},{"class":106,"line":117},[10806],{"type":67,"tag":104,"props":10807,"children":10808},{"emptyLinePlaceholder":207},[10809],{"type":72,"value":210},{"type":67,"tag":104,"props":10811,"children":10812},{"class":106,"line":165},[10813],{"type":67,"tag":104,"props":10814,"children":10815},{"style":111},[10816],{"type":72,"value":10817},"\u002F\u002F Each key becomes the default prefix for that server's tools.\n",{"type":67,"tag":104,"props":10819,"children":10820},{"class":106,"line":203},[10821,10826,10831,10835,10839,10843,10847],{"type":67,"tag":104,"props":10822,"children":10823},{"style":222},[10824],{"type":72,"value":10825},"await using",{"type":67,"tag":104,"props":10827,"children":10828},{"style":133},[10829],{"type":72,"value":10830}," pool ",{"type":67,"tag":104,"props":10832,"children":10833},{"style":127},[10834],{"type":72,"value":235},{"type":67,"tag":104,"props":10836,"children":10837},{"style":121},[10838],{"type":72,"value":1209},{"type":67,"tag":104,"props":10840,"children":10841},{"style":238},[10842],{"type":72,"value":10782},{"type":67,"tag":104,"props":10844,"children":10845},{"style":133},[10846],{"type":72,"value":245},{"type":67,"tag":104,"props":10848,"children":10849},{"style":127},[10850],{"type":72,"value":250},{"type":67,"tag":104,"props":10852,"children":10853},{"class":106,"line":213},[10854,10859,10863,10867,10872,10876,10880,10884,10888,10892,10896,10900,10904,10908,10912,10916,10921,10925,10929],{"type":67,"tag":104,"props":10855,"children":10856},{"style":257},[10857],{"type":72,"value":10858},"  github",{"type":67,"tag":104,"props":10860,"children":10861},{"style":127},[10862],{"type":72,"value":265},{"type":67,"tag":104,"props":10864,"children":10865},{"style":127},[10866],{"type":72,"value":130},{"type":67,"tag":104,"props":10868,"children":10869},{"style":257},[10870],{"type":72,"value":10871}," transport",{"type":67,"tag":104,"props":10873,"children":10874},{"style":127},[10875],{"type":72,"value":265},{"type":67,"tag":104,"props":10877,"children":10878},{"style":127},[10879],{"type":72,"value":130},{"type":67,"tag":104,"props":10881,"children":10882},{"style":257},[10883],{"type":72,"value":9535},{"type":67,"tag":104,"props":10885,"children":10886},{"style":127},[10887],{"type":72,"value":265},{"type":67,"tag":104,"props":10889,"children":10890},{"style":127},[10891],{"type":72,"value":151},{"type":67,"tag":104,"props":10893,"children":10894},{"style":154},[10895],{"type":72,"value":9548},{"type":67,"tag":104,"props":10897,"children":10898},{"style":127},[10899],{"type":72,"value":279},{"type":67,"tag":104,"props":10901,"children":10902},{"style":127},[10903],{"type":72,"value":661},{"type":67,"tag":104,"props":10905,"children":10906},{"style":257},[10907],{"type":72,"value":9561},{"type":67,"tag":104,"props":10909,"children":10910},{"style":127},[10911],{"type":72,"value":265},{"type":67,"tag":104,"props":10913,"children":10914},{"style":127},[10915],{"type":72,"value":151},{"type":67,"tag":104,"props":10917,"children":10918},{"style":154},[10919],{"type":72,"value":10920},"https:\u002F\u002Fmcp.github.com\u002Fmcp",{"type":67,"tag":104,"props":10922,"children":10923},{"style":127},[10924],{"type":72,"value":279},{"type":67,"tag":104,"props":10926,"children":10927},{"style":127},[10928],{"type":72,"value":141},{"type":67,"tag":104,"props":10930,"children":10931},{"style":127},[10932],{"type":72,"value":8885},{"type":67,"tag":104,"props":10934,"children":10935},{"class":106,"line":253},[10936,10941,10945,10949,10953,10957,10961,10965,10969,10973,10977,10981,10985,10989,10993,10997,11002,11006,11010],{"type":67,"tag":104,"props":10937,"children":10938},{"style":257},[10939],{"type":72,"value":10940},"  linear",{"type":67,"tag":104,"props":10942,"children":10943},{"style":127},[10944],{"type":72,"value":265},{"type":67,"tag":104,"props":10946,"children":10947},{"style":127},[10948],{"type":72,"value":130},{"type":67,"tag":104,"props":10950,"children":10951},{"style":257},[10952],{"type":72,"value":10871},{"type":67,"tag":104,"props":10954,"children":10955},{"style":127},[10956],{"type":72,"value":265},{"type":67,"tag":104,"props":10958,"children":10959},{"style":127},[10960],{"type":72,"value":130},{"type":67,"tag":104,"props":10962,"children":10963},{"style":257},[10964],{"type":72,"value":9535},{"type":67,"tag":104,"props":10966,"children":10967},{"style":127},[10968],{"type":72,"value":265},{"type":67,"tag":104,"props":10970,"children":10971},{"style":127},[10972],{"type":72,"value":151},{"type":67,"tag":104,"props":10974,"children":10975},{"style":154},[10976],{"type":72,"value":9548},{"type":67,"tag":104,"props":10978,"children":10979},{"style":127},[10980],{"type":72,"value":279},{"type":67,"tag":104,"props":10982,"children":10983},{"style":127},[10984],{"type":72,"value":661},{"type":67,"tag":104,"props":10986,"children":10987},{"style":257},[10988],{"type":72,"value":9561},{"type":67,"tag":104,"props":10990,"children":10991},{"style":127},[10992],{"type":72,"value":265},{"type":67,"tag":104,"props":10994,"children":10995},{"style":127},[10996],{"type":72,"value":151},{"type":67,"tag":104,"props":10998,"children":10999},{"style":154},[11000],{"type":72,"value":11001},"https:\u002F\u002Fmcp.linear.app\u002Fmcp",{"type":67,"tag":104,"props":11003,"children":11004},{"style":127},[11005],{"type":72,"value":279},{"type":67,"tag":104,"props":11007,"children":11008},{"style":127},[11009],{"type":72,"value":141},{"type":67,"tag":104,"props":11011,"children":11012},{"style":127},[11013],{"type":72,"value":8885},{"type":67,"tag":104,"props":11015,"children":11016},{"class":106,"line":287},[11017,11021],{"type":67,"tag":104,"props":11018,"children":11019},{"style":127},[11020],{"type":72,"value":721},{"type":67,"tag":104,"props":11022,"children":11023},{"style":133},[11024],{"type":72,"value":771},{"type":67,"tag":104,"props":11026,"children":11027},{"class":106,"line":317},[11028],{"type":67,"tag":104,"props":11029,"children":11030},{"emptyLinePlaceholder":207},[11031],{"type":72,"value":210},{"type":67,"tag":104,"props":11033,"children":11034},{"class":106,"line":352},[11035],{"type":67,"tag":104,"props":11036,"children":11037},{"style":111},[11038],{"type":72,"value":11039},"\u002F\u002F Tools auto-prefixed: 'github_search_repos', 'linear_create_issue', etc.\n",{"type":67,"tag":104,"props":11041,"children":11042},{"class":106,"line":436},[11043,11047,11051,11055,11059,11064,11068,11072],{"type":67,"tag":104,"props":11044,"children":11045},{"style":222},[11046],{"type":72,"value":3221},{"type":67,"tag":104,"props":11048,"children":11049},{"style":133},[11050],{"type":72,"value":10631},{"type":67,"tag":104,"props":11052,"children":11053},{"style":127},[11054],{"type":72,"value":235},{"type":67,"tag":104,"props":11056,"children":11057},{"style":121},[11058],{"type":72,"value":1209},{"type":67,"tag":104,"props":11060,"children":11061},{"style":133},[11062],{"type":72,"value":11063}," pool",{"type":67,"tag":104,"props":11065,"children":11066},{"style":127},[11067],{"type":72,"value":336},{"type":67,"tag":104,"props":11069,"children":11070},{"style":238},[11071],{"type":72,"value":9642},{"type":67,"tag":104,"props":11073,"children":11074},{"style":133},[11075],{"type":72,"value":1723},{"type":67,"tag":104,"props":11077,"children":11078},{"class":106,"line":528},[11079],{"type":67,"tag":104,"props":11080,"children":11081},{"emptyLinePlaceholder":207},[11082],{"type":72,"value":210},{"type":67,"tag":104,"props":11084,"children":11085},{"class":106,"line":545},[11086,11090,11094,11098,11102,11106,11110,11114,11118,11122,11126,11130,11134,11138,11142,11146,11150,11154,11158,11162],{"type":67,"tag":104,"props":11087,"children":11088},{"style":222},[11089],{"type":72,"value":3221},{"type":67,"tag":104,"props":11091,"children":11092},{"style":133},[11093],{"type":72,"value":3779},{"type":67,"tag":104,"props":11095,"children":11096},{"style":127},[11097],{"type":72,"value":235},{"type":67,"tag":104,"props":11099,"children":11100},{"style":238},[11101],{"type":72,"value":1480},{"type":67,"tag":104,"props":11103,"children":11104},{"style":133},[11105],{"type":72,"value":245},{"type":67,"tag":104,"props":11107,"children":11108},{"style":127},[11109],{"type":72,"value":398},{"type":67,"tag":104,"props":11111,"children":11112},{"style":257},[11113],{"type":72,"value":10695},{"type":67,"tag":104,"props":11115,"children":11116},{"style":127},[11117],{"type":72,"value":265},{"type":67,"tag":104,"props":11119,"children":11120},{"style":238},[11121],{"type":72,"value":1525},{"type":67,"tag":104,"props":11123,"children":11124},{"style":133},[11125],{"type":72,"value":245},{"type":67,"tag":104,"props":11127,"children":11128},{"style":127},[11129],{"type":72,"value":279},{"type":67,"tag":104,"props":11131,"children":11132},{"style":154},[11133],{"type":72,"value":1780},{"type":67,"tag":104,"props":11135,"children":11136},{"style":127},[11137],{"type":72,"value":279},{"type":67,"tag":104,"props":11139,"children":11140},{"style":133},[11141],{"type":72,"value":429},{"type":67,"tag":104,"props":11143,"children":11144},{"style":127},[11145],{"type":72,"value":661},{"type":67,"tag":104,"props":11147,"children":11148},{"style":133},[11149],{"type":72,"value":1692},{"type":67,"tag":104,"props":11151,"children":11152},{"style":127},[11153],{"type":72,"value":661},{"type":67,"tag":104,"props":11155,"children":11156},{"style":133},[11157],{"type":72,"value":10631},{"type":67,"tag":104,"props":11159,"children":11160},{"style":127},[11161],{"type":72,"value":721},{"type":67,"tag":104,"props":11163,"children":11164},{"style":133},[11165],{"type":72,"value":771},{"type":67,"tag":75,"props":11167,"children":11168},{},[11169,11171,11177,11179,11185],{"type":72,"value":11170},"Use ",{"type":67,"tag":100,"props":11172,"children":11174},{"className":11173},[],[11175],{"type":72,"value":11176},"pool.clients.\u003Cname>",{"type":72,"value":11178}," for typed per-server access (resources, prompts, typed\n",{"type":67,"tag":100,"props":11180,"children":11182},{"className":11181},[],[11183],{"type":72,"value":11184},"tools([defs])",{"type":72,"value":11186}," overload).",{"type":67,"tag":3095,"props":11188,"children":11190},{"id":11189},"toolexecutioncontextabortsignal-cancelling-long-running-tools",[11191,11197],{"type":67,"tag":100,"props":11192,"children":11194},{"className":11193},[],[11195],{"type":72,"value":11196},"ToolExecutionContext.abortSignal",{"type":72,"value":11198}," — cancelling long-running tools",{"type":67,"tag":75,"props":11200,"children":11201},{},[11202,11204,11210,11212,11218,11220,11225],{"type":72,"value":11203},"Every server tool's execute function now receives ",{"type":67,"tag":100,"props":11205,"children":11207},{"className":11206},[],[11208],{"type":72,"value":11209},"abortSignal",{"type":72,"value":11211}," in its context.\nWhen the chat run aborts (e.g. the client disconnects or calls the run's\n",{"type":67,"tag":100,"props":11213,"children":11215},{"className":11214},[],[11216],{"type":72,"value":11217},"abortController",{"type":72,"value":11219},"), the signal fires and any in-flight ",{"type":67,"tag":100,"props":11221,"children":11223},{"className":11222},[],[11224],{"type":72,"value":10101},{"type":72,"value":11226}," call is\ncancelled automatically.",{"type":67,"tag":75,"props":11228,"children":11229},{},[11230],{"type":72,"value":11231},"You can also forward it from your own server tools:",{"type":67,"tag":93,"props":11233,"children":11235},{"className":95,"code":11234,"language":15,"meta":97,"style":97},"const longRunningTool = myToolDef.server(async (args, ctx) => {\n  \u002F\u002F Forward to fetch, a DB query, or an MCP callTool call.\n  const response = await fetch('https:\u002F\u002Fslow.api\u002Fdata', {\n    signal: ctx?.abortSignal,\n  })\n  return response.json()\n})\n",[11236],{"type":67,"tag":100,"props":11237,"children":11238},{"__ignoreMap":97},[11239,11306,11314,11364,11393,11404,11427],{"type":67,"tag":104,"props":11240,"children":11241},{"class":106,"line":107},[11242,11246,11251,11255,11260,11264,11268,11272,11276,11280,11285,11289,11294,11298,11302],{"type":67,"tag":104,"props":11243,"children":11244},{"style":222},[11245],{"type":72,"value":3221},{"type":67,"tag":104,"props":11247,"children":11248},{"style":133},[11249],{"type":72,"value":11250}," longRunningTool ",{"type":67,"tag":104,"props":11252,"children":11253},{"style":127},[11254],{"type":72,"value":235},{"type":67,"tag":104,"props":11256,"children":11257},{"style":133},[11258],{"type":72,"value":11259}," myToolDef",{"type":67,"tag":104,"props":11261,"children":11262},{"style":127},[11263],{"type":72,"value":336},{"type":67,"tag":104,"props":11265,"children":11266},{"style":238},[11267],{"type":72,"value":1142},{"type":67,"tag":104,"props":11269,"children":11270},{"style":133},[11271],{"type":72,"value":245},{"type":67,"tag":104,"props":11273,"children":11274},{"style":222},[11275],{"type":72,"value":1151},{"type":67,"tag":104,"props":11277,"children":11278},{"style":127},[11279],{"type":72,"value":1341},{"type":67,"tag":104,"props":11281,"children":11282},{"style":1159},[11283],{"type":72,"value":11284},"args",{"type":67,"tag":104,"props":11286,"children":11287},{"style":127},[11288],{"type":72,"value":661},{"type":67,"tag":104,"props":11290,"children":11291},{"style":1159},[11292],{"type":72,"value":11293}," ctx",{"type":67,"tag":104,"props":11295,"children":11296},{"style":127},[11297],{"type":72,"value":429},{"type":67,"tag":104,"props":11299,"children":11300},{"style":222},[11301],{"type":72,"value":1181},{"type":67,"tag":104,"props":11303,"children":11304},{"style":127},[11305],{"type":72,"value":1186},{"type":67,"tag":104,"props":11307,"children":11308},{"class":106,"line":117},[11309],{"type":67,"tag":104,"props":11310,"children":11311},{"style":111},[11312],{"type":72,"value":11313},"  \u002F\u002F Forward to fetch, a DB query, or an MCP callTool call.\n",{"type":67,"tag":104,"props":11315,"children":11316},{"class":106,"line":165},[11317,11321,11326,11330,11334,11339,11343,11347,11352,11356,11360],{"type":67,"tag":104,"props":11318,"children":11319},{"style":222},[11320],{"type":72,"value":1194},{"type":67,"tag":104,"props":11322,"children":11323},{"style":133},[11324],{"type":72,"value":11325}," response",{"type":67,"tag":104,"props":11327,"children":11328},{"style":127},[11329],{"type":72,"value":1204},{"type":67,"tag":104,"props":11331,"children":11332},{"style":121},[11333],{"type":72,"value":1209},{"type":67,"tag":104,"props":11335,"children":11336},{"style":238},[11337],{"type":72,"value":11338}," fetch",{"type":67,"tag":104,"props":11340,"children":11341},{"style":257},[11342],{"type":72,"value":245},{"type":67,"tag":104,"props":11344,"children":11345},{"style":127},[11346],{"type":72,"value":279},{"type":67,"tag":104,"props":11348,"children":11349},{"style":154},[11350],{"type":72,"value":11351},"https:\u002F\u002Fslow.api\u002Fdata",{"type":67,"tag":104,"props":11353,"children":11354},{"style":127},[11355],{"type":72,"value":279},{"type":67,"tag":104,"props":11357,"children":11358},{"style":127},[11359],{"type":72,"value":661},{"type":67,"tag":104,"props":11361,"children":11362},{"style":127},[11363],{"type":72,"value":1186},{"type":67,"tag":104,"props":11365,"children":11366},{"class":106,"line":203},[11367,11372,11376,11380,11385,11389],{"type":67,"tag":104,"props":11368,"children":11369},{"style":257},[11370],{"type":72,"value":11371},"    signal",{"type":67,"tag":104,"props":11373,"children":11374},{"style":127},[11375],{"type":72,"value":265},{"type":67,"tag":104,"props":11377,"children":11378},{"style":133},[11379],{"type":72,"value":11293},{"type":67,"tag":104,"props":11381,"children":11382},{"style":127},[11383],{"type":72,"value":11384},"?.",{"type":67,"tag":104,"props":11386,"children":11387},{"style":133},[11388],{"type":72,"value":11209},{"type":67,"tag":104,"props":11390,"children":11391},{"style":127},[11392],{"type":72,"value":284},{"type":67,"tag":104,"props":11394,"children":11395},{"class":106,"line":213},[11396,11400],{"type":67,"tag":104,"props":11397,"children":11398},{"style":127},[11399],{"type":72,"value":534},{"type":67,"tag":104,"props":11401,"children":11402},{"style":257},[11403],{"type":72,"value":771},{"type":67,"tag":104,"props":11405,"children":11406},{"class":106,"line":253},[11407,11411,11415,11419,11423],{"type":67,"tag":104,"props":11408,"children":11409},{"style":121},[11410],{"type":72,"value":1288},{"type":67,"tag":104,"props":11412,"children":11413},{"style":133},[11414],{"type":72,"value":11325},{"type":67,"tag":104,"props":11416,"children":11417},{"style":127},[11418],{"type":72,"value":336},{"type":67,"tag":104,"props":11420,"children":11421},{"style":238},[11422],{"type":72,"value":1718},{"type":67,"tag":104,"props":11424,"children":11425},{"style":257},[11426],{"type":72,"value":1723},{"type":67,"tag":104,"props":11428,"children":11429},{"class":106,"line":287},[11430,11434],{"type":67,"tag":104,"props":11431,"children":11432},{"style":127},[11433],{"type":72,"value":721},{"type":67,"tag":104,"props":11435,"children":11436},{"style":133},[11437],{"type":72,"value":771},{"type":67,"tag":75,"props":11439,"children":11440},{},[11441,11443,11449,11451,11457,11459,11465,11467,11473],{"type":72,"value":11442},"MCP tools wire this automatically — ",{"type":67,"tag":100,"props":11444,"children":11446},{"className":11445},[],[11447],{"type":72,"value":11448},"makeMcpExecute",{"type":72,"value":11450}," passes ",{"type":67,"tag":100,"props":11452,"children":11454},{"className":11453},[],[11455],{"type":72,"value":11456},"ctx?.abortSignal",{"type":72,"value":11458},"\nas the ",{"type":67,"tag":100,"props":11460,"children":11462},{"className":11461},[],[11463],{"type":72,"value":11464},"signal",{"type":72,"value":11466}," option to ",{"type":67,"tag":100,"props":11468,"children":11470},{"className":11469},[],[11471],{"type":72,"value":11472},"client.callTool(...)",{"type":72,"value":11474},", so MCP server calls cancel\nwith the chat run without any extra code.",{"type":67,"tag":3095,"props":11476,"children":11478},{"id":11477},"stdio-transport-node-only",[11479],{"type":72,"value":11480},"stdio transport (Node-only)",{"type":67,"tag":93,"props":11482,"children":11484},{"className":95,"code":11483,"language":15,"meta":97,"style":97},"import { createMCPClient } from '@tanstack\u002Fai-mcp'\nimport { stdioTransport } from '@tanstack\u002Fai-mcp\u002Fstdio'\n\nconst mcp = await createMCPClient({\n  transport: stdioTransport({ command: 'npx', args: ['-y', 'my-mcp-server'] }),\n})\n",[11485],{"type":67,"tag":100,"props":11486,"children":11487},{"__ignoreMap":97},[11488,11523,11560,11567,11598,11707],{"type":67,"tag":104,"props":11489,"children":11490},{"class":106,"line":107},[11491,11495,11499,11503,11507,11511,11515,11519],{"type":67,"tag":104,"props":11492,"children":11493},{"style":121},[11494],{"type":72,"value":124},{"type":67,"tag":104,"props":11496,"children":11497},{"style":127},[11498],{"type":72,"value":130},{"type":67,"tag":104,"props":11500,"children":11501},{"style":133},[11502],{"type":72,"value":9279},{"type":67,"tag":104,"props":11504,"children":11505},{"style":127},[11506],{"type":72,"value":141},{"type":67,"tag":104,"props":11508,"children":11509},{"style":121},[11510],{"type":72,"value":146},{"type":67,"tag":104,"props":11512,"children":11513},{"style":127},[11514],{"type":72,"value":151},{"type":67,"tag":104,"props":11516,"children":11517},{"style":154},[11518],{"type":72,"value":9038},{"type":67,"tag":104,"props":11520,"children":11521},{"style":127},[11522],{"type":72,"value":162},{"type":67,"tag":104,"props":11524,"children":11525},{"class":106,"line":117},[11526,11530,11534,11539,11543,11547,11551,11556],{"type":67,"tag":104,"props":11527,"children":11528},{"style":121},[11529],{"type":72,"value":124},{"type":67,"tag":104,"props":11531,"children":11532},{"style":127},[11533],{"type":72,"value":130},{"type":67,"tag":104,"props":11535,"children":11536},{"style":133},[11537],{"type":72,"value":11538}," stdioTransport",{"type":67,"tag":104,"props":11540,"children":11541},{"style":127},[11542],{"type":72,"value":141},{"type":67,"tag":104,"props":11544,"children":11545},{"style":121},[11546],{"type":72,"value":146},{"type":67,"tag":104,"props":11548,"children":11549},{"style":127},[11550],{"type":72,"value":151},{"type":67,"tag":104,"props":11552,"children":11553},{"style":154},[11554],{"type":72,"value":11555},"@tanstack\u002Fai-mcp\u002Fstdio",{"type":67,"tag":104,"props":11557,"children":11558},{"style":127},[11559],{"type":72,"value":162},{"type":67,"tag":104,"props":11561,"children":11562},{"class":106,"line":165},[11563],{"type":67,"tag":104,"props":11564,"children":11565},{"emptyLinePlaceholder":207},[11566],{"type":72,"value":210},{"type":67,"tag":104,"props":11568,"children":11569},{"class":106,"line":203},[11570,11574,11578,11582,11586,11590,11594],{"type":67,"tag":104,"props":11571,"children":11572},{"style":222},[11573],{"type":72,"value":3221},{"type":67,"tag":104,"props":11575,"children":11576},{"style":133},[11577],{"type":72,"value":10501},{"type":67,"tag":104,"props":11579,"children":11580},{"style":127},[11581],{"type":72,"value":235},{"type":67,"tag":104,"props":11583,"children":11584},{"style":121},[11585],{"type":72,"value":1209},{"type":67,"tag":104,"props":11587,"children":11588},{"style":238},[11589],{"type":72,"value":9279},{"type":67,"tag":104,"props":11591,"children":11592},{"style":133},[11593],{"type":72,"value":245},{"type":67,"tag":104,"props":11595,"children":11596},{"style":127},[11597],{"type":72,"value":250},{"type":67,"tag":104,"props":11599,"children":11600},{"class":106,"line":213},[11601,11605,11609,11613,11617,11621,11626,11630,11634,11639,11643,11647,11652,11656,11660,11664,11669,11673,11677,11681,11686,11690,11695,11699,11703],{"type":67,"tag":104,"props":11602,"children":11603},{"style":257},[11604],{"type":72,"value":10529},{"type":67,"tag":104,"props":11606,"children":11607},{"style":127},[11608],{"type":72,"value":265},{"type":67,"tag":104,"props":11610,"children":11611},{"style":238},[11612],{"type":72,"value":11538},{"type":67,"tag":104,"props":11614,"children":11615},{"style":133},[11616],{"type":72,"value":245},{"type":67,"tag":104,"props":11618,"children":11619},{"style":127},[11620],{"type":72,"value":398},{"type":67,"tag":104,"props":11622,"children":11623},{"style":257},[11624],{"type":72,"value":11625}," command",{"type":67,"tag":104,"props":11627,"children":11628},{"style":127},[11629],{"type":72,"value":265},{"type":67,"tag":104,"props":11631,"children":11632},{"style":127},[11633],{"type":72,"value":151},{"type":67,"tag":104,"props":11635,"children":11636},{"style":154},[11637],{"type":72,"value":11638},"npx",{"type":67,"tag":104,"props":11640,"children":11641},{"style":127},[11642],{"type":72,"value":279},{"type":67,"tag":104,"props":11644,"children":11645},{"style":127},[11646],{"type":72,"value":661},{"type":67,"tag":104,"props":11648,"children":11649},{"style":257},[11650],{"type":72,"value":11651}," args",{"type":67,"tag":104,"props":11653,"children":11654},{"style":127},[11655],{"type":72,"value":265},{"type":67,"tag":104,"props":11657,"children":11658},{"style":133},[11659],{"type":72,"value":1821},{"type":67,"tag":104,"props":11661,"children":11662},{"style":127},[11663],{"type":72,"value":279},{"type":67,"tag":104,"props":11665,"children":11666},{"style":154},[11667],{"type":72,"value":11668},"-y",{"type":67,"tag":104,"props":11670,"children":11671},{"style":127},[11672],{"type":72,"value":279},{"type":67,"tag":104,"props":11674,"children":11675},{"style":127},[11676],{"type":72,"value":661},{"type":67,"tag":104,"props":11678,"children":11679},{"style":127},[11680],{"type":72,"value":151},{"type":67,"tag":104,"props":11682,"children":11683},{"style":154},[11684],{"type":72,"value":11685},"my-mcp-server",{"type":67,"tag":104,"props":11687,"children":11688},{"style":127},[11689],{"type":72,"value":279},{"type":67,"tag":104,"props":11691,"children":11692},{"style":133},[11693],{"type":72,"value":11694},"] ",{"type":67,"tag":104,"props":11696,"children":11697},{"style":127},[11698],{"type":72,"value":721},{"type":67,"tag":104,"props":11700,"children":11701},{"style":133},[11702],{"type":72,"value":429},{"type":67,"tag":104,"props":11704,"children":11705},{"style":127},[11706],{"type":72,"value":284},{"type":67,"tag":104,"props":11708,"children":11709},{"class":106,"line":253},[11710,11714],{"type":67,"tag":104,"props":11711,"children":11712},{"style":127},[11713],{"type":72,"value":721},{"type":67,"tag":104,"props":11715,"children":11716},{"style":133},[11717],{"type":72,"value":771},{"type":67,"tag":75,"props":11719,"children":11720},{},[11721,11723,11729,11731,11737,11739,11745],{"type":72,"value":11722},"Import ",{"type":67,"tag":100,"props":11724,"children":11726},{"className":11725},[],[11727],{"type":72,"value":11728},"stdioTransport",{"type":72,"value":11730}," from the ",{"type":67,"tag":100,"props":11732,"children":11734},{"className":11733},[],[11735],{"type":72,"value":11736},"\u002Fstdio",{"type":72,"value":11738}," subpath only — it contains Node.js\n",{"type":67,"tag":100,"props":11740,"children":11742},{"className":11741},[],[11743],{"type":72,"value":11744},"child_process",{"type":72,"value":11746}," imports and must not be bundled for edge runtimes.",{"type":67,"tag":3095,"props":11748,"children":11750},{"id":11749},"chat-mcp-discovery-lifecycle-in-one-prop",[11751,11757],{"type":67,"tag":100,"props":11752,"children":11754},{"className":11753},[],[11755],{"type":72,"value":11756},"chat({ mcp })",{"type":72,"value":11758}," — discovery + lifecycle in one prop",{"type":67,"tag":75,"props":11760,"children":11761},{},[11762,11764,11770,11772,11778,11780,11786,11788,11793],{"type":72,"value":11763},"Instead of manually calling ",{"type":67,"tag":100,"props":11765,"children":11767},{"className":11766},[],[11768],{"type":72,"value":11769},"client.tools()",{"type":72,"value":11771}," and managing ",{"type":67,"tag":100,"props":11773,"children":11775},{"className":11774},[],[11776],{"type":72,"value":11777},"close()",{"type":72,"value":11779},", pass an\n",{"type":67,"tag":100,"props":11781,"children":11783},{"className":11782},[],[11784],{"type":72,"value":11785},"mcp",{"type":72,"value":11787}," object and let ",{"type":67,"tag":100,"props":11789,"children":11791},{"className":11790},[],[11792],{"type":72,"value":8695},{"type":72,"value":11794}," handle discovery and lifecycle.",{"type":67,"tag":93,"props":11796,"children":11798},{"className":95,"code":11797,"language":15,"meta":97,"style":97},"\u002F\u002F Prop shape (ChatMCPOptions):\n\u002F\u002F mcp: {\n\u002F\u002F   clients: Array\u003CMCPClient | MCPClients>,\n\u002F\u002F   connection?: 'close' | 'keep-alive',  \u002F\u002F default: 'close'\n\u002F\u002F   lazyTools?: boolean,\n\u002F\u002F   onDiscoveryError?: (error: unknown, source) => void,\n\u002F\u002F }\n",[11799],{"type":67,"tag":100,"props":11800,"children":11801},{"__ignoreMap":97},[11802,11810,11818,11826,11839,11847,11855],{"type":67,"tag":104,"props":11803,"children":11804},{"class":106,"line":107},[11805],{"type":67,"tag":104,"props":11806,"children":11807},{"style":111},[11808],{"type":72,"value":11809},"\u002F\u002F Prop shape (ChatMCPOptions):\n",{"type":67,"tag":104,"props":11811,"children":11812},{"class":106,"line":117},[11813],{"type":67,"tag":104,"props":11814,"children":11815},{"style":111},[11816],{"type":72,"value":11817},"\u002F\u002F mcp: {\n",{"type":67,"tag":104,"props":11819,"children":11820},{"class":106,"line":165},[11821],{"type":67,"tag":104,"props":11822,"children":11823},{"style":111},[11824],{"type":72,"value":11825},"\u002F\u002F   clients: Array\u003CMCPClient | MCPClients>,\n",{"type":67,"tag":104,"props":11827,"children":11828},{"class":106,"line":203},[11829,11834],{"type":67,"tag":104,"props":11830,"children":11831},{"style":111},[11832],{"type":72,"value":11833},"\u002F\u002F   connection?: 'close' | 'keep-alive',",{"type":67,"tag":104,"props":11835,"children":11836},{"style":111},[11837],{"type":72,"value":11838},"  \u002F\u002F default: 'close'\n",{"type":67,"tag":104,"props":11840,"children":11841},{"class":106,"line":213},[11842],{"type":67,"tag":104,"props":11843,"children":11844},{"style":111},[11845],{"type":72,"value":11846},"\u002F\u002F   lazyTools?: boolean,\n",{"type":67,"tag":104,"props":11848,"children":11849},{"class":106,"line":253},[11850],{"type":67,"tag":104,"props":11851,"children":11852},{"style":111},[11853],{"type":72,"value":11854},"\u002F\u002F   onDiscoveryError?: (error: unknown, source) => void,\n",{"type":67,"tag":104,"props":11856,"children":11857},{"class":106,"line":287},[11858],{"type":67,"tag":104,"props":11859,"children":11860},{"style":111},[11861],{"type":72,"value":11862},"\u002F\u002F }\n",{"type":67,"tag":11864,"props":11865,"children":11866},"ul",{},[11867,11911,11929,11940],{"type":67,"tag":11868,"props":11869,"children":11870},"li",{},[11871,11873,11878,11880,11886,11888,11894,11896,11902,11904,11910],{"type":72,"value":11872},"At run start, ",{"type":67,"tag":100,"props":11874,"children":11876},{"className":11875},[],[11877],{"type":72,"value":8695},{"type":72,"value":11879}," calls ",{"type":67,"tag":100,"props":11881,"children":11883},{"className":11882},[],[11884],{"type":72,"value":11885},".tools()",{"type":72,"value":11887}," on every entry in ",{"type":67,"tag":100,"props":11889,"children":11891},{"className":11890},[],[11892],{"type":72,"value":11893},"clients",{"type":72,"value":11895}," and merges\nthe results — identical to spreading ",{"type":67,"tag":100,"props":11897,"children":11899},{"className":11898},[],[11900],{"type":72,"value":11901},"await client.tools()",{"type":72,"value":11903}," into ",{"type":67,"tag":100,"props":11905,"children":11907},{"className":11906},[],[11908],{"type":72,"value":11909},"tools: [...]",{"type":72,"value":336},{"type":67,"tag":11868,"props":11912,"children":11913},{},[11914,11920,11922,11928],{"type":67,"tag":100,"props":11915,"children":11917},{"className":11916},[],[11918],{"type":72,"value":11919},"lazyTools: true",{"type":72,"value":11921}," is forwarded to ",{"type":67,"tag":100,"props":11923,"children":11925},{"className":11924},[],[11926],{"type":72,"value":11927},"tools({ lazy: true })",{"type":72,"value":336},{"type":67,"tag":11868,"props":11930,"children":11931},{},[11932,11938],{"type":67,"tag":100,"props":11933,"children":11935},{"className":11934},[],[11936],{"type":72,"value":11937},"onDiscoveryError",{"type":72,"value":11939},": throw to fail-fast; return to skip that source.",{"type":67,"tag":11868,"props":11941,"children":11942},{},[11943,11949,11951,11957,11958,11963],{"type":67,"tag":100,"props":11944,"children":11946},{"className":11945},[],[11947],{"type":72,"value":11948},"connection: 'close'",{"type":72,"value":11950}," (default) closes each client when the run ends (after\nthe agent loop completes and the stream is drained). With ",{"type":67,"tag":100,"props":11952,"children":11954},{"className":11953},[],[11955],{"type":72,"value":11956},"'keep-alive'",{"type":72,"value":284},{"type":67,"tag":100,"props":11959,"children":11961},{"className":11960},[],[11962],{"type":72,"value":8695},{"type":72,"value":11964}," never closes the clients — the caller owns their lifecycle (keep\nconnections warm across requests).",{"type":67,"tag":75,"props":11966,"children":11967},{},[11968],{"type":67,"tag":9052,"props":11969,"children":11970},{},[11971,11973,11978],{"type":72,"value":11972},"When to use ",{"type":67,"tag":100,"props":11974,"children":11976},{"className":11975},[],[11977],{"type":72,"value":11785},{"type":72,"value":11979}," vs. the tools spread:",{"type":67,"tag":8909,"props":11981,"children":11982},{},[11983,11999],{"type":67,"tag":8913,"props":11984,"children":11985},{},[11986],{"type":67,"tag":8917,"props":11987,"children":11988},{},[11989,11994],{"type":67,"tag":8921,"props":11990,"children":11991},{},[11992],{"type":72,"value":11993},"Approach",{"type":67,"tag":8921,"props":11995,"children":11996},{},[11997],{"type":72,"value":11998},"Use when",{"type":67,"tag":8937,"props":12000,"children":12001},{},[12002,12019],{"type":67,"tag":8917,"props":12003,"children":12004},{},[12005,12014],{"type":67,"tag":8944,"props":12006,"children":12007},{},[12008],{"type":67,"tag":100,"props":12009,"children":12011},{"className":12010},[],[12012],{"type":72,"value":12013},"chat({ mcp: { clients: [...] } })",{"type":67,"tag":8944,"props":12015,"children":12016},{},[12017],{"type":72,"value":12018},"Convenience: discovery + lifecycle in one place; untyped tool args are acceptable",{"type":67,"tag":8917,"props":12020,"children":12021},{},[12022,12031],{"type":67,"tag":8944,"props":12023,"children":12024},{},[12025],{"type":67,"tag":100,"props":12026,"children":12028},{"className":12027},[],[12029],{"type":72,"value":12030},"tools: [...await client.tools([toolDefinition(...)])]",{"type":67,"tag":8944,"props":12032,"children":12033},{},[12034],{"type":72,"value":12035},"Fully-typed tool args\u002Fresults via Zod schemas",{"type":67,"tag":75,"props":12037,"children":12038},{},[12039],{"type":67,"tag":9052,"props":12040,"children":12041},{},[12042],{"type":72,"value":12043},"Example:",{"type":67,"tag":93,"props":12045,"children":12047},{"className":95,"code":12046,"language":15,"meta":97,"style":97},"import { createFileRoute } from '@tanstack\u002Freact-router'\nimport { chat, toServerSentEventsResponse } from '@tanstack\u002Fai'\nimport { openaiText } from '@tanstack\u002Fai-openai'\nimport { createMCPClient } from '@tanstack\u002Fai-mcp'\n\nexport const Route = createFileRoute('\u002Fapi\u002Fchat')({\n  server: {\n    handlers: {\n      POST: async ({ request }) => {\n        const { messages } = await request.json()\n\n        const mcpClient = await createMCPClient({\n          transport: { type: 'http', url: 'https:\u002F\u002Fmcp.example.com\u002Fmcp' },\n        })\n\n        const stream = chat({\n          adapter: openaiText('gpt-5.5'),\n          messages,\n          mcp: {\n            clients: [mcpClient],\n            connection: 'keep-alive',\n            onDiscoveryError: (err, source) => {\n              console.warn('MCP discovery failed, skipping source:', err)\n              \u002F\u002F returning (not throwing) skips this source and continues\n            },\n          },\n        })\n\n        return toServerSentEventsResponse(stream)\n      },\n    },\n  },\n})\n",[12048],{"type":67,"tag":100,"props":12049,"children":12050},{"__ignoreMap":97},[12051,12086,12129,12164,12199,12206,12253,12268,12283,12318,12361,12368,12400,12463,12474,12481,12508,12547,12558,12574,12603,12632,12674,12721,12729,12736,12744,12755,12762,12785,12792,12799,12806],{"type":67,"tag":104,"props":12052,"children":12053},{"class":106,"line":107},[12054,12058,12062,12066,12070,12074,12078,12082],{"type":67,"tag":104,"props":12055,"children":12056},{"style":121},[12057],{"type":72,"value":124},{"type":67,"tag":104,"props":12059,"children":12060},{"style":127},[12061],{"type":72,"value":130},{"type":67,"tag":104,"props":12063,"children":12064},{"style":133},[12065],{"type":72,"value":9164},{"type":67,"tag":104,"props":12067,"children":12068},{"style":127},[12069],{"type":72,"value":141},{"type":67,"tag":104,"props":12071,"children":12072},{"style":121},[12073],{"type":72,"value":146},{"type":67,"tag":104,"props":12075,"children":12076},{"style":127},[12077],{"type":72,"value":151},{"type":67,"tag":104,"props":12079,"children":12080},{"style":154},[12081],{"type":72,"value":9181},{"type":67,"tag":104,"props":12083,"children":12084},{"style":127},[12085],{"type":72,"value":162},{"type":67,"tag":104,"props":12087,"children":12088},{"class":106,"line":117},[12089,12093,12097,12101,12105,12109,12113,12117,12121,12125],{"type":67,"tag":104,"props":12090,"children":12091},{"style":121},[12092],{"type":72,"value":124},{"type":67,"tag":104,"props":12094,"children":12095},{"style":127},[12096],{"type":72,"value":130},{"type":67,"tag":104,"props":12098,"children":12099},{"style":133},[12100],{"type":72,"value":1480},{"type":67,"tag":104,"props":12102,"children":12103},{"style":127},[12104],{"type":72,"value":661},{"type":67,"tag":104,"props":12106,"children":12107},{"style":133},[12108],{"type":72,"value":1489},{"type":67,"tag":104,"props":12110,"children":12111},{"style":127},[12112],{"type":72,"value":141},{"type":67,"tag":104,"props":12114,"children":12115},{"style":121},[12116],{"type":72,"value":146},{"type":67,"tag":104,"props":12118,"children":12119},{"style":127},[12120],{"type":72,"value":151},{"type":67,"tag":104,"props":12122,"children":12123},{"style":154},[12124],{"type":72,"value":157},{"type":67,"tag":104,"props":12126,"children":12127},{"style":127},[12128],{"type":72,"value":162},{"type":67,"tag":104,"props":12130,"children":12131},{"class":106,"line":165},[12132,12136,12140,12144,12148,12152,12156,12160],{"type":67,"tag":104,"props":12133,"children":12134},{"style":121},[12135],{"type":72,"value":124},{"type":67,"tag":104,"props":12137,"children":12138},{"style":127},[12139],{"type":72,"value":130},{"type":67,"tag":104,"props":12141,"children":12142},{"style":133},[12143],{"type":72,"value":1525},{"type":67,"tag":104,"props":12145,"children":12146},{"style":127},[12147],{"type":72,"value":141},{"type":67,"tag":104,"props":12149,"children":12150},{"style":121},[12151],{"type":72,"value":146},{"type":67,"tag":104,"props":12153,"children":12154},{"style":127},[12155],{"type":72,"value":151},{"type":67,"tag":104,"props":12157,"children":12158},{"style":154},[12159],{"type":72,"value":1542},{"type":67,"tag":104,"props":12161,"children":12162},{"style":127},[12163],{"type":72,"value":162},{"type":67,"tag":104,"props":12165,"children":12166},{"class":106,"line":203},[12167,12171,12175,12179,12183,12187,12191,12195],{"type":67,"tag":104,"props":12168,"children":12169},{"style":121},[12170],{"type":72,"value":124},{"type":67,"tag":104,"props":12172,"children":12173},{"style":127},[12174],{"type":72,"value":130},{"type":67,"tag":104,"props":12176,"children":12177},{"style":133},[12178],{"type":72,"value":9279},{"type":67,"tag":104,"props":12180,"children":12181},{"style":127},[12182],{"type":72,"value":141},{"type":67,"tag":104,"props":12184,"children":12185},{"style":121},[12186],{"type":72,"value":146},{"type":67,"tag":104,"props":12188,"children":12189},{"style":127},[12190],{"type":72,"value":151},{"type":67,"tag":104,"props":12192,"children":12193},{"style":154},[12194],{"type":72,"value":9038},{"type":67,"tag":104,"props":12196,"children":12197},{"style":127},[12198],{"type":72,"value":162},{"type":67,"tag":104,"props":12200,"children":12201},{"class":106,"line":213},[12202],{"type":67,"tag":104,"props":12203,"children":12204},{"emptyLinePlaceholder":207},[12205],{"type":72,"value":210},{"type":67,"tag":104,"props":12207,"children":12208},{"class":106,"line":253},[12209,12213,12217,12221,12225,12229,12233,12237,12241,12245,12249],{"type":67,"tag":104,"props":12210,"children":12211},{"style":121},[12212],{"type":72,"value":219},{"type":67,"tag":104,"props":12214,"children":12215},{"style":222},[12216],{"type":72,"value":225},{"type":67,"tag":104,"props":12218,"children":12219},{"style":133},[12220],{"type":72,"value":9322},{"type":67,"tag":104,"props":12222,"children":12223},{"style":127},[12224],{"type":72,"value":235},{"type":67,"tag":104,"props":12226,"children":12227},{"style":238},[12228],{"type":72,"value":9164},{"type":67,"tag":104,"props":12230,"children":12231},{"style":133},[12232],{"type":72,"value":245},{"type":67,"tag":104,"props":12234,"children":12235},{"style":127},[12236],{"type":72,"value":279},{"type":67,"tag":104,"props":12238,"children":12239},{"style":154},[12240],{"type":72,"value":2418},{"type":67,"tag":104,"props":12242,"children":12243},{"style":127},[12244],{"type":72,"value":279},{"type":67,"tag":104,"props":12246,"children":12247},{"style":133},[12248],{"type":72,"value":9351},{"type":67,"tag":104,"props":12250,"children":12251},{"style":127},[12252],{"type":72,"value":250},{"type":67,"tag":104,"props":12254,"children":12255},{"class":106,"line":287},[12256,12260,12264],{"type":67,"tag":104,"props":12257,"children":12258},{"style":257},[12259],{"type":72,"value":9363},{"type":67,"tag":104,"props":12261,"children":12262},{"style":127},[12263],{"type":72,"value":265},{"type":67,"tag":104,"props":12265,"children":12266},{"style":127},[12267],{"type":72,"value":1186},{"type":67,"tag":104,"props":12269,"children":12270},{"class":106,"line":317},[12271,12275,12279],{"type":67,"tag":104,"props":12272,"children":12273},{"style":257},[12274],{"type":72,"value":9379},{"type":67,"tag":104,"props":12276,"children":12277},{"style":127},[12278],{"type":72,"value":265},{"type":67,"tag":104,"props":12280,"children":12281},{"style":127},[12282],{"type":72,"value":1186},{"type":67,"tag":104,"props":12284,"children":12285},{"class":106,"line":352},[12286,12290,12294,12298,12302,12306,12310,12314],{"type":67,"tag":104,"props":12287,"children":12288},{"style":238},[12289],{"type":72,"value":9395},{"type":67,"tag":104,"props":12291,"children":12292},{"style":127},[12293],{"type":72,"value":265},{"type":67,"tag":104,"props":12295,"children":12296},{"style":222},[12297],{"type":72,"value":1639},{"type":67,"tag":104,"props":12299,"children":12300},{"style":127},[12301],{"type":72,"value":1156},{"type":67,"tag":104,"props":12303,"children":12304},{"style":1159},[12305],{"type":72,"value":1709},{"type":67,"tag":104,"props":12307,"children":12308},{"style":127},[12309],{"type":72,"value":1176},{"type":67,"tag":104,"props":12311,"children":12312},{"style":222},[12313],{"type":72,"value":1181},{"type":67,"tag":104,"props":12315,"children":12316},{"style":127},[12317],{"type":72,"value":1186},{"type":67,"tag":104,"props":12319,"children":12320},{"class":106,"line":436},[12321,12325,12329,12333,12337,12341,12345,12349,12353,12357],{"type":67,"tag":104,"props":12322,"children":12323},{"style":222},[12324],{"type":72,"value":9431},{"type":67,"tag":104,"props":12326,"children":12327},{"style":127},[12328],{"type":72,"value":130},{"type":67,"tag":104,"props":12330,"children":12331},{"style":133},[12332],{"type":72,"value":1692},{"type":67,"tag":104,"props":12334,"children":12335},{"style":127},[12336],{"type":72,"value":141},{"type":67,"tag":104,"props":12338,"children":12339},{"style":127},[12340],{"type":72,"value":1204},{"type":67,"tag":104,"props":12342,"children":12343},{"style":121},[12344],{"type":72,"value":1209},{"type":67,"tag":104,"props":12346,"children":12347},{"style":133},[12348],{"type":72,"value":1709},{"type":67,"tag":104,"props":12350,"children":12351},{"style":127},[12352],{"type":72,"value":336},{"type":67,"tag":104,"props":12354,"children":12355},{"style":238},[12356],{"type":72,"value":1718},{"type":67,"tag":104,"props":12358,"children":12359},{"style":257},[12360],{"type":72,"value":1723},{"type":67,"tag":104,"props":12362,"children":12363},{"class":106,"line":528},[12364],{"type":67,"tag":104,"props":12365,"children":12366},{"emptyLinePlaceholder":207},[12367],{"type":72,"value":210},{"type":67,"tag":104,"props":12369,"children":12370},{"class":106,"line":545},[12371,12375,12380,12384,12388,12392,12396],{"type":67,"tag":104,"props":12372,"children":12373},{"style":222},[12374],{"type":72,"value":9431},{"type":67,"tag":104,"props":12376,"children":12377},{"style":133},[12378],{"type":72,"value":12379}," mcpClient",{"type":67,"tag":104,"props":12381,"children":12382},{"style":127},[12383],{"type":72,"value":1204},{"type":67,"tag":104,"props":12385,"children":12386},{"style":121},[12387],{"type":72,"value":1209},{"type":67,"tag":104,"props":12389,"children":12390},{"style":238},[12391],{"type":72,"value":9279},{"type":67,"tag":104,"props":12393,"children":12394},{"style":257},[12395],{"type":72,"value":245},{"type":67,"tag":104,"props":12397,"children":12398},{"style":127},[12399],{"type":72,"value":250},{"type":67,"tag":104,"props":12401,"children":12402},{"class":106,"line":578},[12403,12407,12411,12415,12419,12423,12427,12431,12435,12439,12443,12447,12451,12455,12459],{"type":67,"tag":104,"props":12404,"children":12405},{"style":257},[12406],{"type":72,"value":9522},{"type":67,"tag":104,"props":12408,"children":12409},{"style":127},[12410],{"type":72,"value":265},{"type":67,"tag":104,"props":12412,"children":12413},{"style":127},[12414],{"type":72,"value":130},{"type":67,"tag":104,"props":12416,"children":12417},{"style":257},[12418],{"type":72,"value":9535},{"type":67,"tag":104,"props":12420,"children":12421},{"style":127},[12422],{"type":72,"value":265},{"type":67,"tag":104,"props":12424,"children":12425},{"style":127},[12426],{"type":72,"value":151},{"type":67,"tag":104,"props":12428,"children":12429},{"style":154},[12430],{"type":72,"value":9548},{"type":67,"tag":104,"props":12432,"children":12433},{"style":127},[12434],{"type":72,"value":279},{"type":67,"tag":104,"props":12436,"children":12437},{"style":127},[12438],{"type":72,"value":661},{"type":67,"tag":104,"props":12440,"children":12441},{"style":257},[12442],{"type":72,"value":9561},{"type":67,"tag":104,"props":12444,"children":12445},{"style":127},[12446],{"type":72,"value":265},{"type":67,"tag":104,"props":12448,"children":12449},{"style":127},[12450],{"type":72,"value":151},{"type":67,"tag":104,"props":12452,"children":12453},{"style":154},[12454],{"type":72,"value":9574},{"type":67,"tag":104,"props":12456,"children":12457},{"style":127},[12458],{"type":72,"value":279},{"type":67,"tag":104,"props":12460,"children":12461},{"style":127},[12462],{"type":72,"value":8885},{"type":67,"tag":104,"props":12464,"children":12465},{"class":106,"line":609},[12466,12470],{"type":67,"tag":104,"props":12467,"children":12468},{"style":127},[12469],{"type":72,"value":9590},{"type":67,"tag":104,"props":12471,"children":12472},{"style":257},[12473],{"type":72,"value":771},{"type":67,"tag":104,"props":12475,"children":12476},{"class":106,"line":732},[12477],{"type":67,"tag":104,"props":12478,"children":12479},{"emptyLinePlaceholder":207},[12480],{"type":72,"value":210},{"type":67,"tag":104,"props":12482,"children":12483},{"class":106,"line":745},[12484,12488,12492,12496,12500,12504],{"type":67,"tag":104,"props":12485,"children":12486},{"style":222},[12487],{"type":72,"value":9431},{"type":67,"tag":104,"props":12489,"children":12490},{"style":133},[12491],{"type":72,"value":1735},{"type":67,"tag":104,"props":12493,"children":12494},{"style":127},[12495],{"type":72,"value":1204},{"type":67,"tag":104,"props":12497,"children":12498},{"style":238},[12499],{"type":72,"value":1480},{"type":67,"tag":104,"props":12501,"children":12502},{"style":257},[12503],{"type":72,"value":245},{"type":67,"tag":104,"props":12505,"children":12506},{"style":127},[12507],{"type":72,"value":250},{"type":67,"tag":104,"props":12509,"children":12510},{"class":106,"line":761},[12511,12515,12519,12523,12527,12531,12535,12539,12543],{"type":67,"tag":104,"props":12512,"children":12513},{"style":257},[12514],{"type":72,"value":9720},{"type":67,"tag":104,"props":12516,"children":12517},{"style":127},[12518],{"type":72,"value":265},{"type":67,"tag":104,"props":12520,"children":12521},{"style":238},[12522],{"type":72,"value":1525},{"type":67,"tag":104,"props":12524,"children":12525},{"style":257},[12526],{"type":72,"value":245},{"type":67,"tag":104,"props":12528,"children":12529},{"style":127},[12530],{"type":72,"value":279},{"type":67,"tag":104,"props":12532,"children":12533},{"style":154},[12534],{"type":72,"value":1780},{"type":67,"tag":104,"props":12536,"children":12537},{"style":127},[12538],{"type":72,"value":279},{"type":67,"tag":104,"props":12540,"children":12541},{"style":257},[12542],{"type":72,"value":429},{"type":67,"tag":104,"props":12544,"children":12545},{"style":127},[12546],{"type":72,"value":284},{"type":67,"tag":104,"props":12548,"children":12549},{"class":106,"line":774},[12550,12554],{"type":67,"tag":104,"props":12551,"children":12552},{"style":133},[12553],{"type":72,"value":9760},{"type":67,"tag":104,"props":12555,"children":12556},{"style":127},[12557],{"type":72,"value":284},{"type":67,"tag":104,"props":12559,"children":12560},{"class":106,"line":782},[12561,12566,12570],{"type":67,"tag":104,"props":12562,"children":12563},{"style":257},[12564],{"type":72,"value":12565},"          mcp",{"type":67,"tag":104,"props":12567,"children":12568},{"style":127},[12569],{"type":72,"value":265},{"type":67,"tag":104,"props":12571,"children":12572},{"style":127},[12573],{"type":72,"value":1186},{"type":67,"tag":104,"props":12575,"children":12576},{"class":106,"line":815},[12577,12582,12586,12590,12595,12599],{"type":67,"tag":104,"props":12578,"children":12579},{"style":257},[12580],{"type":72,"value":12581},"            clients",{"type":67,"tag":104,"props":12583,"children":12584},{"style":127},[12585],{"type":72,"value":265},{"type":67,"tag":104,"props":12587,"children":12588},{"style":257},[12589],{"type":72,"value":1821},{"type":67,"tag":104,"props":12591,"children":12592},{"style":133},[12593],{"type":72,"value":12594},"mcpClient",{"type":67,"tag":104,"props":12596,"children":12597},{"style":257},[12598],{"type":72,"value":1839},{"type":67,"tag":104,"props":12600,"children":12601},{"style":127},[12602],{"type":72,"value":284},{"type":67,"tag":104,"props":12604,"children":12605},{"class":106,"line":844},[12606,12611,12615,12619,12624,12628],{"type":67,"tag":104,"props":12607,"children":12608},{"style":257},[12609],{"type":72,"value":12610},"            connection",{"type":67,"tag":104,"props":12612,"children":12613},{"style":127},[12614],{"type":72,"value":265},{"type":67,"tag":104,"props":12616,"children":12617},{"style":127},[12618],{"type":72,"value":151},{"type":67,"tag":104,"props":12620,"children":12621},{"style":154},[12622],{"type":72,"value":12623},"keep-alive",{"type":67,"tag":104,"props":12625,"children":12626},{"style":127},[12627],{"type":72,"value":279},{"type":67,"tag":104,"props":12629,"children":12630},{"style":127},[12631],{"type":72,"value":284},{"type":67,"tag":104,"props":12633,"children":12634},{"class":106,"line":873},[12635,12640,12644,12648,12653,12657,12662,12666,12670],{"type":67,"tag":104,"props":12636,"children":12637},{"style":238},[12638],{"type":72,"value":12639},"            onDiscoveryError",{"type":67,"tag":104,"props":12641,"children":12642},{"style":127},[12643],{"type":72,"value":265},{"type":67,"tag":104,"props":12645,"children":12646},{"style":127},[12647],{"type":72,"value":1341},{"type":67,"tag":104,"props":12649,"children":12650},{"style":1159},[12651],{"type":72,"value":12652},"err",{"type":67,"tag":104,"props":12654,"children":12655},{"style":127},[12656],{"type":72,"value":661},{"type":67,"tag":104,"props":12658,"children":12659},{"style":1159},[12660],{"type":72,"value":12661}," source",{"type":67,"tag":104,"props":12663,"children":12664},{"style":127},[12665],{"type":72,"value":429},{"type":67,"tag":104,"props":12667,"children":12668},{"style":222},[12669],{"type":72,"value":1181},{"type":67,"tag":104,"props":12671,"children":12672},{"style":127},[12673],{"type":72,"value":1186},{"type":67,"tag":104,"props":12675,"children":12676},{"class":106,"line":971},[12677,12682,12686,12691,12695,12699,12704,12708,12712,12717],{"type":67,"tag":104,"props":12678,"children":12679},{"style":133},[12680],{"type":72,"value":12681},"              console",{"type":67,"tag":104,"props":12683,"children":12684},{"style":127},[12685],{"type":72,"value":336},{"type":67,"tag":104,"props":12687,"children":12688},{"style":238},[12689],{"type":72,"value":12690},"warn",{"type":67,"tag":104,"props":12692,"children":12693},{"style":257},[12694],{"type":72,"value":245},{"type":67,"tag":104,"props":12696,"children":12697},{"style":127},[12698],{"type":72,"value":279},{"type":67,"tag":104,"props":12700,"children":12701},{"style":154},[12702],{"type":72,"value":12703},"MCP discovery failed, skipping source:",{"type":67,"tag":104,"props":12705,"children":12706},{"style":127},[12707],{"type":72,"value":279},{"type":67,"tag":104,"props":12709,"children":12710},{"style":127},[12711],{"type":72,"value":661},{"type":67,"tag":104,"props":12713,"children":12714},{"style":133},[12715],{"type":72,"value":12716}," err",{"type":67,"tag":104,"props":12718,"children":12719},{"style":257},[12720],{"type":72,"value":771},{"type":67,"tag":104,"props":12722,"children":12723},{"class":106,"line":1041},[12724],{"type":67,"tag":104,"props":12725,"children":12726},{"style":111},[12727],{"type":72,"value":12728},"              \u002F\u002F returning (not throwing) skips this source and continues\n",{"type":67,"tag":104,"props":12730,"children":12731},{"class":106,"line":2459},[12732],{"type":67,"tag":104,"props":12733,"children":12734},{"style":127},[12735],{"type":72,"value":9981},{"type":67,"tag":104,"props":12737,"children":12738},{"class":106,"line":2514},[12739],{"type":67,"tag":104,"props":12740,"children":12741},{"style":127},[12742],{"type":72,"value":12743},"          },\n",{"type":67,"tag":104,"props":12745,"children":12746},{"class":106,"line":2523},[12747,12751],{"type":67,"tag":104,"props":12748,"children":12749},{"style":127},[12750],{"type":72,"value":9590},{"type":67,"tag":104,"props":12752,"children":12753},{"style":257},[12754],{"type":72,"value":771},{"type":67,"tag":104,"props":12756,"children":12757},{"class":106,"line":2532},[12758],{"type":67,"tag":104,"props":12759,"children":12760},{"emptyLinePlaceholder":207},[12761],{"type":72,"value":210},{"type":67,"tag":104,"props":12763,"children":12764},{"class":106,"line":2540},[12765,12769,12773,12777,12781],{"type":67,"tag":104,"props":12766,"children":12767},{"style":121},[12768],{"type":72,"value":10012},{"type":67,"tag":104,"props":12770,"children":12771},{"style":238},[12772],{"type":72,"value":1489},{"type":67,"tag":104,"props":12774,"children":12775},{"style":257},[12776],{"type":72,"value":245},{"type":67,"tag":104,"props":12778,"children":12779},{"style":133},[12780],{"type":72,"value":1879},{"type":67,"tag":104,"props":12782,"children":12783},{"style":257},[12784],{"type":72,"value":771},{"type":67,"tag":104,"props":12786,"children":12787},{"class":106,"line":2553},[12788],{"type":67,"tag":104,"props":12789,"children":12790},{"style":127},[12791],{"type":72,"value":10036},{"type":67,"tag":104,"props":12793,"children":12794},{"class":106,"line":2572},[12795],{"type":67,"tag":104,"props":12796,"children":12797},{"style":127},[12798],{"type":72,"value":10044},{"type":67,"tag":104,"props":12800,"children":12801},{"class":106,"line":2625},[12802],{"type":67,"tag":104,"props":12803,"children":12804},{"style":127},[12805],{"type":72,"value":10052},{"type":67,"tag":104,"props":12807,"children":12808},{"class":106,"line":2671},[12809,12813],{"type":67,"tag":104,"props":12810,"children":12811},{"style":127},[12812],{"type":72,"value":721},{"type":67,"tag":104,"props":12814,"children":12815},{"style":133},[12816],{"type":72,"value":771},{"type":67,"tag":81,"props":12818,"children":12820},{"id":12819},"provider-skills",[12821],{"type":72,"value":12822},"Provider Skills",{"type":67,"tag":12824,"props":12825,"children":12826},"blockquote",{},[12827],{"type":67,"tag":75,"props":12828,"children":12829},{},[12830,12841],{"type":67,"tag":9052,"props":12831,"children":12832},{},[12833,12835],{"type":72,"value":12834},"Not to be confused with ",{"type":67,"tag":100,"props":12836,"children":12838},{"className":12837},[],[12839],{"type":72,"value":12840},"@tanstack\u002Fai-code-mode-skills",{"type":72,"value":12842},", which are locally-generated TypeScript functions executed client-side. Provider Skills are hosted, provider-managed bundles that the model loads on demand and runs inside the provider's server-side sandbox.",{"type":67,"tag":75,"props":12844,"children":12845},{},[12846],{"type":72,"value":12847},"Provider Skills are inert without an execution tool. The execution tool is what activates the sandbox; skills are additional capability bundles that run inside it:",{"type":67,"tag":11864,"props":12849,"children":12850},{},[12851,12876],{"type":67,"tag":11868,"props":12852,"children":12853},{},[12854,12859,12861,12867,12869,12875],{"type":67,"tag":9052,"props":12855,"children":12856},{},[12857],{"type":72,"value":12858},"Anthropic",{"type":72,"value":12860},": skills require the ",{"type":67,"tag":100,"props":12862,"children":12864},{"className":12863},[],[12865],{"type":72,"value":12866},"code_execution",{"type":72,"value":12868}," tool (",{"type":67,"tag":100,"props":12870,"children":12872},{"className":12871},[],[12873],{"type":72,"value":12874},"@tanstack\u002Fai-anthropic\u002Ftools",{"type":72,"value":9127},{"type":67,"tag":11868,"props":12877,"children":12878},{},[12879,12884,12886,12892,12893,12899],{"type":67,"tag":9052,"props":12880,"children":12881},{},[12882],{"type":72,"value":12883},"OpenAI",{"type":72,"value":12885},": skills live inside the ",{"type":67,"tag":100,"props":12887,"children":12889},{"className":12888},[],[12890],{"type":72,"value":12891},"shell",{"type":72,"value":12868},{"type":67,"tag":100,"props":12894,"children":12896},{"className":12895},[],[12897],{"type":72,"value":12898},"@tanstack\u002Fai-openai\u002Ftools",{"type":72,"value":12900},") and are Responses API only.",{"type":67,"tag":3095,"props":12902,"children":12904},{"id":12903},"anthropic-codeexecutiontool-with-skills",[12905,12907,12913],{"type":72,"value":12906},"Anthropic: ",{"type":67,"tag":100,"props":12908,"children":12910},{"className":12909},[],[12911],{"type":72,"value":12912},"codeExecutionTool",{"type":72,"value":12914}," with skills",{"type":67,"tag":75,"props":12916,"children":12917},{},[12918,12920,12925],{"type":72,"value":12919},"Import from ",{"type":67,"tag":100,"props":12921,"children":12923},{"className":12922},[],[12924],{"type":72,"value":12874},{"type":72,"value":265},{"type":67,"tag":93,"props":12927,"children":12929},{"className":95,"code":12928,"language":15,"meta":97,"style":97},"import { codeExecutionTool } from '@tanstack\u002Fai-anthropic\u002Ftools'\nimport { chat, toServerSentEventsResponse } from '@tanstack\u002Fai'\nimport { anthropicText } from '@tanstack\u002Fai-anthropic'\n\nexport async function POST(request: Request) {\n  const { messages } = await request.json()\n  const stream = chat({\n    adapter: anthropicText('claude-sonnet-4-6'),\n    messages,\n    tools: [\n      codeExecutionTool(\n        { type: 'code_execution_20250825', name: 'code_execution' },\n        {\n          skills: [{ type: 'anthropic', skill_id: 'pptx', version: 'latest' }],\n        },\n      ),\n    ],\n  })\n  return toServerSentEventsResponse(stream)\n}\n",[12930],{"type":67,"tag":100,"props":12931,"children":12932},{"__ignoreMap":97},[12933,12969,13012,13049,13056,13099,13142,13169,13209,13220,13235,13247,13304,13312,13416,13424,13436,13448,13459,13482],{"type":67,"tag":104,"props":12934,"children":12935},{"class":106,"line":107},[12936,12940,12944,12949,12953,12957,12961,12965],{"type":67,"tag":104,"props":12937,"children":12938},{"style":121},[12939],{"type":72,"value":124},{"type":67,"tag":104,"props":12941,"children":12942},{"style":127},[12943],{"type":72,"value":130},{"type":67,"tag":104,"props":12945,"children":12946},{"style":133},[12947],{"type":72,"value":12948}," codeExecutionTool",{"type":67,"tag":104,"props":12950,"children":12951},{"style":127},[12952],{"type":72,"value":141},{"type":67,"tag":104,"props":12954,"children":12955},{"style":121},[12956],{"type":72,"value":146},{"type":67,"tag":104,"props":12958,"children":12959},{"style":127},[12960],{"type":72,"value":151},{"type":67,"tag":104,"props":12962,"children":12963},{"style":154},[12964],{"type":72,"value":12874},{"type":67,"tag":104,"props":12966,"children":12967},{"style":127},[12968],{"type":72,"value":162},{"type":67,"tag":104,"props":12970,"children":12971},{"class":106,"line":117},[12972,12976,12980,12984,12988,12992,12996,13000,13004,13008],{"type":67,"tag":104,"props":12973,"children":12974},{"style":121},[12975],{"type":72,"value":124},{"type":67,"tag":104,"props":12977,"children":12978},{"style":127},[12979],{"type":72,"value":130},{"type":67,"tag":104,"props":12981,"children":12982},{"style":133},[12983],{"type":72,"value":1480},{"type":67,"tag":104,"props":12985,"children":12986},{"style":127},[12987],{"type":72,"value":661},{"type":67,"tag":104,"props":12989,"children":12990},{"style":133},[12991],{"type":72,"value":1489},{"type":67,"tag":104,"props":12993,"children":12994},{"style":127},[12995],{"type":72,"value":141},{"type":67,"tag":104,"props":12997,"children":12998},{"style":121},[12999],{"type":72,"value":146},{"type":67,"tag":104,"props":13001,"children":13002},{"style":127},[13003],{"type":72,"value":151},{"type":67,"tag":104,"props":13005,"children":13006},{"style":154},[13007],{"type":72,"value":157},{"type":67,"tag":104,"props":13009,"children":13010},{"style":127},[13011],{"type":72,"value":162},{"type":67,"tag":104,"props":13013,"children":13014},{"class":106,"line":165},[13015,13019,13023,13028,13032,13036,13040,13045],{"type":67,"tag":104,"props":13016,"children":13017},{"style":121},[13018],{"type":72,"value":124},{"type":67,"tag":104,"props":13020,"children":13021},{"style":127},[13022],{"type":72,"value":130},{"type":67,"tag":104,"props":13024,"children":13025},{"style":133},[13026],{"type":72,"value":13027}," anthropicText",{"type":67,"tag":104,"props":13029,"children":13030},{"style":127},[13031],{"type":72,"value":141},{"type":67,"tag":104,"props":13033,"children":13034},{"style":121},[13035],{"type":72,"value":146},{"type":67,"tag":104,"props":13037,"children":13038},{"style":127},[13039],{"type":72,"value":151},{"type":67,"tag":104,"props":13041,"children":13042},{"style":154},[13043],{"type":72,"value":13044},"@tanstack\u002Fai-anthropic",{"type":67,"tag":104,"props":13046,"children":13047},{"style":127},[13048],{"type":72,"value":162},{"type":67,"tag":104,"props":13050,"children":13051},{"class":106,"line":203},[13052],{"type":67,"tag":104,"props":13053,"children":13054},{"emptyLinePlaceholder":207},[13055],{"type":72,"value":210},{"type":67,"tag":104,"props":13057,"children":13058},{"class":106,"line":213},[13059,13063,13067,13071,13075,13079,13083,13087,13091,13095],{"type":67,"tag":104,"props":13060,"children":13061},{"style":121},[13062],{"type":72,"value":219},{"type":67,"tag":104,"props":13064,"children":13065},{"style":222},[13066],{"type":72,"value":1639},{"type":67,"tag":104,"props":13068,"children":13069},{"style":222},[13070],{"type":72,"value":1644},{"type":67,"tag":104,"props":13072,"children":13073},{"style":238},[13074],{"type":72,"value":1649},{"type":67,"tag":104,"props":13076,"children":13077},{"style":127},[13078],{"type":72,"value":245},{"type":67,"tag":104,"props":13080,"children":13081},{"style":1159},[13082],{"type":72,"value":1658},{"type":67,"tag":104,"props":13084,"children":13085},{"style":127},[13086],{"type":72,"value":265},{"type":67,"tag":104,"props":13088,"children":13089},{"style":1665},[13090],{"type":72,"value":1668},{"type":67,"tag":104,"props":13092,"children":13093},{"style":127},[13094],{"type":72,"value":429},{"type":67,"tag":104,"props":13096,"children":13097},{"style":127},[13098],{"type":72,"value":1186},{"type":67,"tag":104,"props":13100,"children":13101},{"class":106,"line":253},[13102,13106,13110,13114,13118,13122,13126,13130,13134,13138],{"type":67,"tag":104,"props":13103,"children":13104},{"style":222},[13105],{"type":72,"value":1194},{"type":67,"tag":104,"props":13107,"children":13108},{"style":127},[13109],{"type":72,"value":130},{"type":67,"tag":104,"props":13111,"children":13112},{"style":133},[13113],{"type":72,"value":1692},{"type":67,"tag":104,"props":13115,"children":13116},{"style":127},[13117],{"type":72,"value":141},{"type":67,"tag":104,"props":13119,"children":13120},{"style":127},[13121],{"type":72,"value":1204},{"type":67,"tag":104,"props":13123,"children":13124},{"style":121},[13125],{"type":72,"value":1209},{"type":67,"tag":104,"props":13127,"children":13128},{"style":133},[13129],{"type":72,"value":1709},{"type":67,"tag":104,"props":13131,"children":13132},{"style":127},[13133],{"type":72,"value":336},{"type":67,"tag":104,"props":13135,"children":13136},{"style":238},[13137],{"type":72,"value":1718},{"type":67,"tag":104,"props":13139,"children":13140},{"style":257},[13141],{"type":72,"value":1723},{"type":67,"tag":104,"props":13143,"children":13144},{"class":106,"line":287},[13145,13149,13153,13157,13161,13165],{"type":67,"tag":104,"props":13146,"children":13147},{"style":222},[13148],{"type":72,"value":1194},{"type":67,"tag":104,"props":13150,"children":13151},{"style":133},[13152],{"type":72,"value":1735},{"type":67,"tag":104,"props":13154,"children":13155},{"style":127},[13156],{"type":72,"value":1204},{"type":67,"tag":104,"props":13158,"children":13159},{"style":238},[13160],{"type":72,"value":1480},{"type":67,"tag":104,"props":13162,"children":13163},{"style":257},[13164],{"type":72,"value":245},{"type":67,"tag":104,"props":13166,"children":13167},{"style":127},[13168],{"type":72,"value":250},{"type":67,"tag":104,"props":13170,"children":13171},{"class":106,"line":317},[13172,13176,13180,13184,13188,13192,13197,13201,13205],{"type":67,"tag":104,"props":13173,"children":13174},{"style":257},[13175],{"type":72,"value":1759},{"type":67,"tag":104,"props":13177,"children":13178},{"style":127},[13179],{"type":72,"value":265},{"type":67,"tag":104,"props":13181,"children":13182},{"style":238},[13183],{"type":72,"value":13027},{"type":67,"tag":104,"props":13185,"children":13186},{"style":257},[13187],{"type":72,"value":245},{"type":67,"tag":104,"props":13189,"children":13190},{"style":127},[13191],{"type":72,"value":279},{"type":67,"tag":104,"props":13193,"children":13194},{"style":154},[13195],{"type":72,"value":13196},"claude-sonnet-4-6",{"type":67,"tag":104,"props":13198,"children":13199},{"style":127},[13200],{"type":72,"value":279},{"type":67,"tag":104,"props":13202,"children":13203},{"style":257},[13204],{"type":72,"value":429},{"type":67,"tag":104,"props":13206,"children":13207},{"style":127},[13208],{"type":72,"value":284},{"type":67,"tag":104,"props":13210,"children":13211},{"class":106,"line":352},[13212,13216],{"type":67,"tag":104,"props":13213,"children":13214},{"style":133},[13215],{"type":72,"value":1800},{"type":67,"tag":104,"props":13217,"children":13218},{"style":127},[13219],{"type":72,"value":284},{"type":67,"tag":104,"props":13221,"children":13222},{"class":106,"line":436},[13223,13227,13231],{"type":67,"tag":104,"props":13224,"children":13225},{"style":257},[13226],{"type":72,"value":1812},{"type":67,"tag":104,"props":13228,"children":13229},{"style":127},[13230],{"type":72,"value":265},{"type":67,"tag":104,"props":13232,"children":13233},{"style":257},[13234],{"type":72,"value":9815},{"type":67,"tag":104,"props":13236,"children":13237},{"class":106,"line":528},[13238,13243],{"type":67,"tag":104,"props":13239,"children":13240},{"style":238},[13241],{"type":72,"value":13242},"      codeExecutionTool",{"type":67,"tag":104,"props":13244,"children":13245},{"style":257},[13246],{"type":72,"value":606},{"type":67,"tag":104,"props":13248,"children":13249},{"class":106,"line":545},[13250,13255,13259,13263,13267,13272,13276,13280,13284,13288,13292,13296,13300],{"type":67,"tag":104,"props":13251,"children":13252},{"style":127},[13253],{"type":72,"value":13254},"        {",{"type":67,"tag":104,"props":13256,"children":13257},{"style":257},[13258],{"type":72,"value":9535},{"type":67,"tag":104,"props":13260,"children":13261},{"style":127},[13262],{"type":72,"value":265},{"type":67,"tag":104,"props":13264,"children":13265},{"style":127},[13266],{"type":72,"value":151},{"type":67,"tag":104,"props":13268,"children":13269},{"style":154},[13270],{"type":72,"value":13271},"code_execution_20250825",{"type":67,"tag":104,"props":13273,"children":13274},{"style":127},[13275],{"type":72,"value":279},{"type":67,"tag":104,"props":13277,"children":13278},{"style":127},[13279],{"type":72,"value":661},{"type":67,"tag":104,"props":13281,"children":13282},{"style":257},[13283],{"type":72,"value":666},{"type":67,"tag":104,"props":13285,"children":13286},{"style":127},[13287],{"type":72,"value":265},{"type":67,"tag":104,"props":13289,"children":13290},{"style":127},[13291],{"type":72,"value":151},{"type":67,"tag":104,"props":13293,"children":13294},{"style":154},[13295],{"type":72,"value":12866},{"type":67,"tag":104,"props":13297,"children":13298},{"style":127},[13299],{"type":72,"value":279},{"type":67,"tag":104,"props":13301,"children":13302},{"style":127},[13303],{"type":72,"value":8885},{"type":67,"tag":104,"props":13305,"children":13306},{"class":106,"line":578},[13307],{"type":67,"tag":104,"props":13308,"children":13309},{"style":127},[13310],{"type":72,"value":13311},"        {\n",{"type":67,"tag":104,"props":13313,"children":13314},{"class":106,"line":609},[13315,13320,13324,13328,13332,13336,13340,13344,13348,13352,13356,13361,13365,13369,13374,13378,13382,13387,13391,13395,13400,13404,13408,13412],{"type":67,"tag":104,"props":13316,"children":13317},{"style":257},[13318],{"type":72,"value":13319},"          skills",{"type":67,"tag":104,"props":13321,"children":13322},{"style":127},[13323],{"type":72,"value":265},{"type":67,"tag":104,"props":13325,"children":13326},{"style":257},[13327],{"type":72,"value":1821},{"type":67,"tag":104,"props":13329,"children":13330},{"style":127},[13331],{"type":72,"value":398},{"type":67,"tag":104,"props":13333,"children":13334},{"style":257},[13335],{"type":72,"value":9535},{"type":67,"tag":104,"props":13337,"children":13338},{"style":127},[13339],{"type":72,"value":265},{"type":67,"tag":104,"props":13341,"children":13342},{"style":127},[13343],{"type":72,"value":151},{"type":67,"tag":104,"props":13345,"children":13346},{"style":154},[13347],{"type":72,"value":32},{"type":67,"tag":104,"props":13349,"children":13350},{"style":127},[13351],{"type":72,"value":279},{"type":67,"tag":104,"props":13353,"children":13354},{"style":127},[13355],{"type":72,"value":661},{"type":67,"tag":104,"props":13357,"children":13358},{"style":257},[13359],{"type":72,"value":13360}," skill_id",{"type":67,"tag":104,"props":13362,"children":13363},{"style":127},[13364],{"type":72,"value":265},{"type":67,"tag":104,"props":13366,"children":13367},{"style":127},[13368],{"type":72,"value":151},{"type":67,"tag":104,"props":13370,"children":13371},{"style":154},[13372],{"type":72,"value":13373},"pptx",{"type":67,"tag":104,"props":13375,"children":13376},{"style":127},[13377],{"type":72,"value":279},{"type":67,"tag":104,"props":13379,"children":13380},{"style":127},[13381],{"type":72,"value":661},{"type":67,"tag":104,"props":13383,"children":13384},{"style":257},[13385],{"type":72,"value":13386}," version",{"type":67,"tag":104,"props":13388,"children":13389},{"style":127},[13390],{"type":72,"value":265},{"type":67,"tag":104,"props":13392,"children":13393},{"style":127},[13394],{"type":72,"value":151},{"type":67,"tag":104,"props":13396,"children":13397},{"style":154},[13398],{"type":72,"value":13399},"latest",{"type":67,"tag":104,"props":13401,"children":13402},{"style":127},[13403],{"type":72,"value":279},{"type":67,"tag":104,"props":13405,"children":13406},{"style":127},[13407],{"type":72,"value":141},{"type":67,"tag":104,"props":13409,"children":13410},{"style":257},[13411],{"type":72,"value":1839},{"type":67,"tag":104,"props":13413,"children":13414},{"style":127},[13415],{"type":72,"value":284},{"type":67,"tag":104,"props":13417,"children":13418},{"class":106,"line":732},[13419],{"type":67,"tag":104,"props":13420,"children":13421},{"style":127},[13422],{"type":72,"value":13423},"        },\n",{"type":67,"tag":104,"props":13425,"children":13426},{"class":106,"line":745},[13427,13432],{"type":67,"tag":104,"props":13428,"children":13429},{"style":257},[13430],{"type":72,"value":13431},"      )",{"type":67,"tag":104,"props":13433,"children":13434},{"style":127},[13435],{"type":72,"value":284},{"type":67,"tag":104,"props":13437,"children":13438},{"class":106,"line":761},[13439,13444],{"type":67,"tag":104,"props":13440,"children":13441},{"style":257},[13442],{"type":72,"value":13443},"    ]",{"type":67,"tag":104,"props":13445,"children":13446},{"style":127},[13447],{"type":72,"value":284},{"type":67,"tag":104,"props":13449,"children":13450},{"class":106,"line":774},[13451,13455],{"type":67,"tag":104,"props":13452,"children":13453},{"style":127},[13454],{"type":72,"value":534},{"type":67,"tag":104,"props":13456,"children":13457},{"style":257},[13458],{"type":72,"value":771},{"type":67,"tag":104,"props":13460,"children":13461},{"class":106,"line":782},[13462,13466,13470,13474,13478],{"type":67,"tag":104,"props":13463,"children":13464},{"style":121},[13465],{"type":72,"value":1288},{"type":67,"tag":104,"props":13467,"children":13468},{"style":238},[13469],{"type":72,"value":1489},{"type":67,"tag":104,"props":13471,"children":13472},{"style":257},[13473],{"type":72,"value":245},{"type":67,"tag":104,"props":13475,"children":13476},{"style":133},[13477],{"type":72,"value":1879},{"type":67,"tag":104,"props":13479,"children":13480},{"style":257},[13481],{"type":72,"value":771},{"type":67,"tag":104,"props":13483,"children":13484},{"class":106,"line":815},[13485],{"type":67,"tag":104,"props":13486,"children":13487},{"style":127},[13488],{"type":72,"value":1891},{"type":67,"tag":75,"props":13490,"children":13491},{},[13492,13498,13500,13506,13508,13514],{"type":67,"tag":100,"props":13493,"children":13495},{"className":13494},[],[13496],{"type":72,"value":13497},"AnthropicContainerSkill",{"type":72,"value":13499}," shape: ",{"type":67,"tag":100,"props":13501,"children":13503},{"className":13502},[],[13504],{"type":72,"value":13505},"{ type: 'anthropic' | 'custom'; skill_id: string; version?: string }",{"type":72,"value":13507},". Constraints: max 8 skills per request; ",{"type":67,"tag":100,"props":13509,"children":13511},{"className":13510},[],[13512],{"type":72,"value":13513},"skill_id",{"type":72,"value":13515}," must be 1–64 characters.",{"type":67,"tag":75,"props":13517,"children":13518},{},[13519],{"type":72,"value":13520},"The adapter automatically:",{"type":67,"tag":11864,"props":13522,"children":13523},{},[13524,13537],{"type":67,"tag":11868,"props":13525,"children":13526},{},[13527,13529,13535],{"type":72,"value":13528},"Lifts the skills into the request's top-level ",{"type":67,"tag":100,"props":13530,"children":13532},{"className":13531},[],[13533],{"type":72,"value":13534},"container.skills",{"type":72,"value":13536}," param (the shape Anthropic's API requires).",{"type":67,"tag":11868,"props":13538,"children":13539},{},[13540,13542,13548,13550,13556],{"type":72,"value":13541},"Attaches the required beta headers (",{"type":67,"tag":100,"props":13543,"children":13545},{"className":13544},[],[13546],{"type":72,"value":13547},"code-execution-2025-08-25",{"type":72,"value":13549}," plus ",{"type":67,"tag":100,"props":13551,"children":13553},{"className":13552},[],[13554],{"type":72,"value":13555},"skills-2025-10-02",{"type":72,"value":13557}," when skills are present). You do not set these manually.",{"type":67,"tag":75,"props":13559,"children":13560},{},[13561,13566,13568,13574,13576,13582],{"type":67,"tag":9052,"props":13562,"children":13563},{},[13564],{"type":72,"value":13565},"Deprecation:",{"type":72,"value":13567}," Setting skills via ",{"type":67,"tag":100,"props":13569,"children":13571},{"className":13570},[],[13572],{"type":72,"value":13573},"modelOptions.container.skills",{"type":72,"value":13575}," is deprecated. Use ",{"type":67,"tag":100,"props":13577,"children":13579},{"className":13578},[],[13580],{"type":72,"value":13581},"codeExecutionTool(config, { skills })",{"type":72,"value":13583}," instead — the legacy path bypasses the beta-header wiring.",{"type":67,"tag":3095,"props":13585,"children":13587},{"id":13586},"openai-shelltool-with-skills-responses-api-only",[13588,13590,13596],{"type":72,"value":13589},"OpenAI: ",{"type":67,"tag":100,"props":13591,"children":13593},{"className":13592},[],[13594],{"type":72,"value":13595},"shellTool",{"type":72,"value":13597}," with skills (Responses API only)",{"type":67,"tag":75,"props":13599,"children":13600},{},[13601,13602,13607],{"type":72,"value":12919},{"type":67,"tag":100,"props":13603,"children":13605},{"className":13604},[],[13606],{"type":72,"value":12898},{"type":72,"value":265},{"type":67,"tag":93,"props":13609,"children":13611},{"className":95,"code":13610,"language":15,"meta":97,"style":97},"import { shellTool } from '@tanstack\u002Fai-openai\u002Ftools'\nimport { chat, toServerSentEventsResponse } from '@tanstack\u002Fai'\nimport { openaiText } from '@tanstack\u002Fai-openai'\n\nexport async function POST(request: Request) {\n  const { messages } = await request.json()\n  const stream = chat({\n    adapter: openaiText('gpt-5.5'),\n    messages,\n    tools: [\n      shellTool({\n        environment: {\n          type: 'container_auto',\n          skills: [\n            { type: 'skill_reference', skill_id: 'skill_abc', version: '2' },\n          ],\n        },\n      }),\n    ],\n  })\n  return toServerSentEventsResponse(stream)\n}\n",[13612],{"type":67,"tag":100,"props":13613,"children":13614},{"__ignoreMap":97},[13615,13651,13694,13729,13736,13779,13822,13849,13888,13899,13914,13930,13946,13975,13990,14072,14083,14090,14105,14116,14127,14150],{"type":67,"tag":104,"props":13616,"children":13617},{"class":106,"line":107},[13618,13622,13626,13631,13635,13639,13643,13647],{"type":67,"tag":104,"props":13619,"children":13620},{"style":121},[13621],{"type":72,"value":124},{"type":67,"tag":104,"props":13623,"children":13624},{"style":127},[13625],{"type":72,"value":130},{"type":67,"tag":104,"props":13627,"children":13628},{"style":133},[13629],{"type":72,"value":13630}," shellTool",{"type":67,"tag":104,"props":13632,"children":13633},{"style":127},[13634],{"type":72,"value":141},{"type":67,"tag":104,"props":13636,"children":13637},{"style":121},[13638],{"type":72,"value":146},{"type":67,"tag":104,"props":13640,"children":13641},{"style":127},[13642],{"type":72,"value":151},{"type":67,"tag":104,"props":13644,"children":13645},{"style":154},[13646],{"type":72,"value":12898},{"type":67,"tag":104,"props":13648,"children":13649},{"style":127},[13650],{"type":72,"value":162},{"type":67,"tag":104,"props":13652,"children":13653},{"class":106,"line":117},[13654,13658,13662,13666,13670,13674,13678,13682,13686,13690],{"type":67,"tag":104,"props":13655,"children":13656},{"style":121},[13657],{"type":72,"value":124},{"type":67,"tag":104,"props":13659,"children":13660},{"style":127},[13661],{"type":72,"value":130},{"type":67,"tag":104,"props":13663,"children":13664},{"style":133},[13665],{"type":72,"value":1480},{"type":67,"tag":104,"props":13667,"children":13668},{"style":127},[13669],{"type":72,"value":661},{"type":67,"tag":104,"props":13671,"children":13672},{"style":133},[13673],{"type":72,"value":1489},{"type":67,"tag":104,"props":13675,"children":13676},{"style":127},[13677],{"type":72,"value":141},{"type":67,"tag":104,"props":13679,"children":13680},{"style":121},[13681],{"type":72,"value":146},{"type":67,"tag":104,"props":13683,"children":13684},{"style":127},[13685],{"type":72,"value":151},{"type":67,"tag":104,"props":13687,"children":13688},{"style":154},[13689],{"type":72,"value":157},{"type":67,"tag":104,"props":13691,"children":13692},{"style":127},[13693],{"type":72,"value":162},{"type":67,"tag":104,"props":13695,"children":13696},{"class":106,"line":165},[13697,13701,13705,13709,13713,13717,13721,13725],{"type":67,"tag":104,"props":13698,"children":13699},{"style":121},[13700],{"type":72,"value":124},{"type":67,"tag":104,"props":13702,"children":13703},{"style":127},[13704],{"type":72,"value":130},{"type":67,"tag":104,"props":13706,"children":13707},{"style":133},[13708],{"type":72,"value":1525},{"type":67,"tag":104,"props":13710,"children":13711},{"style":127},[13712],{"type":72,"value":141},{"type":67,"tag":104,"props":13714,"children":13715},{"style":121},[13716],{"type":72,"value":146},{"type":67,"tag":104,"props":13718,"children":13719},{"style":127},[13720],{"type":72,"value":151},{"type":67,"tag":104,"props":13722,"children":13723},{"style":154},[13724],{"type":72,"value":1542},{"type":67,"tag":104,"props":13726,"children":13727},{"style":127},[13728],{"type":72,"value":162},{"type":67,"tag":104,"props":13730,"children":13731},{"class":106,"line":203},[13732],{"type":67,"tag":104,"props":13733,"children":13734},{"emptyLinePlaceholder":207},[13735],{"type":72,"value":210},{"type":67,"tag":104,"props":13737,"children":13738},{"class":106,"line":213},[13739,13743,13747,13751,13755,13759,13763,13767,13771,13775],{"type":67,"tag":104,"props":13740,"children":13741},{"style":121},[13742],{"type":72,"value":219},{"type":67,"tag":104,"props":13744,"children":13745},{"style":222},[13746],{"type":72,"value":1639},{"type":67,"tag":104,"props":13748,"children":13749},{"style":222},[13750],{"type":72,"value":1644},{"type":67,"tag":104,"props":13752,"children":13753},{"style":238},[13754],{"type":72,"value":1649},{"type":67,"tag":104,"props":13756,"children":13757},{"style":127},[13758],{"type":72,"value":245},{"type":67,"tag":104,"props":13760,"children":13761},{"style":1159},[13762],{"type":72,"value":1658},{"type":67,"tag":104,"props":13764,"children":13765},{"style":127},[13766],{"type":72,"value":265},{"type":67,"tag":104,"props":13768,"children":13769},{"style":1665},[13770],{"type":72,"value":1668},{"type":67,"tag":104,"props":13772,"children":13773},{"style":127},[13774],{"type":72,"value":429},{"type":67,"tag":104,"props":13776,"children":13777},{"style":127},[13778],{"type":72,"value":1186},{"type":67,"tag":104,"props":13780,"children":13781},{"class":106,"line":253},[13782,13786,13790,13794,13798,13802,13806,13810,13814,13818],{"type":67,"tag":104,"props":13783,"children":13784},{"style":222},[13785],{"type":72,"value":1194},{"type":67,"tag":104,"props":13787,"children":13788},{"style":127},[13789],{"type":72,"value":130},{"type":67,"tag":104,"props":13791,"children":13792},{"style":133},[13793],{"type":72,"value":1692},{"type":67,"tag":104,"props":13795,"children":13796},{"style":127},[13797],{"type":72,"value":141},{"type":67,"tag":104,"props":13799,"children":13800},{"style":127},[13801],{"type":72,"value":1204},{"type":67,"tag":104,"props":13803,"children":13804},{"style":121},[13805],{"type":72,"value":1209},{"type":67,"tag":104,"props":13807,"children":13808},{"style":133},[13809],{"type":72,"value":1709},{"type":67,"tag":104,"props":13811,"children":13812},{"style":127},[13813],{"type":72,"value":336},{"type":67,"tag":104,"props":13815,"children":13816},{"style":238},[13817],{"type":72,"value":1718},{"type":67,"tag":104,"props":13819,"children":13820},{"style":257},[13821],{"type":72,"value":1723},{"type":67,"tag":104,"props":13823,"children":13824},{"class":106,"line":287},[13825,13829,13833,13837,13841,13845],{"type":67,"tag":104,"props":13826,"children":13827},{"style":222},[13828],{"type":72,"value":1194},{"type":67,"tag":104,"props":13830,"children":13831},{"style":133},[13832],{"type":72,"value":1735},{"type":67,"tag":104,"props":13834,"children":13835},{"style":127},[13836],{"type":72,"value":1204},{"type":67,"tag":104,"props":13838,"children":13839},{"style":238},[13840],{"type":72,"value":1480},{"type":67,"tag":104,"props":13842,"children":13843},{"style":257},[13844],{"type":72,"value":245},{"type":67,"tag":104,"props":13846,"children":13847},{"style":127},[13848],{"type":72,"value":250},{"type":67,"tag":104,"props":13850,"children":13851},{"class":106,"line":317},[13852,13856,13860,13864,13868,13872,13876,13880,13884],{"type":67,"tag":104,"props":13853,"children":13854},{"style":257},[13855],{"type":72,"value":1759},{"type":67,"tag":104,"props":13857,"children":13858},{"style":127},[13859],{"type":72,"value":265},{"type":67,"tag":104,"props":13861,"children":13862},{"style":238},[13863],{"type":72,"value":1525},{"type":67,"tag":104,"props":13865,"children":13866},{"style":257},[13867],{"type":72,"value":245},{"type":67,"tag":104,"props":13869,"children":13870},{"style":127},[13871],{"type":72,"value":279},{"type":67,"tag":104,"props":13873,"children":13874},{"style":154},[13875],{"type":72,"value":1780},{"type":67,"tag":104,"props":13877,"children":13878},{"style":127},[13879],{"type":72,"value":279},{"type":67,"tag":104,"props":13881,"children":13882},{"style":257},[13883],{"type":72,"value":429},{"type":67,"tag":104,"props":13885,"children":13886},{"style":127},[13887],{"type":72,"value":284},{"type":67,"tag":104,"props":13889,"children":13890},{"class":106,"line":352},[13891,13895],{"type":67,"tag":104,"props":13892,"children":13893},{"style":133},[13894],{"type":72,"value":1800},{"type":67,"tag":104,"props":13896,"children":13897},{"style":127},[13898],{"type":72,"value":284},{"type":67,"tag":104,"props":13900,"children":13901},{"class":106,"line":436},[13902,13906,13910],{"type":67,"tag":104,"props":13903,"children":13904},{"style":257},[13905],{"type":72,"value":1812},{"type":67,"tag":104,"props":13907,"children":13908},{"style":127},[13909],{"type":72,"value":265},{"type":67,"tag":104,"props":13911,"children":13912},{"style":257},[13913],{"type":72,"value":9815},{"type":67,"tag":104,"props":13915,"children":13916},{"class":106,"line":528},[13917,13922,13926],{"type":67,"tag":104,"props":13918,"children":13919},{"style":238},[13920],{"type":72,"value":13921},"      shellTool",{"type":67,"tag":104,"props":13923,"children":13924},{"style":257},[13925],{"type":72,"value":245},{"type":67,"tag":104,"props":13927,"children":13928},{"style":127},[13929],{"type":72,"value":250},{"type":67,"tag":104,"props":13931,"children":13932},{"class":106,"line":545},[13933,13938,13942],{"type":67,"tag":104,"props":13934,"children":13935},{"style":257},[13936],{"type":72,"value":13937},"        environment",{"type":67,"tag":104,"props":13939,"children":13940},{"style":127},[13941],{"type":72,"value":265},{"type":67,"tag":104,"props":13943,"children":13944},{"style":127},[13945],{"type":72,"value":1186},{"type":67,"tag":104,"props":13947,"children":13948},{"class":106,"line":578},[13949,13954,13958,13962,13967,13971],{"type":67,"tag":104,"props":13950,"children":13951},{"style":257},[13952],{"type":72,"value":13953},"          type",{"type":67,"tag":104,"props":13955,"children":13956},{"style":127},[13957],{"type":72,"value":265},{"type":67,"tag":104,"props":13959,"children":13960},{"style":127},[13961],{"type":72,"value":151},{"type":67,"tag":104,"props":13963,"children":13964},{"style":154},[13965],{"type":72,"value":13966},"container_auto",{"type":67,"tag":104,"props":13968,"children":13969},{"style":127},[13970],{"type":72,"value":279},{"type":67,"tag":104,"props":13972,"children":13973},{"style":127},[13974],{"type":72,"value":284},{"type":67,"tag":104,"props":13976,"children":13977},{"class":106,"line":609},[13978,13982,13986],{"type":67,"tag":104,"props":13979,"children":13980},{"style":257},[13981],{"type":72,"value":13319},{"type":67,"tag":104,"props":13983,"children":13984},{"style":127},[13985],{"type":72,"value":265},{"type":67,"tag":104,"props":13987,"children":13988},{"style":257},[13989],{"type":72,"value":9815},{"type":67,"tag":104,"props":13991,"children":13992},{"class":106,"line":732},[13993,13998,14002,14006,14010,14015,14019,14023,14027,14031,14035,14040,14044,14048,14052,14056,14060,14064,14068],{"type":67,"tag":104,"props":13994,"children":13995},{"style":127},[13996],{"type":72,"value":13997},"            {",{"type":67,"tag":104,"props":13999,"children":14000},{"style":257},[14001],{"type":72,"value":9535},{"type":67,"tag":104,"props":14003,"children":14004},{"style":127},[14005],{"type":72,"value":265},{"type":67,"tag":104,"props":14007,"children":14008},{"style":127},[14009],{"type":72,"value":151},{"type":67,"tag":104,"props":14011,"children":14012},{"style":154},[14013],{"type":72,"value":14014},"skill_reference",{"type":67,"tag":104,"props":14016,"children":14017},{"style":127},[14018],{"type":72,"value":279},{"type":67,"tag":104,"props":14020,"children":14021},{"style":127},[14022],{"type":72,"value":661},{"type":67,"tag":104,"props":14024,"children":14025},{"style":257},[14026],{"type":72,"value":13360},{"type":67,"tag":104,"props":14028,"children":14029},{"style":127},[14030],{"type":72,"value":265},{"type":67,"tag":104,"props":14032,"children":14033},{"style":127},[14034],{"type":72,"value":151},{"type":67,"tag":104,"props":14036,"children":14037},{"style":154},[14038],{"type":72,"value":14039},"skill_abc",{"type":67,"tag":104,"props":14041,"children":14042},{"style":127},[14043],{"type":72,"value":279},{"type":67,"tag":104,"props":14045,"children":14046},{"style":127},[14047],{"type":72,"value":661},{"type":67,"tag":104,"props":14049,"children":14050},{"style":257},[14051],{"type":72,"value":13386},{"type":67,"tag":104,"props":14053,"children":14054},{"style":127},[14055],{"type":72,"value":265},{"type":67,"tag":104,"props":14057,"children":14058},{"style":127},[14059],{"type":72,"value":151},{"type":67,"tag":104,"props":14061,"children":14062},{"style":154},[14063],{"type":72,"value":8119},{"type":67,"tag":104,"props":14065,"children":14066},{"style":127},[14067],{"type":72,"value":279},{"type":67,"tag":104,"props":14069,"children":14070},{"style":127},[14071],{"type":72,"value":8885},{"type":67,"tag":104,"props":14073,"children":14074},{"class":106,"line":745},[14075,14079],{"type":67,"tag":104,"props":14076,"children":14077},{"style":257},[14078],{"type":72,"value":9989},{"type":67,"tag":104,"props":14080,"children":14081},{"style":127},[14082],{"type":72,"value":284},{"type":67,"tag":104,"props":14084,"children":14085},{"class":106,"line":761},[14086],{"type":67,"tag":104,"props":14087,"children":14088},{"style":127},[14089],{"type":72,"value":13423},{"type":67,"tag":104,"props":14091,"children":14092},{"class":106,"line":774},[14093,14097,14101],{"type":67,"tag":104,"props":14094,"children":14095},{"style":127},[14096],{"type":72,"value":6882},{"type":67,"tag":104,"props":14098,"children":14099},{"style":257},[14100],{"type":72,"value":429},{"type":67,"tag":104,"props":14102,"children":14103},{"style":127},[14104],{"type":72,"value":284},{"type":67,"tag":104,"props":14106,"children":14107},{"class":106,"line":782},[14108,14112],{"type":67,"tag":104,"props":14109,"children":14110},{"style":257},[14111],{"type":72,"value":13443},{"type":67,"tag":104,"props":14113,"children":14114},{"style":127},[14115],{"type":72,"value":284},{"type":67,"tag":104,"props":14117,"children":14118},{"class":106,"line":815},[14119,14123],{"type":67,"tag":104,"props":14120,"children":14121},{"style":127},[14122],{"type":72,"value":534},{"type":67,"tag":104,"props":14124,"children":14125},{"style":257},[14126],{"type":72,"value":771},{"type":67,"tag":104,"props":14128,"children":14129},{"class":106,"line":844},[14130,14134,14138,14142,14146],{"type":67,"tag":104,"props":14131,"children":14132},{"style":121},[14133],{"type":72,"value":1288},{"type":67,"tag":104,"props":14135,"children":14136},{"style":238},[14137],{"type":72,"value":1489},{"type":67,"tag":104,"props":14139,"children":14140},{"style":257},[14141],{"type":72,"value":245},{"type":67,"tag":104,"props":14143,"children":14144},{"style":133},[14145],{"type":72,"value":1879},{"type":67,"tag":104,"props":14147,"children":14148},{"style":257},[14149],{"type":72,"value":771},{"type":67,"tag":104,"props":14151,"children":14152},{"class":106,"line":873},[14153],{"type":67,"tag":104,"props":14154,"children":14155},{"style":127},[14156],{"type":72,"value":1891},{"type":67,"tag":75,"props":14158,"children":14159},{},[14160,14166,14167,14173,14175,14181,14183,14189,14191,14197],{"type":67,"tag":100,"props":14161,"children":14163},{"className":14162},[],[14164],{"type":72,"value":14165},"SkillReference",{"type":72,"value":13499},{"type":67,"tag":100,"props":14168,"children":14170},{"className":14169},[],[14171],{"type":72,"value":14172},"{ type: 'skill_reference'; skill_id: string; version?: string }",{"type":72,"value":14174},". ",{"type":67,"tag":100,"props":14176,"children":14178},{"className":14177},[],[14179],{"type":72,"value":14180},"version",{"type":72,"value":14182}," is a string — use a positive integer as a string (e.g. ",{"type":67,"tag":100,"props":14184,"children":14186},{"className":14185},[],[14187],{"type":72,"value":14188},"'2'",{"type":72,"value":14190},") or ",{"type":67,"tag":100,"props":14192,"children":14194},{"className":14193},[],[14195],{"type":72,"value":14196},"'latest'",{"type":72,"value":14198},". This is Responses API only; Chat Completions does not support the shell tool.",{"type":67,"tag":3095,"props":14200,"children":14202},{"id":14201},"scope",[14203],{"type":72,"value":14204},"Scope",{"type":67,"tag":75,"props":14206,"children":14207},{},[14208,14210,14216,14217,14223,14225,14231],{"type":72,"value":14209},"Only hosted\u002Fmanaged-by-id skills (",{"type":67,"tag":100,"props":14211,"children":14213},{"className":14212},[],[14214],{"type":72,"value":14215},"type: 'anthropic'",{"type":72,"value":5490},{"type":67,"tag":100,"props":14218,"children":14220},{"className":14219},[],[14221],{"type":72,"value":14222},"type: 'custom'",{"type":72,"value":14224}," for Anthropic; ",{"type":67,"tag":100,"props":14226,"children":14228},{"className":14227},[],[14229],{"type":72,"value":14230},"type: 'skill_reference'",{"type":72,"value":14232}," for OpenAI) are wired. Inline bundles, local-path, and upload-API skill creation are not handled by these factories.",{"type":67,"tag":81,"props":14234,"children":14236},{"id":14235},"common-mistakes",[14237],{"type":72,"value":14238},"Common Mistakes",{"type":67,"tag":3095,"props":14240,"children":14242},{"id":14241},"a-high-not-passing-tool-definitions-to-both-server-and-client",[14243],{"type":72,"value":14244},"a. HIGH: Not passing tool definitions to both server and client",{"type":67,"tag":75,"props":14246,"children":14247},{},[14248,14250,14255,14257,14262,14264,14269,14271,14277],{"type":72,"value":14249},"Server tools need ",{"type":67,"tag":100,"props":14251,"children":14253},{"className":14252},[],[14254],{"type":72,"value":3127},{"type":72,"value":14256},". Client tools need their definition in\n",{"type":67,"tag":100,"props":14258,"children":14260},{"className":14259},[],[14261],{"type":72,"value":3127},{"type":72,"value":14263}," AND their ",{"type":67,"tag":100,"props":14265,"children":14267},{"className":14266},[],[14268],{"type":72,"value":3910},{"type":72,"value":14270}," in ",{"type":67,"tag":100,"props":14272,"children":14274},{"className":14273},[],[14275],{"type":72,"value":14276},"useChat({ tools: clientTools(...) })",{"type":72,"value":336},{"type":67,"tag":75,"props":14279,"children":14280},{},[14281],{"type":72,"value":14282},"Wrong -- tool only on server, client cannot execute:",{"type":67,"tag":93,"props":14284,"children":14286},{"className":95,"code":14285,"language":15,"meta":97,"style":97},"chat({ adapter, messages, tools: [myToolDef] })\nuseChat({ connection: fetchServerSentEvents('\u002Fapi\u002Fchat') }) \u002F\u002F no tools\n",[14287],{"type":67,"tag":100,"props":14288,"children":14289},{"__ignoreMap":97},[14290,14343],{"type":67,"tag":104,"props":14291,"children":14292},{"class":106,"line":107},[14293,14298,14302,14306,14310,14314,14318,14322,14326,14330,14335,14339],{"type":67,"tag":104,"props":14294,"children":14295},{"style":238},[14296],{"type":72,"value":14297},"chat",{"type":67,"tag":104,"props":14299,"children":14300},{"style":133},[14301],{"type":72,"value":245},{"type":67,"tag":104,"props":14303,"children":14304},{"style":127},[14305],{"type":72,"value":398},{"type":67,"tag":104,"props":14307,"children":14308},{"style":133},[14309],{"type":72,"value":10695},{"type":67,"tag":104,"props":14311,"children":14312},{"style":127},[14313],{"type":72,"value":661},{"type":67,"tag":104,"props":14315,"children":14316},{"style":133},[14317],{"type":72,"value":1692},{"type":67,"tag":104,"props":14319,"children":14320},{"style":127},[14321],{"type":72,"value":661},{"type":67,"tag":104,"props":14323,"children":14324},{"style":257},[14325],{"type":72,"value":2333},{"type":67,"tag":104,"props":14327,"children":14328},{"style":127},[14329],{"type":72,"value":265},{"type":67,"tag":104,"props":14331,"children":14332},{"style":133},[14333],{"type":72,"value":14334}," [myToolDef] ",{"type":67,"tag":104,"props":14336,"children":14337},{"style":127},[14338],{"type":72,"value":721},{"type":67,"tag":104,"props":14340,"children":14341},{"style":133},[14342],{"type":72,"value":771},{"type":67,"tag":104,"props":14344,"children":14345},{"class":106,"line":117},[14346,14350,14354,14358,14363,14367,14371,14375,14379,14383,14387,14391,14395,14399],{"type":67,"tag":104,"props":14347,"children":14348},{"style":238},[14349],{"type":72,"value":3918},{"type":67,"tag":104,"props":14351,"children":14352},{"style":133},[14353],{"type":72,"value":245},{"type":67,"tag":104,"props":14355,"children":14356},{"style":127},[14357],{"type":72,"value":398},{"type":67,"tag":104,"props":14359,"children":14360},{"style":257},[14361],{"type":72,"value":14362}," connection",{"type":67,"tag":104,"props":14364,"children":14365},{"style":127},[14366],{"type":72,"value":265},{"type":67,"tag":104,"props":14368,"children":14369},{"style":238},[14370],{"type":72,"value":2405},{"type":67,"tag":104,"props":14372,"children":14373},{"style":133},[14374],{"type":72,"value":245},{"type":67,"tag":104,"props":14376,"children":14377},{"style":127},[14378],{"type":72,"value":279},{"type":67,"tag":104,"props":14380,"children":14381},{"style":154},[14382],{"type":72,"value":2418},{"type":67,"tag":104,"props":14384,"children":14385},{"style":127},[14386],{"type":72,"value":279},{"type":67,"tag":104,"props":14388,"children":14389},{"style":133},[14390],{"type":72,"value":2659},{"type":67,"tag":104,"props":14392,"children":14393},{"style":127},[14394],{"type":72,"value":721},{"type":67,"tag":104,"props":14396,"children":14397},{"style":133},[14398],{"type":72,"value":2659},{"type":67,"tag":104,"props":14400,"children":14401},{"style":111},[14402],{"type":72,"value":14403},"\u002F\u002F no tools\n",{"type":67,"tag":75,"props":14405,"children":14406},{},[14407],{"type":72,"value":14408},"Wrong -- tool only on client, LLM does not know about it:",{"type":67,"tag":93,"props":14410,"children":14412},{"className":95,"code":14411,"language":15,"meta":97,"style":97},"chat({ adapter, messages }); \u002F\u002F no tools\nuseChat({ ..., tools: clientTools(myToolDef.client(() => result)) });\n",[14413],{"type":67,"tag":100,"props":14414,"children":14415},{"__ignoreMap":97},[14416,14462],{"type":67,"tag":104,"props":14417,"children":14418},{"class":106,"line":107},[14419,14423,14427,14431,14435,14439,14444,14448,14452,14457],{"type":67,"tag":104,"props":14420,"children":14421},{"style":238},[14422],{"type":72,"value":14297},{"type":67,"tag":104,"props":14424,"children":14425},{"style":133},[14426],{"type":72,"value":245},{"type":67,"tag":104,"props":14428,"children":14429},{"style":127},[14430],{"type":72,"value":398},{"type":67,"tag":104,"props":14432,"children":14433},{"style":133},[14434],{"type":72,"value":10695},{"type":67,"tag":104,"props":14436,"children":14437},{"style":127},[14438],{"type":72,"value":661},{"type":67,"tag":104,"props":14440,"children":14441},{"style":133},[14442],{"type":72,"value":14443}," messages ",{"type":67,"tag":104,"props":14445,"children":14446},{"style":127},[14447],{"type":72,"value":721},{"type":67,"tag":104,"props":14449,"children":14450},{"style":133},[14451],{"type":72,"value":429},{"type":67,"tag":104,"props":14453,"children":14454},{"style":127},[14455],{"type":72,"value":14456},";",{"type":67,"tag":104,"props":14458,"children":14459},{"style":111},[14460],{"type":72,"value":14461}," \u002F\u002F no tools\n",{"type":67,"tag":104,"props":14463,"children":14464},{"class":106,"line":117},[14465,14469,14473,14477,14482,14486,14490,14494,14499,14503,14507,14511,14515,14519,14524,14528,14532],{"type":67,"tag":104,"props":14466,"children":14467},{"style":238},[14468],{"type":72,"value":3918},{"type":67,"tag":104,"props":14470,"children":14471},{"style":133},[14472],{"type":72,"value":245},{"type":67,"tag":104,"props":14474,"children":14475},{"style":127},[14476],{"type":72,"value":398},{"type":67,"tag":104,"props":14478,"children":14479},{"style":127},[14480],{"type":72,"value":14481}," ...,",{"type":67,"tag":104,"props":14483,"children":14484},{"style":257},[14485],{"type":72,"value":2333},{"type":67,"tag":104,"props":14487,"children":14488},{"style":127},[14489],{"type":72,"value":265},{"type":67,"tag":104,"props":14491,"children":14492},{"style":238},[14493],{"type":72,"value":2342},{"type":67,"tag":104,"props":14495,"children":14496},{"style":133},[14497],{"type":72,"value":14498},"(myToolDef",{"type":67,"tag":104,"props":14500,"children":14501},{"style":127},[14502],{"type":72,"value":336},{"type":67,"tag":104,"props":14504,"children":14505},{"style":238},[14506],{"type":72,"value":2210},{"type":67,"tag":104,"props":14508,"children":14509},{"style":133},[14510],{"type":72,"value":245},{"type":67,"tag":104,"props":14512,"children":14513},{"style":127},[14514],{"type":72,"value":380},{"type":67,"tag":104,"props":14516,"children":14517},{"style":222},[14518],{"type":72,"value":1181},{"type":67,"tag":104,"props":14520,"children":14521},{"style":133},[14522],{"type":72,"value":14523}," result)) ",{"type":67,"tag":104,"props":14525,"children":14526},{"style":127},[14527],{"type":72,"value":721},{"type":67,"tag":104,"props":14529,"children":14530},{"style":133},[14531],{"type":72,"value":429},{"type":67,"tag":104,"props":14533,"children":14534},{"style":127},[14535],{"type":72,"value":2013},{"type":67,"tag":75,"props":14537,"children":14538},{},[14539],{"type":72,"value":14540},"Correct:",{"type":67,"tag":93,"props":14542,"children":14544},{"className":95,"code":14543,"language":15,"meta":97,"style":97},"chat({ adapter, messages, tools: [myToolDef] });\nuseChat({ ..., tools: clientTools(myToolDef.client((input) => ({ success: true }))) });\n",[14545],{"type":67,"tag":100,"props":14546,"children":14547},{"__ignoreMap":97},[14548,14603],{"type":67,"tag":104,"props":14549,"children":14550},{"class":106,"line":107},[14551,14555,14559,14563,14567,14571,14575,14579,14583,14587,14591,14595,14599],{"type":67,"tag":104,"props":14552,"children":14553},{"style":238},[14554],{"type":72,"value":14297},{"type":67,"tag":104,"props":14556,"children":14557},{"style":133},[14558],{"type":72,"value":245},{"type":67,"tag":104,"props":14560,"children":14561},{"style":127},[14562],{"type":72,"value":398},{"type":67,"tag":104,"props":14564,"children":14565},{"style":133},[14566],{"type":72,"value":10695},{"type":67,"tag":104,"props":14568,"children":14569},{"style":127},[14570],{"type":72,"value":661},{"type":67,"tag":104,"props":14572,"children":14573},{"style":133},[14574],{"type":72,"value":1692},{"type":67,"tag":104,"props":14576,"children":14577},{"style":127},[14578],{"type":72,"value":661},{"type":67,"tag":104,"props":14580,"children":14581},{"style":257},[14582],{"type":72,"value":2333},{"type":67,"tag":104,"props":14584,"children":14585},{"style":127},[14586],{"type":72,"value":265},{"type":67,"tag":104,"props":14588,"children":14589},{"style":133},[14590],{"type":72,"value":14334},{"type":67,"tag":104,"props":14592,"children":14593},{"style":127},[14594],{"type":72,"value":721},{"type":67,"tag":104,"props":14596,"children":14597},{"style":133},[14598],{"type":72,"value":429},{"type":67,"tag":104,"props":14600,"children":14601},{"style":127},[14602],{"type":72,"value":2013},{"type":67,"tag":104,"props":14604,"children":14605},{"class":106,"line":117},[14606,14610,14614,14618,14622,14626,14630,14634,14638,14642,14646,14650,14654,14658,14662,14666,14670,14674,14678,14682,14686,14690,14695,14699,14703],{"type":67,"tag":104,"props":14607,"children":14608},{"style":238},[14609],{"type":72,"value":3918},{"type":67,"tag":104,"props":14611,"children":14612},{"style":133},[14613],{"type":72,"value":245},{"type":67,"tag":104,"props":14615,"children":14616},{"style":127},[14617],{"type":72,"value":398},{"type":67,"tag":104,"props":14619,"children":14620},{"style":127},[14621],{"type":72,"value":14481},{"type":67,"tag":104,"props":14623,"children":14624},{"style":257},[14625],{"type":72,"value":2333},{"type":67,"tag":104,"props":14627,"children":14628},{"style":127},[14629],{"type":72,"value":265},{"type":67,"tag":104,"props":14631,"children":14632},{"style":238},[14633],{"type":72,"value":2342},{"type":67,"tag":104,"props":14635,"children":14636},{"style":133},[14637],{"type":72,"value":14498},{"type":67,"tag":104,"props":14639,"children":14640},{"style":127},[14641],{"type":72,"value":336},{"type":67,"tag":104,"props":14643,"children":14644},{"style":238},[14645],{"type":72,"value":2210},{"type":67,"tag":104,"props":14647,"children":14648},{"style":133},[14649],{"type":72,"value":245},{"type":67,"tag":104,"props":14651,"children":14652},{"style":127},[14653],{"type":72,"value":245},{"type":67,"tag":104,"props":14655,"children":14656},{"style":1159},[14657],{"type":72,"value":2223},{"type":67,"tag":104,"props":14659,"children":14660},{"style":127},[14661],{"type":72,"value":429},{"type":67,"tag":104,"props":14663,"children":14664},{"style":222},[14665],{"type":72,"value":1181},{"type":67,"tag":104,"props":14667,"children":14668},{"style":133},[14669],{"type":72,"value":1341},{"type":67,"tag":104,"props":14671,"children":14672},{"style":127},[14673],{"type":72,"value":398},{"type":67,"tag":104,"props":14675,"children":14676},{"style":257},[14677],{"type":72,"value":5883},{"type":67,"tag":104,"props":14679,"children":14680},{"style":127},[14681],{"type":72,"value":265},{"type":67,"tag":104,"props":14683,"children":14684},{"style":2291},[14685],{"type":72,"value":2294},{"type":67,"tag":104,"props":14687,"children":14688},{"style":127},[14689],{"type":72,"value":141},{"type":67,"tag":104,"props":14691,"children":14692},{"style":133},[14693],{"type":72,"value":14694},"))) ",{"type":67,"tag":104,"props":14696,"children":14697},{"style":127},[14698],{"type":72,"value":721},{"type":67,"tag":104,"props":14700,"children":14701},{"style":133},[14702],{"type":72,"value":429},{"type":67,"tag":104,"props":14704,"children":14705},{"style":127},[14706],{"type":72,"value":2013},{"type":67,"tag":75,"props":14708,"children":14709},{},[14710],{"type":72,"value":14711},"Source: docs\u002Ftools\u002Ftools.md",{"type":67,"tag":81,"props":14713,"children":14715},{"id":14714},"cross-references",[14716],{"type":72,"value":14717},"Cross-References",{"type":67,"tag":11864,"props":14719,"children":14720},{},[14721,14726],{"type":67,"tag":11868,"props":14722,"children":14723},{},[14724],{"type":72,"value":14725},"See also: ai-core\u002Fchat-experience\u002FSKILL.md -- Tools are used within chat",{"type":67,"tag":11868,"props":14727,"children":14728},{},[14729,14731,14737],{"type":72,"value":14730},"See also: ",{"type":67,"tag":100,"props":14732,"children":14734},{"className":14733},[],[14735],{"type":72,"value":14736},"@tanstack\u002Fai-code-mode",{"type":72,"value":14738}," package skills -- Code Mode is an alternative to tools for complex multi-step operations",{"type":67,"tag":14740,"props":14741,"children":14742},"style",{},[14743],{"type":72,"value":14744},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":14746,"total":14888},[14747,14763,14775,14787,14802,14814,14824,14834,14847,14857,14868,14878],{"slug":14748,"name":14748,"fn":14749,"description":14750,"org":14751,"tags":14752,"stars":14760,"repoUrl":14761,"updatedAt":14762},"aggregation","perform data aggregation in TanStack Table","Aggregate TanStack Table columns independently of grouping, including grand totals, caller-selected row totals, multiple keyed aggregations, custom context-based definitions, grouped merges, manual values, and worker constraints.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[14753,14756,14759],{"name":14754,"slug":14755,"type":16},"Data Analysis","data-analysis",{"name":14757,"slug":14758,"type":16},"Frontend","frontend",{"name":10,"slug":9,"type":16},28175,"https:\u002F\u002Fgithub.com\u002FTanStack\u002Ftable","2026-07-30T05:25:59.429787",{"slug":14764,"name":14764,"fn":14765,"description":14766,"org":14767,"tags":14768,"stars":14760,"repoUrl":14761,"updatedAt":14774},"api-not-found","diagnose TanStack Table API errors","Diagnose missing TanStack Table v9 exports, options, state slices, and instance methods. Load before inventing an API when code sees a type error, undefined feature method, absent object key, adapter mismatch, or v8-shaped example.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[14769,14772,14773],{"name":14770,"slug":14771,"type":16},"Debugging","debugging",{"name":14757,"slug":14758,"type":16},{"name":10,"slug":9,"type":16},"2026-07-30T05:26:05.418735",{"slug":14776,"name":14776,"fn":14777,"description":14778,"org":14779,"tags":14780,"stars":14760,"repoUrl":14761,"updatedAt":14786},"cell-selection","select rectangular cell ranges in tables","Select rectangular cell ranges with cellSelectionFeature: two-corner range state keyed by row and column id, mousedown\u002Fmouseenter handlers, selection edges, render-order resolution under pinning, and autoResetCellSelection. Load when ranges widen unexpectedly after sorting or column reordering, when a drag re-renders the whole table, or when building copy-to-clipboard from a selection.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[14781,14782,14783],{"name":14754,"slug":14755,"type":16},{"name":10,"slug":9,"type":16},{"name":14784,"slug":14785,"type":16},"UI Components","ui-components","2026-07-30T05:25:38.403427",{"slug":14788,"name":14788,"fn":14789,"description":14790,"org":14791,"tags":14792,"stars":14760,"repoUrl":14761,"updatedAt":14801},"client-vs-server","manage TanStack Table data pipelines","Choose client or server ownership for filtering, grouping, sorting, expanding, and pagination in TanStack Table v9. Load for manual* flags, mixed pipelines, server counts, or deciding which dataset each row-model stage receives.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[14793,14796,14797,14800],{"name":14794,"slug":14795,"type":16},"Data Pipeline","data-pipeline",{"name":14757,"slug":14758,"type":16},{"name":14798,"slug":14799,"type":16},"Performance","performance",{"name":10,"slug":9,"type":16},"2026-07-30T05:25:45.400104",{"slug":14803,"name":14803,"fn":14804,"description":14805,"org":14806,"tags":14807,"stars":14760,"repoUrl":14761,"updatedAt":14813},"column-faceting","build faceted filter UIs","Build faceted filter UIs with columnFacetingFeature, facetedRowModel, facetedUniqueValues, and facetedMinMaxValues. Load for facet counts, numeric ranges, own-filter exclusion, or server-page facet completeness.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[14808,14811,14812],{"name":14809,"slug":14810,"type":16},"Data Visualization","data-visualization",{"name":14757,"slug":14758,"type":16},{"name":10,"slug":9,"type":16},"2026-07-30T05:25:41.397257",{"slug":14815,"name":14815,"fn":14816,"description":14817,"org":14818,"tags":14819,"stars":14760,"repoUrl":14761,"updatedAt":14823},"column-filtering","implement column filtering in TanStack Table","Filter columns with columnFilteringFeature, filteredRowModel, filterFns, filterMeta, nested-row direction, and manualFiltering. Load for accessor compatibility, controlled filter updaters, fuzzy metadata, or client\u002Fserver ownership.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[14820,14821,14822],{"name":14754,"slug":14755,"type":16},{"name":14757,"slug":14758,"type":16},{"name":10,"slug":9,"type":16},"2026-07-30T05:25:53.391632",{"slug":14825,"name":14825,"fn":14826,"description":14827,"org":14828,"tags":14829,"stars":14760,"repoUrl":14761,"updatedAt":14833},"column-ordering","manage TanStack Table column ordering","Control TanStack Table v9 leaf columnOrder with stable IDs while accounting for pinning regions, visibility, and groupedColumnMode precedence. Load for drag-and-drop columns or rendered order that differs from state.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[14830,14831,14832],{"name":14757,"slug":14758,"type":16},{"name":10,"slug":9,"type":16},{"name":14784,"slug":14785,"type":16},"2026-07-30T05:26:03.37801",{"slug":14835,"name":14835,"fn":14836,"description":14837,"org":14838,"tags":14839,"stars":14760,"repoUrl":14761,"updatedAt":14846},"column-pinning","configure column pinning in TanStack Table","Pin columns into logical start, center, and end regions with columnPinningFeature and renderer-owned sticky CSS. Load for RTL offsets, z-index, backgrounds, overflow, widths, gaps, or overlaps.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[14840,14843,14844,14845],{"name":14841,"slug":14842,"type":16},"CSS","css",{"name":14757,"slug":14758,"type":16},{"name":10,"slug":9,"type":16},{"name":14784,"slug":14785,"type":16},"2026-07-30T05:25:55.377366",{"slug":14848,"name":14848,"fn":14849,"description":14850,"org":14851,"tags":14852,"stars":14760,"repoUrl":14761,"updatedAt":14856},"column-resizing","implement column resizing in TanStack Table","Wire columnResizingFeature, header.getResizeHandler, resize mode and direction, pointer or touch events, and performant CSS-variable updates. Load when resize state changes but widths do not, or large tables resize slowly.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[14853,14854,14855],{"name":14757,"slug":14758,"type":16},{"name":10,"slug":9,"type":16},{"name":14784,"slug":14785,"type":16},"2026-07-30T05:25:51.400011",{"slug":14858,"name":14858,"fn":14859,"description":14860,"org":14861,"tags":14862,"stars":14760,"repoUrl":14761,"updatedAt":14867},"column-sizing","configure column sizing in TanStack Table","Use columnSizingFeature numeric size, minSize, maxSize, getSize, getStart, getAfter, and total-size APIs in table, grid, or flex CSS. Load for auto or percentage misconceptions and sizing\u002Fpinning layout mismatch.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[14863,14864,14865,14866],{"name":14841,"slug":14842,"type":16},{"name":14757,"slug":14758,"type":16},{"name":10,"slug":9,"type":16},{"name":14784,"slug":14785,"type":16},"2026-07-30T05:25:48.703799",{"slug":14869,"name":14869,"fn":14870,"description":14871,"org":14872,"tags":14873,"stars":14760,"repoUrl":14761,"updatedAt":14877},"column-visibility","manage column visibility in TanStack Table","Hide columns with columnVisibilityFeature while rendering visibility-aware header, column, and cell collections. Load when hidden columns remain in the DOM, false-versus-absent state is confused, or enableHiding is misunderstood.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[14874,14875,14876],{"name":14757,"slug":14758,"type":16},{"name":10,"slug":9,"type":16},{"name":14784,"slug":14785,"type":16},"2026-07-30T05:25:47.367943",{"slug":14879,"name":14879,"fn":14880,"description":14881,"org":14882,"tags":14883,"stars":14760,"repoUrl":14761,"updatedAt":14887},"core","build data grids with TanStack Table","Use TanStack Table v9 as a headless data-grid state and row-processing engine. Load for first-table architecture, stable data and columns, row numbering with getDisplayIndex, semantic rendering, framework adapter choice, or deciding what Table owns versus the renderer.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[14884,14885,14886],{"name":14754,"slug":14755,"type":16},{"name":14757,"slug":14758,"type":16},{"name":14784,"slug":14785,"type":16},"2026-07-30T05:25:52.366295",125,{"items":14890,"total":2523},[14891,14907,14922,14937,14948,14960,14974],{"slug":14892,"name":14892,"fn":14893,"description":14894,"org":14895,"tags":14896,"stars":24,"repoUrl":25,"updatedAt":14906},"ai-code-mode","execute sandboxed TypeScript code with LLMs","LLM-generated TypeScript execution in sandboxed environments: createCodeModeTool() with isolate drivers (createNodeIsolateDriver, createQuickJSIsolateDriver, createCloudflareIsolateDriver), codeModeWithSkills() for persistent skill libraries, trust strategies, skill storage (FileSystem, LocalStorage, InMemory, Mongo), client-side execution progress via code_mode:* custom events in useChat.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[14897,14898,14901,14904,14905],{"name":18,"slug":19,"type":16},{"name":14899,"slug":14900,"type":16},"Code Execution","code-execution",{"name":14902,"slug":14903,"type":16},"Sandboxing","sandboxing",{"name":10,"slug":9,"type":16},{"name":14,"slug":15,"type":16},"2026-07-16T06:04:13.597905",{"slug":14908,"name":14908,"fn":14909,"description":14910,"org":14911,"tags":14912,"stars":24,"repoUrl":25,"updatedAt":14921},"ai-core","configure TanStack AI agent features","Entry point for TanStack AI skills. Routes to chat-experience, tool-calling, media-generation, structured-outputs, adapter-configuration, ag-ui-protocol, middleware, locks, custom-backend-integration, and debug-logging, plus the skills shipped by companion packages (@tanstack\u002Fai-persistence, @tanstack\u002Fai-code-mode). Use chat() not streamText(), openaiText() not createOpenAI(), toServerSentEventsResponse() not manual SSE, middleware hooks not onEnd callbacks.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[14913,14916,14918],{"name":14914,"slug":14915,"type":16},"Agents","agents",{"name":14917,"slug":30,"type":16},"AI",{"name":14919,"slug":14920,"type":16},"Middleware","middleware","2026-07-30T05:26:10.404565",{"slug":14923,"name":14924,"fn":14925,"description":14926,"org":14927,"tags":14928,"stars":24,"repoUrl":25,"updatedAt":14936},"ai-coreadapter-configuration","ai-core\u002Fadapter-configuration","configure AI provider adapters","Provider adapter selection and configuration: openaiText, anthropicText, geminiText, ollamaText, grokText, groqText, openRouterText, bedrockText, openaiCompatible. Per-model type safety with modelOptions, reasoning\u002Fthinking configuration, runtime adapter switching, extendAdapter() for custom models, createModel(). Generic OpenAI-compatible providers (DeepSeek, Together, Fireworks, etc.) via openaiCompatible({ baseURL, apiKey, models }) from @tanstack\u002Fai-openai\u002Fcompatible. API key env vars: OPENAI_API_KEY, ANTHROPIC_API_KEY, GOOGLE_API_KEY\u002FGEMINI_API_KEY, XAI_API_KEY, GROQ_API_KEY, OPENROUTER_API_KEY, OLLAMA_HOST, BEDROCK_API_KEY (or AWS_BEARER_TOKEN_BEDROCK).\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[14929,14930,14933,14935],{"name":18,"slug":19,"type":16},{"name":14931,"slug":14932,"type":16},"Configuration","configuration",{"name":14934,"slug":37,"type":16},"LLM",{"name":10,"slug":9,"type":16},"2026-07-16T06:04:17.82075",{"slug":14938,"name":14939,"fn":14940,"description":14941,"org":14942,"tags":14943,"stars":24,"repoUrl":25,"updatedAt":14947},"ai-coreag-ui-protocol","ai-core\u002Fag-ui-protocol","implement TanStack AI streaming protocol","Server-side AG-UI streaming protocol implementation: StreamChunk event types (RUN_STARTED, TEXT_MESSAGE_START\u002FCONTENT\u002FEND, TOOL_CALL_START\u002FARGS\u002FEND, RUN_FINISHED, RUN_ERROR, STEP_STARTED\u002FSTEP_FINISHED, STATE_SNAPSHOT\u002FDELTA, CUSTOM), toServerSentEventsStream() for SSE format, toHttpStream() for NDJSON format. For backends serving AG-UI events without client packages.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[14944,14945,14946],{"name":21,"slug":22,"type":16},{"name":14934,"slug":37,"type":16},{"name":10,"slug":9,"type":16},"2026-07-16T06:04:10.093367",{"slug":14949,"name":14950,"fn":14951,"description":14952,"org":14953,"tags":14954,"stars":24,"repoUrl":25,"updatedAt":14959},"ai-corechat-experience","ai-core\u002Fchat-experience","implement chat experiences with TanStack AI","End-to-end chat implementation: server endpoint with chat() and toServerSentEventsResponse(), client-side useChat hook with fetchServerSentEvents(), message rendering with UIMessage parts, multimodal content, thinking\u002Freasoning display. Covers streaming states, connection adapters, and message format conversions. NOT Vercel AI SDK — uses chat() not streamText().\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[14955,14956,14957,14958],{"name":21,"slug":22,"type":16},{"name":14757,"slug":14758,"type":16},{"name":14934,"slug":37,"type":16},{"name":10,"slug":9,"type":16},"2026-07-30T05:26:11.505241",{"slug":14961,"name":14962,"fn":14963,"description":14964,"org":14965,"tags":14966,"stars":24,"repoUrl":25,"updatedAt":14973},"ai-coreclient-persistence","ai-core\u002Fclient-persistence","implement browser chat persistence for TanStack AI","Browser chat persistence on useChat \u002F ChatClient: localStoragePersistence, sessionStoragePersistence, indexedDBPersistence. Client-authoritative (adapter, full transcript) vs server-authoritative (persistence: true, no client cache). Reload restore, pending interrupts, mid-stream rejoin with delivery durability. Use for SPA reload durability — NOT server history alone. No extra package: the adapters ship in the framework packages.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[14967,14968,14969,14972],{"name":14917,"slug":30,"type":16},{"name":14757,"slug":14758,"type":16},{"name":14970,"slug":14971,"type":16},"Persistence","persistence",{"name":10,"slug":9,"type":16},"2026-07-30T05:53:35.503176",{"slug":14975,"name":14976,"fn":14977,"description":14978,"org":14979,"tags":14980,"stars":24,"repoUrl":25,"updatedAt":14987},"ai-corecustom-backend-integration","ai-core\u002Fcustom-backend-integration","integrate custom backends with TanStack AI","Connect useChat to a non-TanStack-AI backend through custom connection adapters. ConnectConnectionAdapter (single async iterable) vs SubscribeConnectionAdapter (separate subscribe\u002Fsend). Customize fetchServerSentEvents() and fetchHttpStream() with auth headers, custom URLs, and request options. Import from framework package, not @tanstack\u002Fai-client.\n",{"slug":9,"name":10,"logoUrl":11,"githubOrg":10},[14981,14982,14983,14986],{"name":14917,"slug":30,"type":16},{"name":21,"slug":22,"type":16},{"name":14984,"slug":14985,"type":16},"Backend","backend",{"name":10,"slug":9,"type":16},"2026-07-17T06:06:39.855351"]