[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-tanstack-ai-mcp":3,"mdc--x5u8gk-key":53,"related-repo-tanstack-ai-mcp":13029,"related-org-tanstack-ai-mcp":13131},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":11,"stars":23,"repoUrl":24,"updatedAt":25,"license":26,"forks":27,"topics":28,"repo":48,"sourceUrl":51,"mdContent":52},"ai-mcp","connect and run MCP tools","Host-side Model Context Protocol (MCP) client for TanStack AI: connect to external MCP servers, discover and run their tools inside any adapter's chat() loop, read resources and prompts, generate TypeScript types (typed tool names\u002Fpool keys) with the bundled CLI, and manage lifecycle with close()\u002Fawait using.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},"tanstack","TanStack","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Ftanstack.png",[12,16,19,22],{"name":13,"slug":14,"type":15},"MCP","mcp","tag",{"name":17,"slug":18,"type":15},"Agents","agents",{"name":20,"slug":21,"type":15},"AI Infrastructure","ai-infrastructure",{"name":9,"slug":8,"type":15},2884,"https:\u002F\u002Fgithub.com\u002FTanStack\u002Fai","2026-07-16T06:04:30.739067",null,269,[29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,8,44,45,46,47],"ai","ai-agents","ai-sdk","anthropic","chatbot","function-calling","gemini","generative-ai","llm","multimodal","openai","react","solidjs","streaming","svelte","tool-calling","typescript","typescript-sdk","vue",{"repoUrl":24,"stars":23,"forks":27,"topics":49,"description":50},[29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,8,44,45,46,47],"🤖 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-mcp\u002Fskills\u002Fai-mcp","---\nname: ai-mcp\ndescription: >\n  Host-side Model Context Protocol (MCP) client for TanStack AI: connect to\n  external MCP servers, discover and run their tools inside any adapter's\n  chat() loop, read resources and prompts, generate TypeScript types (typed tool names\u002Fpool keys)\n  with the bundled CLI, and manage lifecycle with close()\u002Fawait using.\ntype: sub-skill\nlibrary: tanstack-ai\nlibrary_version: '0.10.0'\nsources:\n  - 'TanStack\u002Fai:docs\u002Ftools\u002Fmcp.md'\n  - 'TanStack\u002Fai:packages\u002Fai-mcp\u002Fsrc\u002Fclient.ts'\n  - 'TanStack\u002Fai:packages\u002Fai-mcp\u002Fsrc\u002Fpool.ts'\n  - 'TanStack\u002Fai:packages\u002Fai-mcp\u002Fsrc\u002Fresources.ts'\n  - 'TanStack\u002Fai:packages\u002Fai-mcp\u002Fsrc\u002Ftransport.ts'\n---\n\n# `@tanstack\u002Fai-mcp`\n\nThis skill covers the `@tanstack\u002Fai-mcp` package. Read `ai-core\u002Ftool-calling\u002FSKILL.md`\nfirst — MCP tools flow into `chat()` the same way hand-written tools do.\n\n## When to use this package\n\nUse `@tanstack\u002Fai-mcp` when:\n\n- A third-party MCP server exposes tools you want an agent or chat loop to call.\n- You want to read MCP server resources (files, text, data) or prompts into a\n  `chat()` message list.\n- You want generated TypeScript types for an external MCP server's tool\n  signatures (via the bundled `generate` CLI).\n- You are running tool execution on the server side and want to connect to MCP\n  servers with HTTP (Streamable HTTP or SSE) or stdio transports.\n\nDo NOT use this package for browser\u002Fclient-side code — MCP connections are\nserver-side only.\n\n## Install\n\n```bash\npnpm add @tanstack\u002Fai-mcp\n```\n\nThe package has two subpath exports:\n\n- `.` — main client API (`createMCPClient`, `createMCPClients`, converters, types)\n- `.\u002Fstdio` — Node-only stdio transport factory (`stdioTransport`); import it\n  separately so edge bundles stay clean\n\n## `createMCPClient` — single server\n\n```typescript\nimport { createMCPClient } from '@tanstack\u002Fai-mcp'\n\nconst client = await createMCPClient({\n  transport: { type: 'http', url: 'https:\u002F\u002Fmcp.example.com\u002Fmcp' },\n  prefix: 'weather', \u002F\u002F optional: prefixes all tool names (e.g. 'weather_get_forecast')\n  name: 'my-app', \u002F\u002F optional: client identity sent to the server\n})\n```\n\n`createMCPClient` connects immediately and returns an `MCPClient`. Throws\n`MCPConnectionError` if the connection fails.\n\n### Transports\n\n#### Streamable HTTP (default for internet-facing servers)\n\n```typescript\nconst client = await createMCPClient({\n  transport: {\n    type: 'http',\n    url: 'https:\u002F\u002Fmcp.example.com\u002Fmcp',\n    headers: { Authorization: 'Bearer sk-...' },\n  },\n})\n```\n\n#### SSE\n\n```typescript\nconst client = await createMCPClient({\n  transport: {\n    type: 'sse',\n    url: 'https:\u002F\u002Fmcp.example.com\u002Fsse',\n    headers: { Authorization: 'Bearer sk-...' },\n  },\n})\n```\n\n#### stdio (Node-only — import from `\u002Fstdio` subpath)\n\n```typescript\nimport { createMCPClient } from '@tanstack\u002Fai-mcp'\nimport { stdioTransport } from '@tanstack\u002Fai-mcp\u002Fstdio'\n\nconst client = await createMCPClient({\n  transport: stdioTransport({\n    command: 'npx',\n    args: ['-y', 'my-mcp-server'],\n    env: { API_KEY: process.env.API_KEY ?? '' },\n  }),\n})\n```\n\n#### Custom transport (escape hatch)\n\nPass any SDK `Transport` instance directly:\n\n```typescript\nimport { createMCPClient } from '@tanstack\u002Fai-mcp'\nimport { InMemoryTransport } from '@modelcontextprotocol\u002Fsdk\u002FinMemory.js'\n\nconst [clientTransport] = InMemoryTransport.createLinkedPair()\nconst client = await createMCPClient({ transport: clientTransport })\n```\n\n### Authentication\n\nTwo levels:\n\n- **Static tokens** — pass `headers` on the `http`\u002F`sse` config (sent with\n  every request): `headers: { Authorization: 'Bearer ...' }`.\n- **OAuth 2.1 (MCP authorization spec)** — pass `authProvider` on the\n  `http`\u002F`sse` config. It accepts any `OAuthClientProvider` from\n  `@modelcontextprotocol\u002Fsdk\u002Fclient\u002Fauth.js`; the SDK transport attaches\n  tokens, refreshes them, and retries on 401.\n\n```typescript\nimport { createMCPClient } from '@tanstack\u002Fai-mcp'\nimport type { OAuthClientProvider } from '@modelcontextprotocol\u002Fsdk\u002Fclient\u002Fauth.js'\n\ndeclare const myOAuthProvider: OAuthClientProvider \u002F\u002F backed by stored tokens\n\nconst client = await createMCPClient({\n  transport: {\n    type: 'http',\n    url: 'https:\u002F\u002Fmcp.example.com\u002Fmcp',\n    authProvider: myOAuthProvider,\n  },\n})\n```\n\nCaveat: interactive authorization-code flows need `transport.finishAuth(code)`,\nand `createMCPClient` does not expose its internal transport. For redirect\nflows, construct the `StreamableHTTPClientTransport` yourself with the\n`authProvider`, keep a reference, call `finishAuth(code)` in the OAuth\ncallback route, then pass the transport via the escape hatch above. For\nserver-side providers backed by pre-provisioned\u002Frefreshable tokens, the\nconfig form is sufficient.\n\n## Three type-safety modes\n\n### Mode 1 — Auto-discovery (no types needed)\n\n`client.tools()` lists every tool the server exposes. Args are typed `unknown`\nat compile time but the tool's JSON Schema is forwarded to the LLM.\n\n```typescript\nconst tools = await client.tools()\n\u002F\u002F tools: ServerTool[]  (args unknown)\n\nconst stream = chat({\n  adapter: openaiText('gpt-5.5'),\n  messages,\n  tools,\n})\n```\n\nUse `{ lazy: true }` to defer schema sending via the existing `LazyToolManager`:\n\n```typescript\nconst tools = await client.tools({ lazy: true })\n```\n\n### Mode 2 — Typed via `toolDefinition` instances\n\nPass bare `toolDefinition()` instances (no `.server()` call) to `client.tools([...])`.\nThe MCP client binds a `callTool` proxy as the execute function while\ninput\u002Foutput validation and TypeScript types come from the definitions' Zod schemas.\nOnly the named tools are returned (allowlist = the definitions' `name`s).\nThrows `MCPToolNotFoundError` if the server does not expose a tool with that name.\n\n```typescript\nimport { toolDefinition } from '@tanstack\u002Fai'\nimport { createMCPClient } from '@tanstack\u002Fai-mcp'\nimport { z } from 'zod'\n\nconst getWeatherDef = 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 client = await createMCPClient({\n  transport: { type: 'http', url: 'https:\u002F\u002Fmcp.example.com\u002Fmcp' },\n})\n\n\u002F\u002F Returns MappedServerTools\u003Ctypeof defs> — fully typed per definition.\nconst tools = await client.tools([getWeatherDef])\n```\n\n### Mode 3 — Generated types (via `generate` CLI)\n\nRun `npx @tanstack\u002Fai-mcp generate` to introspect live servers and emit a\n`ServerDescriptor` interface per server. Pass the generated interface as the\ngeneric to `createMCPClient\u003CWeatherServer>(...)` to narrow discovered tool\nnames to the server's literals (args stay untyped — use Mode 2 for typed args).\n\nSee the \"Codegen CLI\" section below for details.\n\n## Lifecycle\n\n**The caller owns the lifecycle.** `chat()` never closes the client.\n\nTools execute lazily while the response stream is consumed — close only after\nthe stream is drained. In a streaming route handler, `try\u002Ffinally` around the\n`return` (or `await using` at function scope) closes the client before the\nbody streams; use a middleware terminal hook there instead (see Common\nMistakes below).\n\n```typescript\n\u002F\u002F Option 1: middleware terminal hooks (streaming route handlers)\nconst client = await createMCPClient({\n  transport: { type: 'http', url: '...' },\n})\nconst stream = chat({\n  adapter: openaiText('gpt-5.5'),\n  messages,\n  tools: await client.tools(),\n  middleware: [\n    {\n      name: 'mcp-close',\n      onFinish: () => client.close(),\n      onAbort: () => client.close(),\n      onError: () => client.close(),\n    },\n  ],\n})\nreturn toServerSentEventsResponse(stream)\n\n\u002F\u002F Option 2: explicit close after in-scope consumption\nconst client = await createMCPClient({\n  transport: { type: 'http', url: '...' },\n})\ntry {\n  const stream = chat({\n    adapter: openaiText('gpt-5.5'),\n    messages,\n    tools: await client.tools(),\n  })\n  for await (const chunk of stream) {\n    \u002F\u002F stream fully consumed inside this block\n  }\n} finally {\n  await client.close()\n}\n\n\u002F\u002F Option 3: await using (TypeScript 5.2+ with Symbol.asyncDispose) —\n\u002F\u002F same rule: consume the stream before the scope exits.\nawait using client = await createMCPClient({\n  transport: { type: 'http', url: '...' },\n})\n\u002F\u002F ... consume the stream in this scope; close() runs at scope exit\n```\n\n## `chat({ mcp })` — discovery + lifecycle in one prop\n\nRather than calling `client.tools()` and `client.close()` yourself, pass the\n`mcp` option to `chat()` and let it manage the full lifecycle.\n\n```typescript\n\u002F\u002F ChatMCPOptions shape:\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**Behavior:**\n\n- `chat()` calls `.tools()` on every entry in `clients` at run start and merges\n  all results into the tool list.\n- `lazyTools: true` is forwarded to `tools({ lazy: true })`.\n- `connection: 'close'` (default) — each client is closed when the run ends\n  (after the agent loop completes and the stream is drained). With\n  `'keep-alive'`, `chat()` never closes the clients — the caller owns their\n  lifecycle (keep connections warm across requests).\n- `onDiscoveryError`: throw (or re-throw) to abort the entire call; return\n  normally to skip that source and continue. Omitting the handler re-throws\n  (fail-fast).\n\n**When to use `mcp` vs. the tools spread:**\n\n| Approach                                                | Use when                                                                  |\n| ------------------------------------------------------- | ------------------------------------------------------------------------- |\n| `chat({ mcp: { clients: [...] } })`                     | Convenience: discovery + lifecycle handled for you; untyped args are fine |\n| `tools: [...await client.tools([toolDefinition(...)])]` | Fully-typed args\u002Fresults via Zod schemas (`toolDefinition` mode)          |\n\n**Server-side 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', \u002F\u002F chat() won't close it — reuse across requests\n            onDiscoveryError: (err, source) => {\n              console.warn('MCP discovery failed for source, skipping:', err)\n              \u002F\u002F returning skips this source; throw to fail the whole call fast\n            },\n          },\n        })\n\n        return toServerSentEventsResponse(stream)\n        \u002F\u002F connection: 'keep-alive' — chat() never closes mcpClient; it stays warm for the next request.\n      },\n    },\n  },\n})\n```\n\nYou can also pass an `MCPClients` pool directly:\n\n```typescript\nconst 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\nconst stream = chat({\n  adapter: openaiText('gpt-5.5'),\n  messages,\n  mcp: { clients: [pool], connection: 'keep-alive' },\n})\n```\n\n## `createMCPClients` — multiple servers\n\nConnect to many MCP servers in parallel. Each config key becomes the default\nprefix for that server's tools, preventing name collisions across servers.\n\n```typescript\nimport { createMCPClients } from '@tanstack\u002Fai-mcp'\n\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 Tool names auto-prefixed: 'github_search_repos', 'linear_create_issue', etc.\nconst tools = await pool.tools()\n\n\u002F\u002F Forward lazy flag to every server:\nconst lazyTools = await pool.tools({ lazy: true })\n\n\u002F\u002F Per-server typed access:\nconst githubTools = await pool.clients.github.tools()\n```\n\n`createMCPClients` connects in parallel, closes already-connected clients if\nany connection fails (no leaks), and throws `MCPConnectionError` naming the\nfailed server(s).\n\nOverride or disable prefixing:\n\n```typescript\nawait using pool = await createMCPClients({\n  github: { transport: { ... }, prefix: 'gh' },    \u002F\u002F 'gh_search_repos'\n  linear: { transport: { ... }, prefix: '' },        \u002F\u002F 'create_issue' (no prefix)\n})\n```\n\n## Abort signal — cancelling in-flight MCP calls\n\nMCP tool calls are automatically cancelled when the chat run's `AbortController`\nfires (e.g. client disconnect, server abort). The `abortSignal` is threaded\nthrough `ToolExecutionContext` into every `callTool` call with no extra code.\n\nYou can also read it in a hand-written server tool that wraps an MCP call:\n\n```typescript\nconst myTool = myDef.server(async (args, ctx) => {\n  \u002F\u002F Forward to any async work that accepts an AbortSignal.\n  const result = await fetch('https:\u002F\u002Fslow.api\u002Fdata', {\n    signal: ctx?.abortSignal,\n  })\n  return result.json()\n})\n```\n\n## Resources\n\n```typescript\n\u002F\u002F List all resources the server exposes.\nconst resources = await client.resources()\n\n\u002F\u002F Read a specific resource by URI.\nconst resource = await client.readResource(resources[0].uri)\n\n\u002F\u002F Convert one content block to a TanStack ContentPart.\nimport { mcpResourceToContentPart } from '@tanstack\u002Fai-mcp'\n\nconst part = mcpResourceToContentPart(resource.contents[0])\n\u002F\u002F part: ContentPart  (type: 'text' always for v1)\n```\n\nInject resources into a chat turn:\n\n```typescript\nimport { chat } from '@tanstack\u002Fai'\nimport { createMCPClient, mcpResourceToContentPart } from '@tanstack\u002Fai-mcp'\n\nconst client = await createMCPClient({\n  transport: { type: 'http', url: '...' },\n})\nconst resource = await client.readResource('file:\u002F\u002F\u002Fproject\u002FREADME.md')\nconst parts = resource.contents.map(mcpResourceToContentPart)\n\nconst stream = chat({\n  adapter: openaiText('gpt-5.5'),\n  messages: [\n    {\n      role: 'user',\n      content: [\n        ...parts,\n        { type: 'text', content: 'Summarize this document.' },\n      ],\n    },\n  ],\n})\n```\n\n## Prompts\n\n```typescript\n\u002F\u002F List prompts the server exposes.\nconst prompts = await client.prompts()\n\n\u002F\u002F Get a prompt (with optional arguments).\nconst prompt = await client.getPrompt('review_code', { language: 'TypeScript' })\n\n\u002F\u002F Convert to TanStack ModelMessage[] for use in chat().\nimport { mcpPromptToMessages } from '@tanstack\u002Fai-mcp'\n\nconst messages = mcpPromptToMessages(prompt)\n\u002F\u002F messages: ModelMessage[]  (role: 'user' | 'assistant')\n\nconst stream = chat({\n  adapter: openaiText('gpt-5.5'),\n  messages: [...messages, ...userMessages],\n})\n```\n\n## MCP Apps\n\nMCP Apps let an MCP tool surface a UI widget (static or interactive) on the\nclient. Two variants exist. See `docs\u002Fmcp\u002Fapps.md` for the full guide.\n\n### Static widgets — `UIResourcePart`\n\nWhen an MCP tool result carries a `ui:\u002F\u002F` resource, TanStack AI emits a\n`UIResourcePart` on the **assistant `UIMessage`**, alongside the normal\n`ToolCallPart` \u002F `ToolResultPart`. It is purely presentational — it never\nenters model input. The resource is read eagerly during the `chat()` run; if\nthe read fails the tool result still flows to the model and the widget is\nsimply absent (fail-soft). Static widgets require the MCP source to expose\n`readResource` — both `createMCPClient` and a `createMCPClients` pool do.\n\n```typescript\nimport type { UIResourcePart } from '@tanstack\u002Fai'\n\n\u002F\u002F UIResourcePart shape (on the assistant UIMessage):\n\u002F\u002F {\n\u002F\u002F   type: 'ui-resource'\n\u002F\u002F   resource: { uri: string; mimeType: string; text?: string; blob?: string }\n\u002F\u002F   serverId?: string     \u002F\u002F pool prefix \u002F config key — routes interactive calls\n\u002F\u002F   toolCallId: string    \u002F\u002F links to the originating tool call\n\u002F\u002F   toolName: string      \u002F\u002F server-native MCP tool name whose UI this renders\n\u002F\u002F   meta?: Record\u003Cstring, unknown>  \u002F\u002F reserved — currently always undefined\n\u002F\u002F }\n```\n\n### Interactive apps — `createMcpAppCallHandler`\n\nFor interactive apps (the widget iframe posts tool-call \u002F prompt \u002F link\nactions back), mount `createMcpAppCallHandler` from `@tanstack\u002Fai-mcp\u002Fapps`\nat a POST route. Pass the MCP client(s) you already created — a single\n`MCPClient`, an `MCPClients` pool, or an array of either. The handler reads\neach client's transport descriptor via `client.getInfo()` \u002F\n`pool.getServers()` (pure config, not a live socket) and **reconnects\nper-call** (stateless \u002F serverless-safe). It matches the widget-supplied\nnative (unprefixed) tool name against the server's unprefixed tool names,\nenforces a same-server allowlist, and returns `{ ok: true, result }` or\n`{ ok: false, error }`.\n\nFor a pool, the `serverId` on the `UIResourcePart` is the config key (the\ntool prefix); for a single client it is the client's `prefix` (or the sole\ndefault when `serverId` is absent and there is exactly one client).\n\n```typescript\nimport { createMCPClients } from '@tanstack\u002Fai-mcp'\nimport {\n  createMcpAppCallHandler,\n  inMemoryMcpSessionStore,\n} from '@tanstack\u002Fai-mcp\u002Fapps'\n\n\u002F\u002F Reuse the same pool you pass to chat({ mcp: { clients: [mcp] } }).\nconst mcp = await createMCPClients({\n  weather: {\n    transport: { type: 'http', url: 'https:\u002F\u002Fmcp-app.example.com\u002Fmcp' },\n  },\n})\n\n\u002F\u002F Minimal — reconnect-per-call via getServers() descriptor.\nconst handler = createMcpAppCallHandler({ clients: mcp })\n\n\u002F\u002F Options:\n\u002F\u002F clients   — MCPClient | MCPClients | Array\u003CMCPClient | MCPClients> (required).\n\u002F\u002F             The handler reads transport descriptors via client.getInfo() \u002F\n\u002F\u002F             pool.getServers() — the client does not need a live connection.\n\u002F\u002F store     — optional dynamic\u002Fstateful session store (e.g.\n\u002F\u002F             inMemoryMcpSessionStore()); used alongside clients.\n\u002F\u002F allowTool — optional authorizer receiving the WHOLE request:\n\u002F\u002F             (req: McpAppCallRequest) => boolean | Promise\u003Cboolean>.\n\u002F\u002F             The server-exposure check is ALWAYS enforced (the handler\n\u002F\u002F             rejects any tool the server does not expose). `allowTool`\n\u002F\u002F             is an ADDITIONAL restriction AND-ed on top: a request must\n\u002F\u002F             satisfy BOTH the server-exposure check and allowTool.\nconst handlerWithStore = createMcpAppCallHandler({\n  clients: mcp,\n  store: inMemoryMcpSessionStore(),\n  allowTool: (req) => req.toolName === 'place_order',\n})\n```\n\nThe handler invokes the server (`body: { threadId, serverId?, toolName, args?, messageId? }`):\n\n```typescript\nconst result = await handler(body)\n\u002F\u002F { ok: true; result: unknown } | { ok: false; error: string }\n```\n\n### Client side — `useMcpAppBridge` + `MCPAppResource`\n\nIn React\u002FPreact, create the bridge with the `useMcpAppBridge` hook (from\n`@tanstack\u002Fai-react` \u002F `@tanstack\u002Fai-preact`) — it returns a **stable** bridge\nper `threadId`\u002F`callEndpoint` and always calls your latest `sendMessage`\u002F`onLink`,\nso the bridge isn't recreated on every render (no `useMemo` \u002F `exhaustive-deps`\nby hand). It's a thin wrapper over the framework-agnostic `createMcpAppBridge`\nfrom `@tanstack\u002Fai-client` (use that directly outside React\u002FPreact). Render\nresources with `MCPAppResource` from `@tanstack\u002Fai-react\u002Fmcp-apps` (also\n`@tanstack\u002Fai-preact\u002Fmcp-apps`, which requires a `preact\u002Fcompat` alias).\n`MCPAppResource` uses `@mcp-ui\u002Fclient`'s `AppRenderer` under the hood — React\nonly. Solid, Vue, Svelte, and Angular renderers are deferred.\n\nThe bridge exposes `{ callTool, sendPrompt, openLink }` and routes the\niframe's actions: `tool` → POST to `callEndpoint`; `prompt` →\n`chat.sendMessage`; `link` → `onLink(url)` if provided, otherwise the link\nis dropped (with a console warning) and `openLink` returns `{ isError: true }`\n— it does NOT hang. `toolName` is read from `part.toolName`; it is not a\nprop. Omit `bridge` for display-only (inert) rendering.\n\n```tsx\nimport { useChat, useMcpAppBridge } from '@tanstack\u002Fai-react'\nimport { fetchServerSentEvents } from '@tanstack\u002Fai-client'\nimport { MCPAppResource } from '@tanstack\u002Fai-react\u002Fmcp-apps'\n\nfunction ChatPage() {\n  const threadId = 'weather-chat'\n  const { messages, sendMessage } = useChat({\n    connection: fetchServerSentEvents('\u002Fapi\u002Fchat'),\n  })\n\n  const bridge = useMcpAppBridge({\n    threadId,\n    callEndpoint: '\u002Fapi\u002Fmcp-app\u002Fcall',\n    chat: { sendMessage: async (content) => void sendMessage({ content }) },\n    \u002F\u002F Opt in to link navigation — absent means links are dropped.\n    onLink: (url) => window.open(url, '_blank', 'noopener'),\n  })\n\n  return (\n    \u003Cdiv>\n      {messages.map((msg) =>\n        msg.parts.map((part, i) => {\n          if (part.type === 'text') return \u003Cp key={i}>{part.content}\u003C\u002Fp>\n          if (part.type === 'ui-resource') {\n            return (\n              \u003CMCPAppResource\n                key={i}\n                part={part}\n                bridge={bridge}\n                sandbox={{ url: new URL('https:\u002F\u002Fsandbox.example.com') }}\n                \u002F\u002F toolInput is optional; toolName comes from part.toolName.\n              \u002F>\n            )\n          }\n          return null\n        }),\n      )}\n    \u003C\u002Fdiv>\n  )\n}\n```\n\n## Codegen CLI\n\nGenerate TypeScript types (typed tool names and pool keys) by introspecting live MCP servers.\n\n**1. Create `mcp.config.ts` at your project root:**\n\n```typescript\nimport { defineConfig } from '@tanstack\u002Fai-mcp'\n\nexport default defineConfig({\n  servers: {\n    github: {\n      transport: { type: 'http', url: 'https:\u002F\u002Fmcp.github.com\u002Fmcp' },\n      \u002F\u002F prefix must match the runtime createMCPClient({ prefix }) value\n    },\n  },\n  outFile: '.\u002Fsrc\u002Fmcp-types.generated.ts',\n})\n```\n\n**2. Run the generator:**\n\n```bash\nnpx @tanstack\u002Fai-mcp generate\n```\n\nThis connects to each server, lists its tools\u002Fresources\u002Fprompts, converts JSON\nSchemas to TypeScript, and writes one `interface \u003CName>Server extends ServerDescriptor`\nper server plus a combined `interface MCPServers` for pool typing.\n\n**3. Use the generated types:**\n\n```typescript\n\u002F\u002F Single server — narrows tools() return to descriptor-keyed tool names.\nimport type { GithubServer } from '.\u002Fsrc\u002Fmcp-types.generated'\nimport { createMCPClient } from '@tanstack\u002Fai-mcp'\n\nconst client = await createMCPClient\u003CGithubServer>({\n  transport: { type: 'http', url: 'https:\u002F\u002Fmcp.github.com\u002Fmcp' },\n})\nconst tools = await client.tools() \u002F\u002F typed to GithubServer's tool names\n\n\u002F\u002F Multiple servers via the generated MCPServers map.\nimport type { MCPServers } from '.\u002Fsrc\u002Fmcp-types.generated'\n\nconst pool = await createMCPClients\u003CMCPServers>({\n  github: { transport: { type: 'http', url: 'https:\u002F\u002Fmcp.github.com\u002Fmcp' } },\n})\n\u002F\u002F pool.clients.github is MCPClient\u003CGithubServer>\n\u002F\u002F missing\u002Fextra keys are a compile error\n```\n\nCodegen deps (`json-schema-to-typescript`, `jiti`) are bundled into the CLI bin\nand do NOT appear in the library's runtime dependency graph.\n\n## Error classes\n\n- `MCPConnectionError` — thrown when a server connection fails or when calling\n  methods after `close()`.\n- `MCPToolNotFoundError` — thrown from `client.tools([defs])` when a definition's\n  `name` is not exposed by the server.\n- `MCPTaskRequiredToolError` — thrown from `client.tools([defs])` when the named\n  tool declares `execution.taskSupport: 'required'` (experimental MCP tasks).\n  Such tools only run via the SDK's `tasks\u002FcallToolStream` flow, which\n  `@tanstack\u002Fai-mcp` does not support yet; they are silently excluded from\n  `tools()` auto-discovery for the same reason.\n- `DuplicateToolNameError` — thrown by a single pool's own `tools()` when two\n  tools within that pool share the same name (same server or pool clients with no\n  prefix). Exported from `@tanstack\u002Fai-mcp`.\n- `MCPDuplicateToolNameError` — thrown by `chat()` when tools from separate\n  `mcp.clients` entries collide after merging. Exported from `@tanstack\u002Fai`\n  (not `@tanstack\u002Fai-mcp`), so users can `instanceof` it at the `chat()` call site.\n\n```typescript\nimport {\n  MCPConnectionError,\n  MCPToolNotFoundError,\n  MCPTaskRequiredToolError,\n  DuplicateToolNameError,\n} from '@tanstack\u002Fai-mcp'\n\nimport { MCPDuplicateToolNameError } from '@tanstack\u002Fai'\n```\n\n## Complete server-route example\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 { createMCPClients } 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 pool = await createMCPClients({\n          github: {\n            transport: { type: 'http', url: 'https:\u002F\u002Fmcp.github.com\u002Fmcp' },\n          },\n          linear: {\n            transport: {\n              type: 'http',\n              url: 'https:\u002F\u002Fmcp.linear.app\u002Fmcp',\n              headers: {\n                Authorization: `Bearer ${process.env.LINEAR_KEY ?? ''}`,\n              },\n            },\n          },\n        })\n\n        const stream = chat({\n          adapter: openaiText('gpt-5.5'),\n          messages,\n          tools: await pool.tools(),\n          \u002F\u002F Close after the run ends — tools execute while the response streams,\n          \u002F\u002F so `await using` \u002F try-finally would close the pool too early here.\n          middleware: [\n            {\n              name: 'mcp-close',\n              onFinish: () => pool.close(),\n              onAbort: () => pool.close(),\n              onError: () => pool.close(),\n            },\n          ],\n        })\n\n        return toServerSentEventsResponse(stream)\n      },\n    },\n  },\n})\n```\n\n## Common Mistakes\n\n### a. HIGH: closing the client before the stream finishes\n\n`chat()` executes tools lazily as the model calls them during streaming.\nIf you close the MCP client before the response stream is fully consumed,\nin-flight tool calls will fail.\n\nWrong:\n\n```typescript\nconst tools = await client.tools()\nconst stream = chat({ adapter, messages, tools })\nawait client.close() \u002F\u002F closes before the stream runs tools\nreturn toServerSentEventsResponse(stream)\n```\n\nThis includes `try\u002Ffinally` around the `return`, and `await using` at function\nscope — both close before the returned `Response` body streams.\n\nCorrect — close in middleware terminal hooks (exactly one of\n`onFinish`\u002F`onAbort`\u002F`onError` fires per run), or consume the stream in scope\nbefore closing:\n\n```typescript\nimport { chat, toServerSentEventsResponse } from '@tanstack\u002Fai'\nimport { createMCPClient } from '@tanstack\u002Fai-mcp'\n\nconst client = await createMCPClient({\n  transport: { type: 'http', url: '...' },\n})\n\nconst stream = chat({\n  adapter: openaiText('gpt-5.5'),\n  messages,\n  tools: await client.tools(),\n  middleware: [\n    {\n      name: 'mcp-close',\n      onFinish: () => client.close(),\n      onAbort: () => client.close(),\n      onError: () => client.close(),\n    },\n  ],\n})\nreturn toServerSentEventsResponse(stream)\n```\n\n### b. HIGH: importing `stdioTransport` from the main entry point\n\n`stdioTransport` is only available from `@tanstack\u002Fai-mcp\u002Fstdio`. Importing it\nfrom `@tanstack\u002Fai-mcp` will fail with a module-not-found error and would\nbundle Node.js child-process code into edge bundles.\n\nWrong:\n\n```typescript\nimport { stdioTransport } from '@tanstack\u002Fai-mcp' \u002F\u002F does not exist here\n```\n\nCorrect:\n\n```typescript\nimport { stdioTransport } from '@tanstack\u002Fai-mcp\u002Fstdio'\n```\n\n### c. MEDIUM: using `client.tools([defs])` without matching names\n\nThe name field on each `toolDefinition` must exactly match the tool name the MCP\nserver exposes. Mismatches throw `MCPToolNotFoundError` at call time, not at\ntype-check time (unless generated types are in use).\n\n### d. MEDIUM: not setting a prefix when multiple servers share tool names\n\nTwo different errors can arise depending on where the collision is detected:\n\n- **Within a single `createMCPClients` pool** — calling `pool.tools()` throws\n  `DuplicateToolNameError` (from `@tanstack\u002Fai-mcp`) when two servers in that\n  pool expose the same name with no prefix to separate them.\n- **Across separate `mcp.clients` entries in `chat()`** — `chat()` throws\n  `MCPDuplicateToolNameError` (from `@tanstack\u002Fai`) after merging discovered\n  tools from all `mcp.clients` entries.\n\nIn both cases, the fix is the same: use `createMCPClients` (which auto-prefixes\nby config key) or set an explicit `prefix` on each `createMCPClient` call.\n\n## Cross-References\n\n- See also: ai-core\u002Ftool-calling\u002FSKILL.md — MCP tools are ServerTools; all tool\n  patterns (approval, lazy, client-side) apply.\n- See also: ai-core\u002Fchat-experience\u002FSKILL.md — wiring tools into `chat()`.\n",{"data":54,"body":64},{"name":4,"description":6,"type":55,"library":56,"library_version":57,"sources":58},"sub-skill","tanstack-ai","0.10.0",[59,60,61,62,63],"TanStack\u002Fai:docs\u002Ftools\u002Fmcp.md","TanStack\u002Fai:packages\u002Fai-mcp\u002Fsrc\u002Fclient.ts","TanStack\u002Fai:packages\u002Fai-mcp\u002Fsrc\u002Fpool.ts","TanStack\u002Fai:packages\u002Fai-mcp\u002Fsrc\u002Fresources.ts","TanStack\u002Fai:packages\u002Fai-mcp\u002Fsrc\u002Ftransport.ts",{"type":65,"children":66},"root",[67,81,110,117,129,169,174,180,214,219,268,279,541,567,574,581,753,759,924,938,1256,1262,1275,1458,1464,1469,1558,1825,1868,1874,1880,1899,2065,2084,2153,2167,2220,2779,2792,2821,2826,2832,2849,2878,3865,3877,3911,3979,3987,4070,4085,4154,4162,4974,4987,5354,5365,5370,5813,5830,5835,6008,6014,6050,6055,6264,6270,6502,6507,7056,7062,7432,7438,7451,7463,7539,7684,7696,7768,7802,8365,8378,8423,8443,8591,8690,9769,9775,9780,9796,10028,10036,10060,10081,10089,10559,10579,10585,10757,10889,10895,11949,11955,11961,11971,11976,12118,12152,12179,12705,12718,12742,12746,12793,12798,12840,12853,12872,12878,12883,12972,12998,13004,13023],{"type":68,"tag":69,"props":70,"children":72},"element","h1",{"id":71},"tanstackai-mcp",[73],{"type":68,"tag":74,"props":75,"children":77},"code",{"className":76},[],[78],{"type":79,"value":80},"text","@tanstack\u002Fai-mcp",{"type":68,"tag":82,"props":83,"children":84},"p",{},[85,87,92,94,100,102,108],{"type":79,"value":86},"This skill covers the ",{"type":68,"tag":74,"props":88,"children":90},{"className":89},[],[91],{"type":79,"value":80},{"type":79,"value":93}," package. Read ",{"type":68,"tag":74,"props":95,"children":97},{"className":96},[],[98],{"type":79,"value":99},"ai-core\u002Ftool-calling\u002FSKILL.md",{"type":79,"value":101},"\nfirst — MCP tools flow into ",{"type":68,"tag":74,"props":103,"children":105},{"className":104},[],[106],{"type":79,"value":107},"chat()",{"type":79,"value":109}," the same way hand-written tools do.",{"type":68,"tag":111,"props":112,"children":114},"h2",{"id":113},"when-to-use-this-package",[115],{"type":79,"value":116},"When to use this package",{"type":68,"tag":82,"props":118,"children":119},{},[120,122,127],{"type":79,"value":121},"Use ",{"type":68,"tag":74,"props":123,"children":125},{"className":124},[],[126],{"type":79,"value":80},{"type":79,"value":128}," when:",{"type":68,"tag":130,"props":131,"children":132},"ul",{},[133,139,151,164],{"type":68,"tag":134,"props":135,"children":136},"li",{},[137],{"type":79,"value":138},"A third-party MCP server exposes tools you want an agent or chat loop to call.",{"type":68,"tag":134,"props":140,"children":141},{},[142,144,149],{"type":79,"value":143},"You want to read MCP server resources (files, text, data) or prompts into a\n",{"type":68,"tag":74,"props":145,"children":147},{"className":146},[],[148],{"type":79,"value":107},{"type":79,"value":150}," message list.",{"type":68,"tag":134,"props":152,"children":153},{},[154,156,162],{"type":79,"value":155},"You want generated TypeScript types for an external MCP server's tool\nsignatures (via the bundled ",{"type":68,"tag":74,"props":157,"children":159},{"className":158},[],[160],{"type":79,"value":161},"generate",{"type":79,"value":163}," CLI).",{"type":68,"tag":134,"props":165,"children":166},{},[167],{"type":79,"value":168},"You are running tool execution on the server side and want to connect to MCP\nservers with HTTP (Streamable HTTP or SSE) or stdio transports.",{"type":68,"tag":82,"props":170,"children":171},{},[172],{"type":79,"value":173},"Do NOT use this package for browser\u002Fclient-side code — MCP connections are\nserver-side only.",{"type":68,"tag":111,"props":175,"children":177},{"id":176},"install",[178],{"type":79,"value":179},"Install",{"type":68,"tag":181,"props":182,"children":187},"pre",{"className":183,"code":184,"language":185,"meta":186,"style":186},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","pnpm add @tanstack\u002Fai-mcp\n","bash","",[188],{"type":68,"tag":74,"props":189,"children":190},{"__ignoreMap":186},[191],{"type":68,"tag":192,"props":193,"children":196},"span",{"class":194,"line":195},"line",1,[197,203,209],{"type":68,"tag":192,"props":198,"children":200},{"style":199},"--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B",[201],{"type":79,"value":202},"pnpm",{"type":68,"tag":192,"props":204,"children":206},{"style":205},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[207],{"type":79,"value":208}," add",{"type":68,"tag":192,"props":210,"children":211},{"style":205},[212],{"type":79,"value":213}," @tanstack\u002Fai-mcp\n",{"type":68,"tag":82,"props":215,"children":216},{},[217],{"type":79,"value":218},"The package has two subpath exports:",{"type":68,"tag":130,"props":220,"children":221},{},[222,249],{"type":68,"tag":134,"props":223,"children":224},{},[225,231,233,239,241,247],{"type":68,"tag":74,"props":226,"children":228},{"className":227},[],[229],{"type":79,"value":230},".",{"type":79,"value":232}," — main client API (",{"type":68,"tag":74,"props":234,"children":236},{"className":235},[],[237],{"type":79,"value":238},"createMCPClient",{"type":79,"value":240},", ",{"type":68,"tag":74,"props":242,"children":244},{"className":243},[],[245],{"type":79,"value":246},"createMCPClients",{"type":79,"value":248},", converters, types)",{"type":68,"tag":134,"props":250,"children":251},{},[252,258,260,266],{"type":68,"tag":74,"props":253,"children":255},{"className":254},[],[256],{"type":79,"value":257},".\u002Fstdio",{"type":79,"value":259}," — Node-only stdio transport factory (",{"type":68,"tag":74,"props":261,"children":263},{"className":262},[],[264],{"type":79,"value":265},"stdioTransport",{"type":79,"value":267},"); import it\nseparately so edge bundles stay clean",{"type":68,"tag":111,"props":269,"children":271},{"id":270},"createmcpclient-single-server",[272,277],{"type":68,"tag":74,"props":273,"children":275},{"className":274},[],[276],{"type":79,"value":238},{"type":79,"value":278}," — single server",{"type":68,"tag":181,"props":280,"children":283},{"className":281,"code":282,"language":45,"meta":186,"style":186},"language-typescript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { createMCPClient } from '@tanstack\u002Fai-mcp'\n\nconst client = await createMCPClient({\n  transport: { type: 'http', url: 'https:\u002F\u002Fmcp.example.com\u002Fmcp' },\n  prefix: 'weather', \u002F\u002F optional: prefixes all tool names (e.g. 'weather_get_forecast')\n  name: 'my-app', \u002F\u002F optional: client identity sent to the server\n})\n",[284],{"type":68,"tag":74,"props":285,"children":286},{"__ignoreMap":186},[287,332,342,382,456,492,527],{"type":68,"tag":192,"props":288,"children":289},{"class":194,"line":195},[290,296,302,308,313,318,323,327],{"type":68,"tag":192,"props":291,"children":293},{"style":292},"--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic",[294],{"type":79,"value":295},"import",{"type":68,"tag":192,"props":297,"children":299},{"style":298},"--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF",[300],{"type":79,"value":301}," {",{"type":68,"tag":192,"props":303,"children":305},{"style":304},"--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8",[306],{"type":79,"value":307}," createMCPClient",{"type":68,"tag":192,"props":309,"children":310},{"style":298},[311],{"type":79,"value":312}," }",{"type":68,"tag":192,"props":314,"children":315},{"style":292},[316],{"type":79,"value":317}," from",{"type":68,"tag":192,"props":319,"children":320},{"style":298},[321],{"type":79,"value":322}," '",{"type":68,"tag":192,"props":324,"children":325},{"style":205},[326],{"type":79,"value":80},{"type":68,"tag":192,"props":328,"children":329},{"style":298},[330],{"type":79,"value":331},"'\n",{"type":68,"tag":192,"props":333,"children":335},{"class":194,"line":334},2,[336],{"type":68,"tag":192,"props":337,"children":339},{"emptyLinePlaceholder":338},true,[340],{"type":79,"value":341},"\n",{"type":68,"tag":192,"props":343,"children":345},{"class":194,"line":344},3,[346,352,357,362,367,372,377],{"type":68,"tag":192,"props":347,"children":349},{"style":348},"--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA",[350],{"type":79,"value":351},"const",{"type":68,"tag":192,"props":353,"children":354},{"style":304},[355],{"type":79,"value":356}," client ",{"type":68,"tag":192,"props":358,"children":359},{"style":298},[360],{"type":79,"value":361},"=",{"type":68,"tag":192,"props":363,"children":364},{"style":292},[365],{"type":79,"value":366}," await",{"type":68,"tag":192,"props":368,"children":370},{"style":369},"--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF",[371],{"type":79,"value":307},{"type":68,"tag":192,"props":373,"children":374},{"style":304},[375],{"type":79,"value":376},"(",{"type":68,"tag":192,"props":378,"children":379},{"style":298},[380],{"type":79,"value":381},"{\n",{"type":68,"tag":192,"props":383,"children":385},{"class":194,"line":384},4,[386,392,397,401,406,410,414,419,424,429,434,438,442,447,451],{"type":68,"tag":192,"props":387,"children":389},{"style":388},"--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178",[390],{"type":79,"value":391},"  transport",{"type":68,"tag":192,"props":393,"children":394},{"style":298},[395],{"type":79,"value":396},":",{"type":68,"tag":192,"props":398,"children":399},{"style":298},[400],{"type":79,"value":301},{"type":68,"tag":192,"props":402,"children":403},{"style":388},[404],{"type":79,"value":405}," type",{"type":68,"tag":192,"props":407,"children":408},{"style":298},[409],{"type":79,"value":396},{"type":68,"tag":192,"props":411,"children":412},{"style":298},[413],{"type":79,"value":322},{"type":68,"tag":192,"props":415,"children":416},{"style":205},[417],{"type":79,"value":418},"http",{"type":68,"tag":192,"props":420,"children":421},{"style":298},[422],{"type":79,"value":423},"'",{"type":68,"tag":192,"props":425,"children":426},{"style":298},[427],{"type":79,"value":428},",",{"type":68,"tag":192,"props":430,"children":431},{"style":388},[432],{"type":79,"value":433}," url",{"type":68,"tag":192,"props":435,"children":436},{"style":298},[437],{"type":79,"value":396},{"type":68,"tag":192,"props":439,"children":440},{"style":298},[441],{"type":79,"value":322},{"type":68,"tag":192,"props":443,"children":444},{"style":205},[445],{"type":79,"value":446},"https:\u002F\u002Fmcp.example.com\u002Fmcp",{"type":68,"tag":192,"props":448,"children":449},{"style":298},[450],{"type":79,"value":423},{"type":68,"tag":192,"props":452,"children":453},{"style":298},[454],{"type":79,"value":455}," },\n",{"type":68,"tag":192,"props":457,"children":459},{"class":194,"line":458},5,[460,465,469,473,478,482,486],{"type":68,"tag":192,"props":461,"children":462},{"style":388},[463],{"type":79,"value":464},"  prefix",{"type":68,"tag":192,"props":466,"children":467},{"style":298},[468],{"type":79,"value":396},{"type":68,"tag":192,"props":470,"children":471},{"style":298},[472],{"type":79,"value":322},{"type":68,"tag":192,"props":474,"children":475},{"style":205},[476],{"type":79,"value":477},"weather",{"type":68,"tag":192,"props":479,"children":480},{"style":298},[481],{"type":79,"value":423},{"type":68,"tag":192,"props":483,"children":484},{"style":298},[485],{"type":79,"value":428},{"type":68,"tag":192,"props":487,"children":489},{"style":488},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic",[490],{"type":79,"value":491}," \u002F\u002F optional: prefixes all tool names (e.g. 'weather_get_forecast')\n",{"type":68,"tag":192,"props":493,"children":495},{"class":194,"line":494},6,[496,501,505,509,514,518,522],{"type":68,"tag":192,"props":497,"children":498},{"style":388},[499],{"type":79,"value":500},"  name",{"type":68,"tag":192,"props":502,"children":503},{"style":298},[504],{"type":79,"value":396},{"type":68,"tag":192,"props":506,"children":507},{"style":298},[508],{"type":79,"value":322},{"type":68,"tag":192,"props":510,"children":511},{"style":205},[512],{"type":79,"value":513},"my-app",{"type":68,"tag":192,"props":515,"children":516},{"style":298},[517],{"type":79,"value":423},{"type":68,"tag":192,"props":519,"children":520},{"style":298},[521],{"type":79,"value":428},{"type":68,"tag":192,"props":523,"children":524},{"style":488},[525],{"type":79,"value":526}," \u002F\u002F optional: client identity sent to the server\n",{"type":68,"tag":192,"props":528,"children":530},{"class":194,"line":529},7,[531,536],{"type":68,"tag":192,"props":532,"children":533},{"style":298},[534],{"type":79,"value":535},"}",{"type":68,"tag":192,"props":537,"children":538},{"style":304},[539],{"type":79,"value":540},")\n",{"type":68,"tag":82,"props":542,"children":543},{},[544,549,551,557,559,565],{"type":68,"tag":74,"props":545,"children":547},{"className":546},[],[548],{"type":79,"value":238},{"type":79,"value":550}," connects immediately and returns an ",{"type":68,"tag":74,"props":552,"children":554},{"className":553},[],[555],{"type":79,"value":556},"MCPClient",{"type":79,"value":558},". Throws\n",{"type":68,"tag":74,"props":560,"children":562},{"className":561},[],[563],{"type":79,"value":564},"MCPConnectionError",{"type":79,"value":566}," if the connection fails.",{"type":68,"tag":568,"props":569,"children":571},"h3",{"id":570},"transports",[572],{"type":79,"value":573},"Transports",{"type":68,"tag":575,"props":576,"children":578},"h4",{"id":577},"streamable-http-default-for-internet-facing-servers",[579],{"type":79,"value":580},"Streamable HTTP (default for internet-facing servers)",{"type":68,"tag":181,"props":582,"children":584},{"className":281,"code":583,"language":45,"meta":186,"style":186},"const client = await createMCPClient({\n  transport: {\n    type: 'http',\n    url: 'https:\u002F\u002Fmcp.example.com\u002Fmcp',\n    headers: { Authorization: 'Bearer sk-...' },\n  },\n})\n",[585],{"type":68,"tag":74,"props":586,"children":587},{"__ignoreMap":186},[588,619,635,664,692,734,742],{"type":68,"tag":192,"props":589,"children":590},{"class":194,"line":195},[591,595,599,603,607,611,615],{"type":68,"tag":192,"props":592,"children":593},{"style":348},[594],{"type":79,"value":351},{"type":68,"tag":192,"props":596,"children":597},{"style":304},[598],{"type":79,"value":356},{"type":68,"tag":192,"props":600,"children":601},{"style":298},[602],{"type":79,"value":361},{"type":68,"tag":192,"props":604,"children":605},{"style":292},[606],{"type":79,"value":366},{"type":68,"tag":192,"props":608,"children":609},{"style":369},[610],{"type":79,"value":307},{"type":68,"tag":192,"props":612,"children":613},{"style":304},[614],{"type":79,"value":376},{"type":68,"tag":192,"props":616,"children":617},{"style":298},[618],{"type":79,"value":381},{"type":68,"tag":192,"props":620,"children":621},{"class":194,"line":334},[622,626,630],{"type":68,"tag":192,"props":623,"children":624},{"style":388},[625],{"type":79,"value":391},{"type":68,"tag":192,"props":627,"children":628},{"style":298},[629],{"type":79,"value":396},{"type":68,"tag":192,"props":631,"children":632},{"style":298},[633],{"type":79,"value":634}," {\n",{"type":68,"tag":192,"props":636,"children":637},{"class":194,"line":344},[638,643,647,651,655,659],{"type":68,"tag":192,"props":639,"children":640},{"style":388},[641],{"type":79,"value":642},"    type",{"type":68,"tag":192,"props":644,"children":645},{"style":298},[646],{"type":79,"value":396},{"type":68,"tag":192,"props":648,"children":649},{"style":298},[650],{"type":79,"value":322},{"type":68,"tag":192,"props":652,"children":653},{"style":205},[654],{"type":79,"value":418},{"type":68,"tag":192,"props":656,"children":657},{"style":298},[658],{"type":79,"value":423},{"type":68,"tag":192,"props":660,"children":661},{"style":298},[662],{"type":79,"value":663},",\n",{"type":68,"tag":192,"props":665,"children":666},{"class":194,"line":384},[667,672,676,680,684,688],{"type":68,"tag":192,"props":668,"children":669},{"style":388},[670],{"type":79,"value":671},"    url",{"type":68,"tag":192,"props":673,"children":674},{"style":298},[675],{"type":79,"value":396},{"type":68,"tag":192,"props":677,"children":678},{"style":298},[679],{"type":79,"value":322},{"type":68,"tag":192,"props":681,"children":682},{"style":205},[683],{"type":79,"value":446},{"type":68,"tag":192,"props":685,"children":686},{"style":298},[687],{"type":79,"value":423},{"type":68,"tag":192,"props":689,"children":690},{"style":298},[691],{"type":79,"value":663},{"type":68,"tag":192,"props":693,"children":694},{"class":194,"line":458},[695,700,704,708,713,717,721,726,730],{"type":68,"tag":192,"props":696,"children":697},{"style":388},[698],{"type":79,"value":699},"    headers",{"type":68,"tag":192,"props":701,"children":702},{"style":298},[703],{"type":79,"value":396},{"type":68,"tag":192,"props":705,"children":706},{"style":298},[707],{"type":79,"value":301},{"type":68,"tag":192,"props":709,"children":710},{"style":388},[711],{"type":79,"value":712}," Authorization",{"type":68,"tag":192,"props":714,"children":715},{"style":298},[716],{"type":79,"value":396},{"type":68,"tag":192,"props":718,"children":719},{"style":298},[720],{"type":79,"value":322},{"type":68,"tag":192,"props":722,"children":723},{"style":205},[724],{"type":79,"value":725},"Bearer sk-...",{"type":68,"tag":192,"props":727,"children":728},{"style":298},[729],{"type":79,"value":423},{"type":68,"tag":192,"props":731,"children":732},{"style":298},[733],{"type":79,"value":455},{"type":68,"tag":192,"props":735,"children":736},{"class":194,"line":494},[737],{"type":68,"tag":192,"props":738,"children":739},{"style":298},[740],{"type":79,"value":741},"  },\n",{"type":68,"tag":192,"props":743,"children":744},{"class":194,"line":529},[745,749],{"type":68,"tag":192,"props":746,"children":747},{"style":298},[748],{"type":79,"value":535},{"type":68,"tag":192,"props":750,"children":751},{"style":304},[752],{"type":79,"value":540},{"type":68,"tag":575,"props":754,"children":756},{"id":755},"sse",[757],{"type":79,"value":758},"SSE",{"type":68,"tag":181,"props":760,"children":762},{"className":281,"code":761,"language":45,"meta":186,"style":186},"const client = await createMCPClient({\n  transport: {\n    type: 'sse',\n    url: 'https:\u002F\u002Fmcp.example.com\u002Fsse',\n    headers: { Authorization: 'Bearer sk-...' },\n  },\n})\n",[763],{"type":68,"tag":74,"props":764,"children":765},{"__ignoreMap":186},[766,797,812,839,867,906,913],{"type":68,"tag":192,"props":767,"children":768},{"class":194,"line":195},[769,773,777,781,785,789,793],{"type":68,"tag":192,"props":770,"children":771},{"style":348},[772],{"type":79,"value":351},{"type":68,"tag":192,"props":774,"children":775},{"style":304},[776],{"type":79,"value":356},{"type":68,"tag":192,"props":778,"children":779},{"style":298},[780],{"type":79,"value":361},{"type":68,"tag":192,"props":782,"children":783},{"style":292},[784],{"type":79,"value":366},{"type":68,"tag":192,"props":786,"children":787},{"style":369},[788],{"type":79,"value":307},{"type":68,"tag":192,"props":790,"children":791},{"style":304},[792],{"type":79,"value":376},{"type":68,"tag":192,"props":794,"children":795},{"style":298},[796],{"type":79,"value":381},{"type":68,"tag":192,"props":798,"children":799},{"class":194,"line":334},[800,804,808],{"type":68,"tag":192,"props":801,"children":802},{"style":388},[803],{"type":79,"value":391},{"type":68,"tag":192,"props":805,"children":806},{"style":298},[807],{"type":79,"value":396},{"type":68,"tag":192,"props":809,"children":810},{"style":298},[811],{"type":79,"value":634},{"type":68,"tag":192,"props":813,"children":814},{"class":194,"line":344},[815,819,823,827,831,835],{"type":68,"tag":192,"props":816,"children":817},{"style":388},[818],{"type":79,"value":642},{"type":68,"tag":192,"props":820,"children":821},{"style":298},[822],{"type":79,"value":396},{"type":68,"tag":192,"props":824,"children":825},{"style":298},[826],{"type":79,"value":322},{"type":68,"tag":192,"props":828,"children":829},{"style":205},[830],{"type":79,"value":755},{"type":68,"tag":192,"props":832,"children":833},{"style":298},[834],{"type":79,"value":423},{"type":68,"tag":192,"props":836,"children":837},{"style":298},[838],{"type":79,"value":663},{"type":68,"tag":192,"props":840,"children":841},{"class":194,"line":384},[842,846,850,854,859,863],{"type":68,"tag":192,"props":843,"children":844},{"style":388},[845],{"type":79,"value":671},{"type":68,"tag":192,"props":847,"children":848},{"style":298},[849],{"type":79,"value":396},{"type":68,"tag":192,"props":851,"children":852},{"style":298},[853],{"type":79,"value":322},{"type":68,"tag":192,"props":855,"children":856},{"style":205},[857],{"type":79,"value":858},"https:\u002F\u002Fmcp.example.com\u002Fsse",{"type":68,"tag":192,"props":860,"children":861},{"style":298},[862],{"type":79,"value":423},{"type":68,"tag":192,"props":864,"children":865},{"style":298},[866],{"type":79,"value":663},{"type":68,"tag":192,"props":868,"children":869},{"class":194,"line":458},[870,874,878,882,886,890,894,898,902],{"type":68,"tag":192,"props":871,"children":872},{"style":388},[873],{"type":79,"value":699},{"type":68,"tag":192,"props":875,"children":876},{"style":298},[877],{"type":79,"value":396},{"type":68,"tag":192,"props":879,"children":880},{"style":298},[881],{"type":79,"value":301},{"type":68,"tag":192,"props":883,"children":884},{"style":388},[885],{"type":79,"value":712},{"type":68,"tag":192,"props":887,"children":888},{"style":298},[889],{"type":79,"value":396},{"type":68,"tag":192,"props":891,"children":892},{"style":298},[893],{"type":79,"value":322},{"type":68,"tag":192,"props":895,"children":896},{"style":205},[897],{"type":79,"value":725},{"type":68,"tag":192,"props":899,"children":900},{"style":298},[901],{"type":79,"value":423},{"type":68,"tag":192,"props":903,"children":904},{"style":298},[905],{"type":79,"value":455},{"type":68,"tag":192,"props":907,"children":908},{"class":194,"line":494},[909],{"type":68,"tag":192,"props":910,"children":911},{"style":298},[912],{"type":79,"value":741},{"type":68,"tag":192,"props":914,"children":915},{"class":194,"line":529},[916,920],{"type":68,"tag":192,"props":917,"children":918},{"style":298},[919],{"type":79,"value":535},{"type":68,"tag":192,"props":921,"children":922},{"style":304},[923],{"type":79,"value":540},{"type":68,"tag":575,"props":925,"children":927},{"id":926},"stdio-node-only-import-from-stdio-subpath",[928,930,936],{"type":79,"value":929},"stdio (Node-only — import from ",{"type":68,"tag":74,"props":931,"children":933},{"className":932},[],[934],{"type":79,"value":935},"\u002Fstdio",{"type":79,"value":937}," subpath)",{"type":68,"tag":181,"props":939,"children":941},{"className":281,"code":940,"language":45,"meta":186,"style":186},"import { createMCPClient } from '@tanstack\u002Fai-mcp'\nimport { stdioTransport } from '@tanstack\u002Fai-mcp\u002Fstdio'\n\nconst client = await createMCPClient({\n  transport: stdioTransport({\n    command: 'npx',\n    args: ['-y', 'my-mcp-server'],\n    env: { API_KEY: process.env.API_KEY ?? '' },\n  }),\n})\n",[942],{"type":68,"tag":74,"props":943,"children":944},{"__ignoreMap":186},[945,980,1017,1024,1055,1078,1107,1163,1226,1244],{"type":68,"tag":192,"props":946,"children":947},{"class":194,"line":195},[948,952,956,960,964,968,972,976],{"type":68,"tag":192,"props":949,"children":950},{"style":292},[951],{"type":79,"value":295},{"type":68,"tag":192,"props":953,"children":954},{"style":298},[955],{"type":79,"value":301},{"type":68,"tag":192,"props":957,"children":958},{"style":304},[959],{"type":79,"value":307},{"type":68,"tag":192,"props":961,"children":962},{"style":298},[963],{"type":79,"value":312},{"type":68,"tag":192,"props":965,"children":966},{"style":292},[967],{"type":79,"value":317},{"type":68,"tag":192,"props":969,"children":970},{"style":298},[971],{"type":79,"value":322},{"type":68,"tag":192,"props":973,"children":974},{"style":205},[975],{"type":79,"value":80},{"type":68,"tag":192,"props":977,"children":978},{"style":298},[979],{"type":79,"value":331},{"type":68,"tag":192,"props":981,"children":982},{"class":194,"line":334},[983,987,991,996,1000,1004,1008,1013],{"type":68,"tag":192,"props":984,"children":985},{"style":292},[986],{"type":79,"value":295},{"type":68,"tag":192,"props":988,"children":989},{"style":298},[990],{"type":79,"value":301},{"type":68,"tag":192,"props":992,"children":993},{"style":304},[994],{"type":79,"value":995}," stdioTransport",{"type":68,"tag":192,"props":997,"children":998},{"style":298},[999],{"type":79,"value":312},{"type":68,"tag":192,"props":1001,"children":1002},{"style":292},[1003],{"type":79,"value":317},{"type":68,"tag":192,"props":1005,"children":1006},{"style":298},[1007],{"type":79,"value":322},{"type":68,"tag":192,"props":1009,"children":1010},{"style":205},[1011],{"type":79,"value":1012},"@tanstack\u002Fai-mcp\u002Fstdio",{"type":68,"tag":192,"props":1014,"children":1015},{"style":298},[1016],{"type":79,"value":331},{"type":68,"tag":192,"props":1018,"children":1019},{"class":194,"line":344},[1020],{"type":68,"tag":192,"props":1021,"children":1022},{"emptyLinePlaceholder":338},[1023],{"type":79,"value":341},{"type":68,"tag":192,"props":1025,"children":1026},{"class":194,"line":384},[1027,1031,1035,1039,1043,1047,1051],{"type":68,"tag":192,"props":1028,"children":1029},{"style":348},[1030],{"type":79,"value":351},{"type":68,"tag":192,"props":1032,"children":1033},{"style":304},[1034],{"type":79,"value":356},{"type":68,"tag":192,"props":1036,"children":1037},{"style":298},[1038],{"type":79,"value":361},{"type":68,"tag":192,"props":1040,"children":1041},{"style":292},[1042],{"type":79,"value":366},{"type":68,"tag":192,"props":1044,"children":1045},{"style":369},[1046],{"type":79,"value":307},{"type":68,"tag":192,"props":1048,"children":1049},{"style":304},[1050],{"type":79,"value":376},{"type":68,"tag":192,"props":1052,"children":1053},{"style":298},[1054],{"type":79,"value":381},{"type":68,"tag":192,"props":1056,"children":1057},{"class":194,"line":458},[1058,1062,1066,1070,1074],{"type":68,"tag":192,"props":1059,"children":1060},{"style":388},[1061],{"type":79,"value":391},{"type":68,"tag":192,"props":1063,"children":1064},{"style":298},[1065],{"type":79,"value":396},{"type":68,"tag":192,"props":1067,"children":1068},{"style":369},[1069],{"type":79,"value":995},{"type":68,"tag":192,"props":1071,"children":1072},{"style":304},[1073],{"type":79,"value":376},{"type":68,"tag":192,"props":1075,"children":1076},{"style":298},[1077],{"type":79,"value":381},{"type":68,"tag":192,"props":1079,"children":1080},{"class":194,"line":494},[1081,1086,1090,1094,1099,1103],{"type":68,"tag":192,"props":1082,"children":1083},{"style":388},[1084],{"type":79,"value":1085},"    command",{"type":68,"tag":192,"props":1087,"children":1088},{"style":298},[1089],{"type":79,"value":396},{"type":68,"tag":192,"props":1091,"children":1092},{"style":298},[1093],{"type":79,"value":322},{"type":68,"tag":192,"props":1095,"children":1096},{"style":205},[1097],{"type":79,"value":1098},"npx",{"type":68,"tag":192,"props":1100,"children":1101},{"style":298},[1102],{"type":79,"value":423},{"type":68,"tag":192,"props":1104,"children":1105},{"style":298},[1106],{"type":79,"value":663},{"type":68,"tag":192,"props":1108,"children":1109},{"class":194,"line":529},[1110,1115,1119,1124,1128,1133,1137,1141,1145,1150,1154,1159],{"type":68,"tag":192,"props":1111,"children":1112},{"style":388},[1113],{"type":79,"value":1114},"    args",{"type":68,"tag":192,"props":1116,"children":1117},{"style":298},[1118],{"type":79,"value":396},{"type":68,"tag":192,"props":1120,"children":1121},{"style":304},[1122],{"type":79,"value":1123}," [",{"type":68,"tag":192,"props":1125,"children":1126},{"style":298},[1127],{"type":79,"value":423},{"type":68,"tag":192,"props":1129,"children":1130},{"style":205},[1131],{"type":79,"value":1132},"-y",{"type":68,"tag":192,"props":1134,"children":1135},{"style":298},[1136],{"type":79,"value":423},{"type":68,"tag":192,"props":1138,"children":1139},{"style":298},[1140],{"type":79,"value":428},{"type":68,"tag":192,"props":1142,"children":1143},{"style":298},[1144],{"type":79,"value":322},{"type":68,"tag":192,"props":1146,"children":1147},{"style":205},[1148],{"type":79,"value":1149},"my-mcp-server",{"type":68,"tag":192,"props":1151,"children":1152},{"style":298},[1153],{"type":79,"value":423},{"type":68,"tag":192,"props":1155,"children":1156},{"style":304},[1157],{"type":79,"value":1158},"]",{"type":68,"tag":192,"props":1160,"children":1161},{"style":298},[1162],{"type":79,"value":663},{"type":68,"tag":192,"props":1164,"children":1166},{"class":194,"line":1165},8,[1167,1172,1176,1180,1185,1189,1194,1198,1203,1207,1212,1217,1222],{"type":68,"tag":192,"props":1168,"children":1169},{"style":388},[1170],{"type":79,"value":1171},"    env",{"type":68,"tag":192,"props":1173,"children":1174},{"style":298},[1175],{"type":79,"value":396},{"type":68,"tag":192,"props":1177,"children":1178},{"style":298},[1179],{"type":79,"value":301},{"type":68,"tag":192,"props":1181,"children":1182},{"style":388},[1183],{"type":79,"value":1184}," API_KEY",{"type":68,"tag":192,"props":1186,"children":1187},{"style":298},[1188],{"type":79,"value":396},{"type":68,"tag":192,"props":1190,"children":1191},{"style":304},[1192],{"type":79,"value":1193}," process",{"type":68,"tag":192,"props":1195,"children":1196},{"style":298},[1197],{"type":79,"value":230},{"type":68,"tag":192,"props":1199,"children":1200},{"style":304},[1201],{"type":79,"value":1202},"env",{"type":68,"tag":192,"props":1204,"children":1205},{"style":298},[1206],{"type":79,"value":230},{"type":68,"tag":192,"props":1208,"children":1209},{"style":304},[1210],{"type":79,"value":1211},"API_KEY ",{"type":68,"tag":192,"props":1213,"children":1214},{"style":298},[1215],{"type":79,"value":1216},"??",{"type":68,"tag":192,"props":1218,"children":1219},{"style":298},[1220],{"type":79,"value":1221}," ''",{"type":68,"tag":192,"props":1223,"children":1224},{"style":298},[1225],{"type":79,"value":455},{"type":68,"tag":192,"props":1227,"children":1229},{"class":194,"line":1228},9,[1230,1235,1240],{"type":68,"tag":192,"props":1231,"children":1232},{"style":298},[1233],{"type":79,"value":1234},"  }",{"type":68,"tag":192,"props":1236,"children":1237},{"style":304},[1238],{"type":79,"value":1239},")",{"type":68,"tag":192,"props":1241,"children":1242},{"style":298},[1243],{"type":79,"value":663},{"type":68,"tag":192,"props":1245,"children":1247},{"class":194,"line":1246},10,[1248,1252],{"type":68,"tag":192,"props":1249,"children":1250},{"style":298},[1251],{"type":79,"value":535},{"type":68,"tag":192,"props":1253,"children":1254},{"style":304},[1255],{"type":79,"value":540},{"type":68,"tag":575,"props":1257,"children":1259},{"id":1258},"custom-transport-escape-hatch",[1260],{"type":79,"value":1261},"Custom transport (escape hatch)",{"type":68,"tag":82,"props":1263,"children":1264},{},[1265,1267,1273],{"type":79,"value":1266},"Pass any SDK ",{"type":68,"tag":74,"props":1268,"children":1270},{"className":1269},[],[1271],{"type":79,"value":1272},"Transport",{"type":79,"value":1274}," instance directly:",{"type":68,"tag":181,"props":1276,"children":1278},{"className":281,"code":1277,"language":45,"meta":186,"style":186},"import { createMCPClient } from '@tanstack\u002Fai-mcp'\nimport { InMemoryTransport } from '@modelcontextprotocol\u002Fsdk\u002FinMemory.js'\n\nconst [clientTransport] = InMemoryTransport.createLinkedPair()\nconst client = await createMCPClient({ transport: clientTransport })\n",[1279],{"type":68,"tag":74,"props":1280,"children":1281},{"__ignoreMap":186},[1282,1317,1354,1361,1404],{"type":68,"tag":192,"props":1283,"children":1284},{"class":194,"line":195},[1285,1289,1293,1297,1301,1305,1309,1313],{"type":68,"tag":192,"props":1286,"children":1287},{"style":292},[1288],{"type":79,"value":295},{"type":68,"tag":192,"props":1290,"children":1291},{"style":298},[1292],{"type":79,"value":301},{"type":68,"tag":192,"props":1294,"children":1295},{"style":304},[1296],{"type":79,"value":307},{"type":68,"tag":192,"props":1298,"children":1299},{"style":298},[1300],{"type":79,"value":312},{"type":68,"tag":192,"props":1302,"children":1303},{"style":292},[1304],{"type":79,"value":317},{"type":68,"tag":192,"props":1306,"children":1307},{"style":298},[1308],{"type":79,"value":322},{"type":68,"tag":192,"props":1310,"children":1311},{"style":205},[1312],{"type":79,"value":80},{"type":68,"tag":192,"props":1314,"children":1315},{"style":298},[1316],{"type":79,"value":331},{"type":68,"tag":192,"props":1318,"children":1319},{"class":194,"line":334},[1320,1324,1328,1333,1337,1341,1345,1350],{"type":68,"tag":192,"props":1321,"children":1322},{"style":292},[1323],{"type":79,"value":295},{"type":68,"tag":192,"props":1325,"children":1326},{"style":298},[1327],{"type":79,"value":301},{"type":68,"tag":192,"props":1329,"children":1330},{"style":304},[1331],{"type":79,"value":1332}," InMemoryTransport",{"type":68,"tag":192,"props":1334,"children":1335},{"style":298},[1336],{"type":79,"value":312},{"type":68,"tag":192,"props":1338,"children":1339},{"style":292},[1340],{"type":79,"value":317},{"type":68,"tag":192,"props":1342,"children":1343},{"style":298},[1344],{"type":79,"value":322},{"type":68,"tag":192,"props":1346,"children":1347},{"style":205},[1348],{"type":79,"value":1349},"@modelcontextprotocol\u002Fsdk\u002FinMemory.js",{"type":68,"tag":192,"props":1351,"children":1352},{"style":298},[1353],{"type":79,"value":331},{"type":68,"tag":192,"props":1355,"children":1356},{"class":194,"line":344},[1357],{"type":68,"tag":192,"props":1358,"children":1359},{"emptyLinePlaceholder":338},[1360],{"type":79,"value":341},{"type":68,"tag":192,"props":1362,"children":1363},{"class":194,"line":384},[1364,1368,1372,1377,1381,1386,1390,1394,1399],{"type":68,"tag":192,"props":1365,"children":1366},{"style":348},[1367],{"type":79,"value":351},{"type":68,"tag":192,"props":1369,"children":1370},{"style":298},[1371],{"type":79,"value":1123},{"type":68,"tag":192,"props":1373,"children":1374},{"style":304},[1375],{"type":79,"value":1376},"clientTransport",{"type":68,"tag":192,"props":1378,"children":1379},{"style":298},[1380],{"type":79,"value":1158},{"type":68,"tag":192,"props":1382,"children":1383},{"style":298},[1384],{"type":79,"value":1385}," =",{"type":68,"tag":192,"props":1387,"children":1388},{"style":304},[1389],{"type":79,"value":1332},{"type":68,"tag":192,"props":1391,"children":1392},{"style":298},[1393],{"type":79,"value":230},{"type":68,"tag":192,"props":1395,"children":1396},{"style":369},[1397],{"type":79,"value":1398},"createLinkedPair",{"type":68,"tag":192,"props":1400,"children":1401},{"style":304},[1402],{"type":79,"value":1403},"()\n",{"type":68,"tag":192,"props":1405,"children":1406},{"class":194,"line":458},[1407,1411,1415,1419,1423,1427,1431,1436,1441,1445,1450,1454],{"type":68,"tag":192,"props":1408,"children":1409},{"style":348},[1410],{"type":79,"value":351},{"type":68,"tag":192,"props":1412,"children":1413},{"style":304},[1414],{"type":79,"value":356},{"type":68,"tag":192,"props":1416,"children":1417},{"style":298},[1418],{"type":79,"value":361},{"type":68,"tag":192,"props":1420,"children":1421},{"style":292},[1422],{"type":79,"value":366},{"type":68,"tag":192,"props":1424,"children":1425},{"style":369},[1426],{"type":79,"value":307},{"type":68,"tag":192,"props":1428,"children":1429},{"style":304},[1430],{"type":79,"value":376},{"type":68,"tag":192,"props":1432,"children":1433},{"style":298},[1434],{"type":79,"value":1435},"{",{"type":68,"tag":192,"props":1437,"children":1438},{"style":388},[1439],{"type":79,"value":1440}," transport",{"type":68,"tag":192,"props":1442,"children":1443},{"style":298},[1444],{"type":79,"value":396},{"type":68,"tag":192,"props":1446,"children":1447},{"style":304},[1448],{"type":79,"value":1449}," clientTransport ",{"type":68,"tag":192,"props":1451,"children":1452},{"style":298},[1453],{"type":79,"value":535},{"type":68,"tag":192,"props":1455,"children":1456},{"style":304},[1457],{"type":79,"value":540},{"type":68,"tag":568,"props":1459,"children":1461},{"id":1460},"authentication",[1462],{"type":79,"value":1463},"Authentication",{"type":68,"tag":82,"props":1465,"children":1466},{},[1467],{"type":79,"value":1468},"Two levels:",{"type":68,"tag":130,"props":1470,"children":1471},{},[1472,1512],{"type":68,"tag":134,"props":1473,"children":1474},{},[1475,1481,1483,1489,1491,1496,1498,1503,1505,1511],{"type":68,"tag":1476,"props":1477,"children":1478},"strong",{},[1479],{"type":79,"value":1480},"Static tokens",{"type":79,"value":1482}," — pass ",{"type":68,"tag":74,"props":1484,"children":1486},{"className":1485},[],[1487],{"type":79,"value":1488},"headers",{"type":79,"value":1490}," on the ",{"type":68,"tag":74,"props":1492,"children":1494},{"className":1493},[],[1495],{"type":79,"value":418},{"type":79,"value":1497},"\u002F",{"type":68,"tag":74,"props":1499,"children":1501},{"className":1500},[],[1502],{"type":79,"value":755},{"type":79,"value":1504}," config (sent with\nevery request): ",{"type":68,"tag":74,"props":1506,"children":1508},{"className":1507},[],[1509],{"type":79,"value":1510},"headers: { Authorization: 'Bearer ...' }",{"type":79,"value":230},{"type":68,"tag":134,"props":1513,"children":1514},{},[1515,1520,1521,1527,1529,1534,1535,1540,1542,1548,1550,1556],{"type":68,"tag":1476,"props":1516,"children":1517},{},[1518],{"type":79,"value":1519},"OAuth 2.1 (MCP authorization spec)",{"type":79,"value":1482},{"type":68,"tag":74,"props":1522,"children":1524},{"className":1523},[],[1525],{"type":79,"value":1526},"authProvider",{"type":79,"value":1528}," on the\n",{"type":68,"tag":74,"props":1530,"children":1532},{"className":1531},[],[1533],{"type":79,"value":418},{"type":79,"value":1497},{"type":68,"tag":74,"props":1536,"children":1538},{"className":1537},[],[1539],{"type":79,"value":755},{"type":79,"value":1541}," config. It accepts any ",{"type":68,"tag":74,"props":1543,"children":1545},{"className":1544},[],[1546],{"type":79,"value":1547},"OAuthClientProvider",{"type":79,"value":1549}," from\n",{"type":68,"tag":74,"props":1551,"children":1553},{"className":1552},[],[1554],{"type":79,"value":1555},"@modelcontextprotocol\u002Fsdk\u002Fclient\u002Fauth.js",{"type":79,"value":1557},"; the SDK transport attaches\ntokens, refreshes them, and retries on 401.",{"type":68,"tag":181,"props":1559,"children":1561},{"className":281,"code":1560,"language":45,"meta":186,"style":186},"import { createMCPClient } from '@tanstack\u002Fai-mcp'\nimport type { OAuthClientProvider } from '@modelcontextprotocol\u002Fsdk\u002Fclient\u002Fauth.js'\n\ndeclare const myOAuthProvider: OAuthClientProvider \u002F\u002F backed by stored tokens\n\nconst client = await createMCPClient({\n  transport: {\n    type: 'http',\n    url: 'https:\u002F\u002Fmcp.example.com\u002Fmcp',\n    authProvider: myOAuthProvider,\n  },\n})\n",[1562],{"type":68,"tag":74,"props":1563,"children":1564},{"__ignoreMap":186},[1565,1600,1640,1647,1678,1685,1716,1731,1758,1785,1805,1813],{"type":68,"tag":192,"props":1566,"children":1567},{"class":194,"line":195},[1568,1572,1576,1580,1584,1588,1592,1596],{"type":68,"tag":192,"props":1569,"children":1570},{"style":292},[1571],{"type":79,"value":295},{"type":68,"tag":192,"props":1573,"children":1574},{"style":298},[1575],{"type":79,"value":301},{"type":68,"tag":192,"props":1577,"children":1578},{"style":304},[1579],{"type":79,"value":307},{"type":68,"tag":192,"props":1581,"children":1582},{"style":298},[1583],{"type":79,"value":312},{"type":68,"tag":192,"props":1585,"children":1586},{"style":292},[1587],{"type":79,"value":317},{"type":68,"tag":192,"props":1589,"children":1590},{"style":298},[1591],{"type":79,"value":322},{"type":68,"tag":192,"props":1593,"children":1594},{"style":205},[1595],{"type":79,"value":80},{"type":68,"tag":192,"props":1597,"children":1598},{"style":298},[1599],{"type":79,"value":331},{"type":68,"tag":192,"props":1601,"children":1602},{"class":194,"line":334},[1603,1607,1611,1615,1620,1624,1628,1632,1636],{"type":68,"tag":192,"props":1604,"children":1605},{"style":292},[1606],{"type":79,"value":295},{"type":68,"tag":192,"props":1608,"children":1609},{"style":292},[1610],{"type":79,"value":405},{"type":68,"tag":192,"props":1612,"children":1613},{"style":298},[1614],{"type":79,"value":301},{"type":68,"tag":192,"props":1616,"children":1617},{"style":304},[1618],{"type":79,"value":1619}," OAuthClientProvider",{"type":68,"tag":192,"props":1621,"children":1622},{"style":298},[1623],{"type":79,"value":312},{"type":68,"tag":192,"props":1625,"children":1626},{"style":292},[1627],{"type":79,"value":317},{"type":68,"tag":192,"props":1629,"children":1630},{"style":298},[1631],{"type":79,"value":322},{"type":68,"tag":192,"props":1633,"children":1634},{"style":205},[1635],{"type":79,"value":1555},{"type":68,"tag":192,"props":1637,"children":1638},{"style":298},[1639],{"type":79,"value":331},{"type":68,"tag":192,"props":1641,"children":1642},{"class":194,"line":344},[1643],{"type":68,"tag":192,"props":1644,"children":1645},{"emptyLinePlaceholder":338},[1646],{"type":79,"value":341},{"type":68,"tag":192,"props":1648,"children":1649},{"class":194,"line":384},[1650,1655,1660,1665,1669,1673],{"type":68,"tag":192,"props":1651,"children":1652},{"style":348},[1653],{"type":79,"value":1654},"declare",{"type":68,"tag":192,"props":1656,"children":1657},{"style":348},[1658],{"type":79,"value":1659}," const",{"type":68,"tag":192,"props":1661,"children":1662},{"style":304},[1663],{"type":79,"value":1664}," myOAuthProvider",{"type":68,"tag":192,"props":1666,"children":1667},{"style":298},[1668],{"type":79,"value":396},{"type":68,"tag":192,"props":1670,"children":1671},{"style":199},[1672],{"type":79,"value":1619},{"type":68,"tag":192,"props":1674,"children":1675},{"style":488},[1676],{"type":79,"value":1677}," \u002F\u002F backed by stored tokens\n",{"type":68,"tag":192,"props":1679,"children":1680},{"class":194,"line":458},[1681],{"type":68,"tag":192,"props":1682,"children":1683},{"emptyLinePlaceholder":338},[1684],{"type":79,"value":341},{"type":68,"tag":192,"props":1686,"children":1687},{"class":194,"line":494},[1688,1692,1696,1700,1704,1708,1712],{"type":68,"tag":192,"props":1689,"children":1690},{"style":348},[1691],{"type":79,"value":351},{"type":68,"tag":192,"props":1693,"children":1694},{"style":304},[1695],{"type":79,"value":356},{"type":68,"tag":192,"props":1697,"children":1698},{"style":298},[1699],{"type":79,"value":361},{"type":68,"tag":192,"props":1701,"children":1702},{"style":292},[1703],{"type":79,"value":366},{"type":68,"tag":192,"props":1705,"children":1706},{"style":369},[1707],{"type":79,"value":307},{"type":68,"tag":192,"props":1709,"children":1710},{"style":304},[1711],{"type":79,"value":376},{"type":68,"tag":192,"props":1713,"children":1714},{"style":298},[1715],{"type":79,"value":381},{"type":68,"tag":192,"props":1717,"children":1718},{"class":194,"line":529},[1719,1723,1727],{"type":68,"tag":192,"props":1720,"children":1721},{"style":388},[1722],{"type":79,"value":391},{"type":68,"tag":192,"props":1724,"children":1725},{"style":298},[1726],{"type":79,"value":396},{"type":68,"tag":192,"props":1728,"children":1729},{"style":298},[1730],{"type":79,"value":634},{"type":68,"tag":192,"props":1732,"children":1733},{"class":194,"line":1165},[1734,1738,1742,1746,1750,1754],{"type":68,"tag":192,"props":1735,"children":1736},{"style":388},[1737],{"type":79,"value":642},{"type":68,"tag":192,"props":1739,"children":1740},{"style":298},[1741],{"type":79,"value":396},{"type":68,"tag":192,"props":1743,"children":1744},{"style":298},[1745],{"type":79,"value":322},{"type":68,"tag":192,"props":1747,"children":1748},{"style":205},[1749],{"type":79,"value":418},{"type":68,"tag":192,"props":1751,"children":1752},{"style":298},[1753],{"type":79,"value":423},{"type":68,"tag":192,"props":1755,"children":1756},{"style":298},[1757],{"type":79,"value":663},{"type":68,"tag":192,"props":1759,"children":1760},{"class":194,"line":1228},[1761,1765,1769,1773,1777,1781],{"type":68,"tag":192,"props":1762,"children":1763},{"style":388},[1764],{"type":79,"value":671},{"type":68,"tag":192,"props":1766,"children":1767},{"style":298},[1768],{"type":79,"value":396},{"type":68,"tag":192,"props":1770,"children":1771},{"style":298},[1772],{"type":79,"value":322},{"type":68,"tag":192,"props":1774,"children":1775},{"style":205},[1776],{"type":79,"value":446},{"type":68,"tag":192,"props":1778,"children":1779},{"style":298},[1780],{"type":79,"value":423},{"type":68,"tag":192,"props":1782,"children":1783},{"style":298},[1784],{"type":79,"value":663},{"type":68,"tag":192,"props":1786,"children":1787},{"class":194,"line":1246},[1788,1793,1797,1801],{"type":68,"tag":192,"props":1789,"children":1790},{"style":388},[1791],{"type":79,"value":1792},"    authProvider",{"type":68,"tag":192,"props":1794,"children":1795},{"style":298},[1796],{"type":79,"value":396},{"type":68,"tag":192,"props":1798,"children":1799},{"style":304},[1800],{"type":79,"value":1664},{"type":68,"tag":192,"props":1802,"children":1803},{"style":298},[1804],{"type":79,"value":663},{"type":68,"tag":192,"props":1806,"children":1808},{"class":194,"line":1807},11,[1809],{"type":68,"tag":192,"props":1810,"children":1811},{"style":298},[1812],{"type":79,"value":741},{"type":68,"tag":192,"props":1814,"children":1816},{"class":194,"line":1815},12,[1817,1821],{"type":68,"tag":192,"props":1818,"children":1819},{"style":298},[1820],{"type":79,"value":535},{"type":68,"tag":192,"props":1822,"children":1823},{"style":304},[1824],{"type":79,"value":540},{"type":68,"tag":82,"props":1826,"children":1827},{},[1828,1830,1836,1838,1843,1845,1851,1853,1858,1860,1866],{"type":79,"value":1829},"Caveat: interactive authorization-code flows need ",{"type":68,"tag":74,"props":1831,"children":1833},{"className":1832},[],[1834],{"type":79,"value":1835},"transport.finishAuth(code)",{"type":79,"value":1837},",\nand ",{"type":68,"tag":74,"props":1839,"children":1841},{"className":1840},[],[1842],{"type":79,"value":238},{"type":79,"value":1844}," does not expose its internal transport. For redirect\nflows, construct the ",{"type":68,"tag":74,"props":1846,"children":1848},{"className":1847},[],[1849],{"type":79,"value":1850},"StreamableHTTPClientTransport",{"type":79,"value":1852}," yourself with the\n",{"type":68,"tag":74,"props":1854,"children":1856},{"className":1855},[],[1857],{"type":79,"value":1526},{"type":79,"value":1859},", keep a reference, call ",{"type":68,"tag":74,"props":1861,"children":1863},{"className":1862},[],[1864],{"type":79,"value":1865},"finishAuth(code)",{"type":79,"value":1867}," in the OAuth\ncallback route, then pass the transport via the escape hatch above. For\nserver-side providers backed by pre-provisioned\u002Frefreshable tokens, the\nconfig form is sufficient.",{"type":68,"tag":111,"props":1869,"children":1871},{"id":1870},"three-type-safety-modes",[1872],{"type":79,"value":1873},"Three type-safety modes",{"type":68,"tag":568,"props":1875,"children":1877},{"id":1876},"mode-1-auto-discovery-no-types-needed",[1878],{"type":79,"value":1879},"Mode 1 — Auto-discovery (no types needed)",{"type":68,"tag":82,"props":1881,"children":1882},{},[1883,1889,1891,1897],{"type":68,"tag":74,"props":1884,"children":1886},{"className":1885},[],[1887],{"type":79,"value":1888},"client.tools()",{"type":79,"value":1890}," lists every tool the server exposes. Args are typed ",{"type":68,"tag":74,"props":1892,"children":1894},{"className":1893},[],[1895],{"type":79,"value":1896},"unknown",{"type":79,"value":1898},"\nat compile time but the tool's JSON Schema is forwarded to the LLM.",{"type":68,"tag":181,"props":1900,"children":1902},{"className":281,"code":1901,"language":45,"meta":186,"style":186},"const tools = await client.tools()\n\u002F\u002F tools: ServerTool[]  (args unknown)\n\nconst stream = chat({\n  adapter: openaiText('gpt-5.5'),\n  messages,\n  tools,\n})\n",[1903],{"type":68,"tag":74,"props":1904,"children":1905},{"__ignoreMap":186},[1906,1944,1952,1959,1988,2030,2042,2054],{"type":68,"tag":192,"props":1907,"children":1908},{"class":194,"line":195},[1909,1913,1918,1922,1926,1931,1935,1940],{"type":68,"tag":192,"props":1910,"children":1911},{"style":348},[1912],{"type":79,"value":351},{"type":68,"tag":192,"props":1914,"children":1915},{"style":304},[1916],{"type":79,"value":1917}," tools ",{"type":68,"tag":192,"props":1919,"children":1920},{"style":298},[1921],{"type":79,"value":361},{"type":68,"tag":192,"props":1923,"children":1924},{"style":292},[1925],{"type":79,"value":366},{"type":68,"tag":192,"props":1927,"children":1928},{"style":304},[1929],{"type":79,"value":1930}," client",{"type":68,"tag":192,"props":1932,"children":1933},{"style":298},[1934],{"type":79,"value":230},{"type":68,"tag":192,"props":1936,"children":1937},{"style":369},[1938],{"type":79,"value":1939},"tools",{"type":68,"tag":192,"props":1941,"children":1942},{"style":304},[1943],{"type":79,"value":1403},{"type":68,"tag":192,"props":1945,"children":1946},{"class":194,"line":334},[1947],{"type":68,"tag":192,"props":1948,"children":1949},{"style":488},[1950],{"type":79,"value":1951},"\u002F\u002F tools: ServerTool[]  (args unknown)\n",{"type":68,"tag":192,"props":1953,"children":1954},{"class":194,"line":344},[1955],{"type":68,"tag":192,"props":1956,"children":1957},{"emptyLinePlaceholder":338},[1958],{"type":79,"value":341},{"type":68,"tag":192,"props":1960,"children":1961},{"class":194,"line":384},[1962,1966,1971,1975,1980,1984],{"type":68,"tag":192,"props":1963,"children":1964},{"style":348},[1965],{"type":79,"value":351},{"type":68,"tag":192,"props":1967,"children":1968},{"style":304},[1969],{"type":79,"value":1970}," stream ",{"type":68,"tag":192,"props":1972,"children":1973},{"style":298},[1974],{"type":79,"value":361},{"type":68,"tag":192,"props":1976,"children":1977},{"style":369},[1978],{"type":79,"value":1979}," chat",{"type":68,"tag":192,"props":1981,"children":1982},{"style":304},[1983],{"type":79,"value":376},{"type":68,"tag":192,"props":1985,"children":1986},{"style":298},[1987],{"type":79,"value":381},{"type":68,"tag":192,"props":1989,"children":1990},{"class":194,"line":458},[1991,1996,2000,2005,2009,2013,2018,2022,2026],{"type":68,"tag":192,"props":1992,"children":1993},{"style":388},[1994],{"type":79,"value":1995},"  adapter",{"type":68,"tag":192,"props":1997,"children":1998},{"style":298},[1999],{"type":79,"value":396},{"type":68,"tag":192,"props":2001,"children":2002},{"style":369},[2003],{"type":79,"value":2004}," openaiText",{"type":68,"tag":192,"props":2006,"children":2007},{"style":304},[2008],{"type":79,"value":376},{"type":68,"tag":192,"props":2010,"children":2011},{"style":298},[2012],{"type":79,"value":423},{"type":68,"tag":192,"props":2014,"children":2015},{"style":205},[2016],{"type":79,"value":2017},"gpt-5.5",{"type":68,"tag":192,"props":2019,"children":2020},{"style":298},[2021],{"type":79,"value":423},{"type":68,"tag":192,"props":2023,"children":2024},{"style":304},[2025],{"type":79,"value":1239},{"type":68,"tag":192,"props":2027,"children":2028},{"style":298},[2029],{"type":79,"value":663},{"type":68,"tag":192,"props":2031,"children":2032},{"class":194,"line":494},[2033,2038],{"type":68,"tag":192,"props":2034,"children":2035},{"style":304},[2036],{"type":79,"value":2037},"  messages",{"type":68,"tag":192,"props":2039,"children":2040},{"style":298},[2041],{"type":79,"value":663},{"type":68,"tag":192,"props":2043,"children":2044},{"class":194,"line":529},[2045,2050],{"type":68,"tag":192,"props":2046,"children":2047},{"style":304},[2048],{"type":79,"value":2049},"  tools",{"type":68,"tag":192,"props":2051,"children":2052},{"style":298},[2053],{"type":79,"value":663},{"type":68,"tag":192,"props":2055,"children":2056},{"class":194,"line":1165},[2057,2061],{"type":68,"tag":192,"props":2058,"children":2059},{"style":298},[2060],{"type":79,"value":535},{"type":68,"tag":192,"props":2062,"children":2063},{"style":304},[2064],{"type":79,"value":540},{"type":68,"tag":82,"props":2066,"children":2067},{},[2068,2069,2075,2077,2083],{"type":79,"value":121},{"type":68,"tag":74,"props":2070,"children":2072},{"className":2071},[],[2073],{"type":79,"value":2074},"{ lazy: true }",{"type":79,"value":2076}," to defer schema sending via the existing ",{"type":68,"tag":74,"props":2078,"children":2080},{"className":2079},[],[2081],{"type":79,"value":2082},"LazyToolManager",{"type":79,"value":396},{"type":68,"tag":181,"props":2085,"children":2087},{"className":281,"code":2086,"language":45,"meta":186,"style":186},"const tools = await client.tools({ lazy: true })\n",[2088],{"type":68,"tag":74,"props":2089,"children":2090},{"__ignoreMap":186},[2091],{"type":68,"tag":192,"props":2092,"children":2093},{"class":194,"line":195},[2094,2098,2102,2106,2110,2114,2118,2122,2126,2130,2135,2139,2145,2149],{"type":68,"tag":192,"props":2095,"children":2096},{"style":348},[2097],{"type":79,"value":351},{"type":68,"tag":192,"props":2099,"children":2100},{"style":304},[2101],{"type":79,"value":1917},{"type":68,"tag":192,"props":2103,"children":2104},{"style":298},[2105],{"type":79,"value":361},{"type":68,"tag":192,"props":2107,"children":2108},{"style":292},[2109],{"type":79,"value":366},{"type":68,"tag":192,"props":2111,"children":2112},{"style":304},[2113],{"type":79,"value":1930},{"type":68,"tag":192,"props":2115,"children":2116},{"style":298},[2117],{"type":79,"value":230},{"type":68,"tag":192,"props":2119,"children":2120},{"style":369},[2121],{"type":79,"value":1939},{"type":68,"tag":192,"props":2123,"children":2124},{"style":304},[2125],{"type":79,"value":376},{"type":68,"tag":192,"props":2127,"children":2128},{"style":298},[2129],{"type":79,"value":1435},{"type":68,"tag":192,"props":2131,"children":2132},{"style":388},[2133],{"type":79,"value":2134}," lazy",{"type":68,"tag":192,"props":2136,"children":2137},{"style":298},[2138],{"type":79,"value":396},{"type":68,"tag":192,"props":2140,"children":2142},{"style":2141},"--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC",[2143],{"type":79,"value":2144}," true",{"type":68,"tag":192,"props":2146,"children":2147},{"style":298},[2148],{"type":79,"value":312},{"type":68,"tag":192,"props":2150,"children":2151},{"style":304},[2152],{"type":79,"value":540},{"type":68,"tag":568,"props":2154,"children":2156},{"id":2155},"mode-2-typed-via-tooldefinition-instances",[2157,2159,2165],{"type":79,"value":2158},"Mode 2 — Typed via ",{"type":68,"tag":74,"props":2160,"children":2162},{"className":2161},[],[2163],{"type":79,"value":2164},"toolDefinition",{"type":79,"value":2166}," instances",{"type":68,"tag":82,"props":2168,"children":2169},{},[2170,2172,2178,2180,2186,2188,2194,2196,2202,2204,2210,2212,2218],{"type":79,"value":2171},"Pass bare ",{"type":68,"tag":74,"props":2173,"children":2175},{"className":2174},[],[2176],{"type":79,"value":2177},"toolDefinition()",{"type":79,"value":2179}," instances (no ",{"type":68,"tag":74,"props":2181,"children":2183},{"className":2182},[],[2184],{"type":79,"value":2185},".server()",{"type":79,"value":2187}," call) to ",{"type":68,"tag":74,"props":2189,"children":2191},{"className":2190},[],[2192],{"type":79,"value":2193},"client.tools([...])",{"type":79,"value":2195},".\nThe MCP client binds a ",{"type":68,"tag":74,"props":2197,"children":2199},{"className":2198},[],[2200],{"type":79,"value":2201},"callTool",{"type":79,"value":2203}," proxy as the execute function while\ninput\u002Foutput validation and TypeScript types come from the definitions' Zod schemas.\nOnly the named tools are returned (allowlist = the definitions' ",{"type":68,"tag":74,"props":2205,"children":2207},{"className":2206},[],[2208],{"type":79,"value":2209},"name",{"type":79,"value":2211},"s).\nThrows ",{"type":68,"tag":74,"props":2213,"children":2215},{"className":2214},[],[2216],{"type":79,"value":2217},"MCPToolNotFoundError",{"type":79,"value":2219}," if the server does not expose a tool with that name.",{"type":68,"tag":181,"props":2221,"children":2223},{"className":281,"code":2222,"language":45,"meta":186,"style":186},"import { toolDefinition } from '@tanstack\u002Fai'\nimport { createMCPClient } from '@tanstack\u002Fai-mcp'\nimport { z } from 'zod'\n\nconst getWeatherDef = 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 client = await createMCPClient({\n  transport: { type: 'http', url: 'https:\u002F\u002Fmcp.example.com\u002Fmcp' },\n})\n\n\u002F\u002F Returns MappedServerTools\u003Ctypeof defs> — fully typed per definition.\nconst tools = await client.tools([getWeatherDef])\n",[2224],{"type":68,"tag":74,"props":2225,"children":2226},{"__ignoreMap":186},[2227,2264,2299,2336,2343,2371,2399,2428,2500,2600,2611,2618,2649,2713,2725,2733,2742],{"type":68,"tag":192,"props":2228,"children":2229},{"class":194,"line":195},[2230,2234,2238,2243,2247,2251,2255,2260],{"type":68,"tag":192,"props":2231,"children":2232},{"style":292},[2233],{"type":79,"value":295},{"type":68,"tag":192,"props":2235,"children":2236},{"style":298},[2237],{"type":79,"value":301},{"type":68,"tag":192,"props":2239,"children":2240},{"style":304},[2241],{"type":79,"value":2242}," toolDefinition",{"type":68,"tag":192,"props":2244,"children":2245},{"style":298},[2246],{"type":79,"value":312},{"type":68,"tag":192,"props":2248,"children":2249},{"style":292},[2250],{"type":79,"value":317},{"type":68,"tag":192,"props":2252,"children":2253},{"style":298},[2254],{"type":79,"value":322},{"type":68,"tag":192,"props":2256,"children":2257},{"style":205},[2258],{"type":79,"value":2259},"@tanstack\u002Fai",{"type":68,"tag":192,"props":2261,"children":2262},{"style":298},[2263],{"type":79,"value":331},{"type":68,"tag":192,"props":2265,"children":2266},{"class":194,"line":334},[2267,2271,2275,2279,2283,2287,2291,2295],{"type":68,"tag":192,"props":2268,"children":2269},{"style":292},[2270],{"type":79,"value":295},{"type":68,"tag":192,"props":2272,"children":2273},{"style":298},[2274],{"type":79,"value":301},{"type":68,"tag":192,"props":2276,"children":2277},{"style":304},[2278],{"type":79,"value":307},{"type":68,"tag":192,"props":2280,"children":2281},{"style":298},[2282],{"type":79,"value":312},{"type":68,"tag":192,"props":2284,"children":2285},{"style":292},[2286],{"type":79,"value":317},{"type":68,"tag":192,"props":2288,"children":2289},{"style":298},[2290],{"type":79,"value":322},{"type":68,"tag":192,"props":2292,"children":2293},{"style":205},[2294],{"type":79,"value":80},{"type":68,"tag":192,"props":2296,"children":2297},{"style":298},[2298],{"type":79,"value":331},{"type":68,"tag":192,"props":2300,"children":2301},{"class":194,"line":344},[2302,2306,2310,2315,2319,2323,2327,2332],{"type":68,"tag":192,"props":2303,"children":2304},{"style":292},[2305],{"type":79,"value":295},{"type":68,"tag":192,"props":2307,"children":2308},{"style":298},[2309],{"type":79,"value":301},{"type":68,"tag":192,"props":2311,"children":2312},{"style":304},[2313],{"type":79,"value":2314}," z",{"type":68,"tag":192,"props":2316,"children":2317},{"style":298},[2318],{"type":79,"value":312},{"type":68,"tag":192,"props":2320,"children":2321},{"style":292},[2322],{"type":79,"value":317},{"type":68,"tag":192,"props":2324,"children":2325},{"style":298},[2326],{"type":79,"value":322},{"type":68,"tag":192,"props":2328,"children":2329},{"style":205},[2330],{"type":79,"value":2331},"zod",{"type":68,"tag":192,"props":2333,"children":2334},{"style":298},[2335],{"type":79,"value":331},{"type":68,"tag":192,"props":2337,"children":2338},{"class":194,"line":384},[2339],{"type":68,"tag":192,"props":2340,"children":2341},{"emptyLinePlaceholder":338},[2342],{"type":79,"value":341},{"type":68,"tag":192,"props":2344,"children":2345},{"class":194,"line":458},[2346,2350,2355,2359,2363,2367],{"type":68,"tag":192,"props":2347,"children":2348},{"style":348},[2349],{"type":79,"value":351},{"type":68,"tag":192,"props":2351,"children":2352},{"style":304},[2353],{"type":79,"value":2354}," getWeatherDef ",{"type":68,"tag":192,"props":2356,"children":2357},{"style":298},[2358],{"type":79,"value":361},{"type":68,"tag":192,"props":2360,"children":2361},{"style":369},[2362],{"type":79,"value":2242},{"type":68,"tag":192,"props":2364,"children":2365},{"style":304},[2366],{"type":79,"value":376},{"type":68,"tag":192,"props":2368,"children":2369},{"style":298},[2370],{"type":79,"value":381},{"type":68,"tag":192,"props":2372,"children":2373},{"class":194,"line":494},[2374,2378,2382,2386,2391,2395],{"type":68,"tag":192,"props":2375,"children":2376},{"style":388},[2377],{"type":79,"value":500},{"type":68,"tag":192,"props":2379,"children":2380},{"style":298},[2381],{"type":79,"value":396},{"type":68,"tag":192,"props":2383,"children":2384},{"style":298},[2385],{"type":79,"value":322},{"type":68,"tag":192,"props":2387,"children":2388},{"style":205},[2389],{"type":79,"value":2390},"get_weather",{"type":68,"tag":192,"props":2392,"children":2393},{"style":298},[2394],{"type":79,"value":423},{"type":68,"tag":192,"props":2396,"children":2397},{"style":298},[2398],{"type":79,"value":663},{"type":68,"tag":192,"props":2400,"children":2401},{"class":194,"line":529},[2402,2407,2411,2415,2420,2424],{"type":68,"tag":192,"props":2403,"children":2404},{"style":388},[2405],{"type":79,"value":2406},"  description",{"type":68,"tag":192,"props":2408,"children":2409},{"style":298},[2410],{"type":79,"value":396},{"type":68,"tag":192,"props":2412,"children":2413},{"style":298},[2414],{"type":79,"value":322},{"type":68,"tag":192,"props":2416,"children":2417},{"style":205},[2418],{"type":79,"value":2419},"Current weather for a city",{"type":68,"tag":192,"props":2421,"children":2422},{"style":298},[2423],{"type":79,"value":423},{"type":68,"tag":192,"props":2425,"children":2426},{"style":298},[2427],{"type":79,"value":663},{"type":68,"tag":192,"props":2429,"children":2430},{"class":194,"line":1165},[2431,2436,2440,2444,2448,2453,2457,2461,2466,2470,2474,2478,2483,2488,2492,2496],{"type":68,"tag":192,"props":2432,"children":2433},{"style":388},[2434],{"type":79,"value":2435},"  inputSchema",{"type":68,"tag":192,"props":2437,"children":2438},{"style":298},[2439],{"type":79,"value":396},{"type":68,"tag":192,"props":2441,"children":2442},{"style":304},[2443],{"type":79,"value":2314},{"type":68,"tag":192,"props":2445,"children":2446},{"style":298},[2447],{"type":79,"value":230},{"type":68,"tag":192,"props":2449,"children":2450},{"style":369},[2451],{"type":79,"value":2452},"object",{"type":68,"tag":192,"props":2454,"children":2455},{"style":304},[2456],{"type":79,"value":376},{"type":68,"tag":192,"props":2458,"children":2459},{"style":298},[2460],{"type":79,"value":1435},{"type":68,"tag":192,"props":2462,"children":2463},{"style":388},[2464],{"type":79,"value":2465}," city",{"type":68,"tag":192,"props":2467,"children":2468},{"style":298},[2469],{"type":79,"value":396},{"type":68,"tag":192,"props":2471,"children":2472},{"style":304},[2473],{"type":79,"value":2314},{"type":68,"tag":192,"props":2475,"children":2476},{"style":298},[2477],{"type":79,"value":230},{"type":68,"tag":192,"props":2479,"children":2480},{"style":369},[2481],{"type":79,"value":2482},"string",{"type":68,"tag":192,"props":2484,"children":2485},{"style":304},[2486],{"type":79,"value":2487},"() ",{"type":68,"tag":192,"props":2489,"children":2490},{"style":298},[2491],{"type":79,"value":535},{"type":68,"tag":192,"props":2493,"children":2494},{"style":304},[2495],{"type":79,"value":1239},{"type":68,"tag":192,"props":2497,"children":2498},{"style":298},[2499],{"type":79,"value":663},{"type":68,"tag":192,"props":2501,"children":2502},{"class":194,"line":1228},[2503,2508,2512,2516,2520,2524,2528,2532,2537,2541,2545,2549,2554,2559,2563,2568,2572,2576,2580,2584,2588,2592,2596],{"type":68,"tag":192,"props":2504,"children":2505},{"style":388},[2506],{"type":79,"value":2507},"  outputSchema",{"type":68,"tag":192,"props":2509,"children":2510},{"style":298},[2511],{"type":79,"value":396},{"type":68,"tag":192,"props":2513,"children":2514},{"style":304},[2515],{"type":79,"value":2314},{"type":68,"tag":192,"props":2517,"children":2518},{"style":298},[2519],{"type":79,"value":230},{"type":68,"tag":192,"props":2521,"children":2522},{"style":369},[2523],{"type":79,"value":2452},{"type":68,"tag":192,"props":2525,"children":2526},{"style":304},[2527],{"type":79,"value":376},{"type":68,"tag":192,"props":2529,"children":2530},{"style":298},[2531],{"type":79,"value":1435},{"type":68,"tag":192,"props":2533,"children":2534},{"style":388},[2535],{"type":79,"value":2536}," temperature",{"type":68,"tag":192,"props":2538,"children":2539},{"style":298},[2540],{"type":79,"value":396},{"type":68,"tag":192,"props":2542,"children":2543},{"style":304},[2544],{"type":79,"value":2314},{"type":68,"tag":192,"props":2546,"children":2547},{"style":298},[2548],{"type":79,"value":230},{"type":68,"tag":192,"props":2550,"children":2551},{"style":369},[2552],{"type":79,"value":2553},"number",{"type":68,"tag":192,"props":2555,"children":2556},{"style":304},[2557],{"type":79,"value":2558},"()",{"type":68,"tag":192,"props":2560,"children":2561},{"style":298},[2562],{"type":79,"value":428},{"type":68,"tag":192,"props":2564,"children":2565},{"style":388},[2566],{"type":79,"value":2567}," conditions",{"type":68,"tag":192,"props":2569,"children":2570},{"style":298},[2571],{"type":79,"value":396},{"type":68,"tag":192,"props":2573,"children":2574},{"style":304},[2575],{"type":79,"value":2314},{"type":68,"tag":192,"props":2577,"children":2578},{"style":298},[2579],{"type":79,"value":230},{"type":68,"tag":192,"props":2581,"children":2582},{"style":369},[2583],{"type":79,"value":2482},{"type":68,"tag":192,"props":2585,"children":2586},{"style":304},[2587],{"type":79,"value":2487},{"type":68,"tag":192,"props":2589,"children":2590},{"style":298},[2591],{"type":79,"value":535},{"type":68,"tag":192,"props":2593,"children":2594},{"style":304},[2595],{"type":79,"value":1239},{"type":68,"tag":192,"props":2597,"children":2598},{"style":298},[2599],{"type":79,"value":663},{"type":68,"tag":192,"props":2601,"children":2602},{"class":194,"line":1246},[2603,2607],{"type":68,"tag":192,"props":2604,"children":2605},{"style":298},[2606],{"type":79,"value":535},{"type":68,"tag":192,"props":2608,"children":2609},{"style":304},[2610],{"type":79,"value":540},{"type":68,"tag":192,"props":2612,"children":2613},{"class":194,"line":1807},[2614],{"type":68,"tag":192,"props":2615,"children":2616},{"emptyLinePlaceholder":338},[2617],{"type":79,"value":341},{"type":68,"tag":192,"props":2619,"children":2620},{"class":194,"line":1815},[2621,2625,2629,2633,2637,2641,2645],{"type":68,"tag":192,"props":2622,"children":2623},{"style":348},[2624],{"type":79,"value":351},{"type":68,"tag":192,"props":2626,"children":2627},{"style":304},[2628],{"type":79,"value":356},{"type":68,"tag":192,"props":2630,"children":2631},{"style":298},[2632],{"type":79,"value":361},{"type":68,"tag":192,"props":2634,"children":2635},{"style":292},[2636],{"type":79,"value":366},{"type":68,"tag":192,"props":2638,"children":2639},{"style":369},[2640],{"type":79,"value":307},{"type":68,"tag":192,"props":2642,"children":2643},{"style":304},[2644],{"type":79,"value":376},{"type":68,"tag":192,"props":2646,"children":2647},{"style":298},[2648],{"type":79,"value":381},{"type":68,"tag":192,"props":2650,"children":2652},{"class":194,"line":2651},13,[2653,2657,2661,2665,2669,2673,2677,2681,2685,2689,2693,2697,2701,2705,2709],{"type":68,"tag":192,"props":2654,"children":2655},{"style":388},[2656],{"type":79,"value":391},{"type":68,"tag":192,"props":2658,"children":2659},{"style":298},[2660],{"type":79,"value":396},{"type":68,"tag":192,"props":2662,"children":2663},{"style":298},[2664],{"type":79,"value":301},{"type":68,"tag":192,"props":2666,"children":2667},{"style":388},[2668],{"type":79,"value":405},{"type":68,"tag":192,"props":2670,"children":2671},{"style":298},[2672],{"type":79,"value":396},{"type":68,"tag":192,"props":2674,"children":2675},{"style":298},[2676],{"type":79,"value":322},{"type":68,"tag":192,"props":2678,"children":2679},{"style":205},[2680],{"type":79,"value":418},{"type":68,"tag":192,"props":2682,"children":2683},{"style":298},[2684],{"type":79,"value":423},{"type":68,"tag":192,"props":2686,"children":2687},{"style":298},[2688],{"type":79,"value":428},{"type":68,"tag":192,"props":2690,"children":2691},{"style":388},[2692],{"type":79,"value":433},{"type":68,"tag":192,"props":2694,"children":2695},{"style":298},[2696],{"type":79,"value":396},{"type":68,"tag":192,"props":2698,"children":2699},{"style":298},[2700],{"type":79,"value":322},{"type":68,"tag":192,"props":2702,"children":2703},{"style":205},[2704],{"type":79,"value":446},{"type":68,"tag":192,"props":2706,"children":2707},{"style":298},[2708],{"type":79,"value":423},{"type":68,"tag":192,"props":2710,"children":2711},{"style":298},[2712],{"type":79,"value":455},{"type":68,"tag":192,"props":2714,"children":2716},{"class":194,"line":2715},14,[2717,2721],{"type":68,"tag":192,"props":2718,"children":2719},{"style":298},[2720],{"type":79,"value":535},{"type":68,"tag":192,"props":2722,"children":2723},{"style":304},[2724],{"type":79,"value":540},{"type":68,"tag":192,"props":2726,"children":2728},{"class":194,"line":2727},15,[2729],{"type":68,"tag":192,"props":2730,"children":2731},{"emptyLinePlaceholder":338},[2732],{"type":79,"value":341},{"type":68,"tag":192,"props":2734,"children":2736},{"class":194,"line":2735},16,[2737],{"type":68,"tag":192,"props":2738,"children":2739},{"style":488},[2740],{"type":79,"value":2741},"\u002F\u002F Returns MappedServerTools\u003Ctypeof defs> — fully typed per definition.\n",{"type":68,"tag":192,"props":2743,"children":2745},{"class":194,"line":2744},17,[2746,2750,2754,2758,2762,2766,2770,2774],{"type":68,"tag":192,"props":2747,"children":2748},{"style":348},[2749],{"type":79,"value":351},{"type":68,"tag":192,"props":2751,"children":2752},{"style":304},[2753],{"type":79,"value":1917},{"type":68,"tag":192,"props":2755,"children":2756},{"style":298},[2757],{"type":79,"value":361},{"type":68,"tag":192,"props":2759,"children":2760},{"style":292},[2761],{"type":79,"value":366},{"type":68,"tag":192,"props":2763,"children":2764},{"style":304},[2765],{"type":79,"value":1930},{"type":68,"tag":192,"props":2767,"children":2768},{"style":298},[2769],{"type":79,"value":230},{"type":68,"tag":192,"props":2771,"children":2772},{"style":369},[2773],{"type":79,"value":1939},{"type":68,"tag":192,"props":2775,"children":2776},{"style":304},[2777],{"type":79,"value":2778},"([getWeatherDef])\n",{"type":68,"tag":568,"props":2780,"children":2782},{"id":2781},"mode-3-generated-types-via-generate-cli",[2783,2785,2790],{"type":79,"value":2784},"Mode 3 — Generated types (via ",{"type":68,"tag":74,"props":2786,"children":2788},{"className":2787},[],[2789],{"type":79,"value":161},{"type":79,"value":2791}," CLI)",{"type":68,"tag":82,"props":2793,"children":2794},{},[2795,2797,2803,2805,2811,2813,2819],{"type":79,"value":2796},"Run ",{"type":68,"tag":74,"props":2798,"children":2800},{"className":2799},[],[2801],{"type":79,"value":2802},"npx @tanstack\u002Fai-mcp generate",{"type":79,"value":2804}," to introspect live servers and emit a\n",{"type":68,"tag":74,"props":2806,"children":2808},{"className":2807},[],[2809],{"type":79,"value":2810},"ServerDescriptor",{"type":79,"value":2812}," interface per server. Pass the generated interface as the\ngeneric to ",{"type":68,"tag":74,"props":2814,"children":2816},{"className":2815},[],[2817],{"type":79,"value":2818},"createMCPClient\u003CWeatherServer>(...)",{"type":79,"value":2820}," to narrow discovered tool\nnames to the server's literals (args stay untyped — use Mode 2 for typed args).",{"type":68,"tag":82,"props":2822,"children":2823},{},[2824],{"type":79,"value":2825},"See the \"Codegen CLI\" section below for details.",{"type":68,"tag":111,"props":2827,"children":2829},{"id":2828},"lifecycle",[2830],{"type":79,"value":2831},"Lifecycle",{"type":68,"tag":82,"props":2833,"children":2834},{},[2835,2840,2842,2847],{"type":68,"tag":1476,"props":2836,"children":2837},{},[2838],{"type":79,"value":2839},"The caller owns the lifecycle.",{"type":79,"value":2841}," ",{"type":68,"tag":74,"props":2843,"children":2845},{"className":2844},[],[2846],{"type":79,"value":107},{"type":79,"value":2848}," never closes the client.",{"type":68,"tag":82,"props":2850,"children":2851},{},[2852,2854,2860,2862,2868,2870,2876],{"type":79,"value":2853},"Tools execute lazily while the response stream is consumed — close only after\nthe stream is drained. In a streaming route handler, ",{"type":68,"tag":74,"props":2855,"children":2857},{"className":2856},[],[2858],{"type":79,"value":2859},"try\u002Ffinally",{"type":79,"value":2861}," around the\n",{"type":68,"tag":74,"props":2863,"children":2865},{"className":2864},[],[2866],{"type":79,"value":2867},"return",{"type":79,"value":2869}," (or ",{"type":68,"tag":74,"props":2871,"children":2873},{"className":2872},[],[2874],{"type":79,"value":2875},"await using",{"type":79,"value":2877}," at function scope) closes the client before the\nbody streams; use a middleware terminal hook there instead (see Common\nMistakes below).",{"type":68,"tag":181,"props":2879,"children":2881},{"className":281,"code":2880,"language":45,"meta":186,"style":186},"\u002F\u002F Option 1: middleware terminal hooks (streaming route handlers)\nconst client = await createMCPClient({\n  transport: { type: 'http', url: '...' },\n})\nconst stream = chat({\n  adapter: openaiText('gpt-5.5'),\n  messages,\n  tools: await client.tools(),\n  middleware: [\n    {\n      name: 'mcp-close',\n      onFinish: () => client.close(),\n      onAbort: () => client.close(),\n      onError: () => client.close(),\n    },\n  ],\n})\nreturn toServerSentEventsResponse(stream)\n\n\u002F\u002F Option 2: explicit close after in-scope consumption\nconst client = await createMCPClient({\n  transport: { type: 'http', url: '...' },\n})\ntry {\n  const stream = chat({\n    adapter: openaiText('gpt-5.5'),\n    messages,\n    tools: await client.tools(),\n  })\n  for await (const chunk of stream) {\n    \u002F\u002F stream fully consumed inside this block\n  }\n} finally {\n  await client.close()\n}\n\n\u002F\u002F Option 3: await using (TypeScript 5.2+ with Symbol.asyncDispose) —\n\u002F\u002F same rule: consume the stream before the scope exits.\nawait using client = await createMCPClient({\n  transport: { type: 'http', url: '...' },\n})\n\u002F\u002F ... consume the stream in this scope; close() runs at scope exit\n",[2882],{"type":68,"tag":74,"props":2883,"children":2884},{"__ignoreMap":186},[2885,2893,2924,2988,2999,3026,3065,3076,3111,3128,3136,3165,3208,3248,3288,3296,3308,3319,3337,3345,3354,3386,3450,3462,3475,3505,3546,3559,3596,3608,3653,3662,3671,3688,3713,3722,3730,3739,3748,3780,3844,3856],{"type":68,"tag":192,"props":2886,"children":2887},{"class":194,"line":195},[2888],{"type":68,"tag":192,"props":2889,"children":2890},{"style":488},[2891],{"type":79,"value":2892},"\u002F\u002F Option 1: middleware terminal hooks (streaming route handlers)\n",{"type":68,"tag":192,"props":2894,"children":2895},{"class":194,"line":334},[2896,2900,2904,2908,2912,2916,2920],{"type":68,"tag":192,"props":2897,"children":2898},{"style":348},[2899],{"type":79,"value":351},{"type":68,"tag":192,"props":2901,"children":2902},{"style":304},[2903],{"type":79,"value":356},{"type":68,"tag":192,"props":2905,"children":2906},{"style":298},[2907],{"type":79,"value":361},{"type":68,"tag":192,"props":2909,"children":2910},{"style":292},[2911],{"type":79,"value":366},{"type":68,"tag":192,"props":2913,"children":2914},{"style":369},[2915],{"type":79,"value":307},{"type":68,"tag":192,"props":2917,"children":2918},{"style":304},[2919],{"type":79,"value":376},{"type":68,"tag":192,"props":2921,"children":2922},{"style":298},[2923],{"type":79,"value":381},{"type":68,"tag":192,"props":2925,"children":2926},{"class":194,"line":344},[2927,2931,2935,2939,2943,2947,2951,2955,2959,2963,2967,2971,2975,2980,2984],{"type":68,"tag":192,"props":2928,"children":2929},{"style":388},[2930],{"type":79,"value":391},{"type":68,"tag":192,"props":2932,"children":2933},{"style":298},[2934],{"type":79,"value":396},{"type":68,"tag":192,"props":2936,"children":2937},{"style":298},[2938],{"type":79,"value":301},{"type":68,"tag":192,"props":2940,"children":2941},{"style":388},[2942],{"type":79,"value":405},{"type":68,"tag":192,"props":2944,"children":2945},{"style":298},[2946],{"type":79,"value":396},{"type":68,"tag":192,"props":2948,"children":2949},{"style":298},[2950],{"type":79,"value":322},{"type":68,"tag":192,"props":2952,"children":2953},{"style":205},[2954],{"type":79,"value":418},{"type":68,"tag":192,"props":2956,"children":2957},{"style":298},[2958],{"type":79,"value":423},{"type":68,"tag":192,"props":2960,"children":2961},{"style":298},[2962],{"type":79,"value":428},{"type":68,"tag":192,"props":2964,"children":2965},{"style":388},[2966],{"type":79,"value":433},{"type":68,"tag":192,"props":2968,"children":2969},{"style":298},[2970],{"type":79,"value":396},{"type":68,"tag":192,"props":2972,"children":2973},{"style":298},[2974],{"type":79,"value":322},{"type":68,"tag":192,"props":2976,"children":2977},{"style":205},[2978],{"type":79,"value":2979},"...",{"type":68,"tag":192,"props":2981,"children":2982},{"style":298},[2983],{"type":79,"value":423},{"type":68,"tag":192,"props":2985,"children":2986},{"style":298},[2987],{"type":79,"value":455},{"type":68,"tag":192,"props":2989,"children":2990},{"class":194,"line":384},[2991,2995],{"type":68,"tag":192,"props":2992,"children":2993},{"style":298},[2994],{"type":79,"value":535},{"type":68,"tag":192,"props":2996,"children":2997},{"style":304},[2998],{"type":79,"value":540},{"type":68,"tag":192,"props":3000,"children":3001},{"class":194,"line":458},[3002,3006,3010,3014,3018,3022],{"type":68,"tag":192,"props":3003,"children":3004},{"style":348},[3005],{"type":79,"value":351},{"type":68,"tag":192,"props":3007,"children":3008},{"style":304},[3009],{"type":79,"value":1970},{"type":68,"tag":192,"props":3011,"children":3012},{"style":298},[3013],{"type":79,"value":361},{"type":68,"tag":192,"props":3015,"children":3016},{"style":369},[3017],{"type":79,"value":1979},{"type":68,"tag":192,"props":3019,"children":3020},{"style":304},[3021],{"type":79,"value":376},{"type":68,"tag":192,"props":3023,"children":3024},{"style":298},[3025],{"type":79,"value":381},{"type":68,"tag":192,"props":3027,"children":3028},{"class":194,"line":494},[3029,3033,3037,3041,3045,3049,3053,3057,3061],{"type":68,"tag":192,"props":3030,"children":3031},{"style":388},[3032],{"type":79,"value":1995},{"type":68,"tag":192,"props":3034,"children":3035},{"style":298},[3036],{"type":79,"value":396},{"type":68,"tag":192,"props":3038,"children":3039},{"style":369},[3040],{"type":79,"value":2004},{"type":68,"tag":192,"props":3042,"children":3043},{"style":304},[3044],{"type":79,"value":376},{"type":68,"tag":192,"props":3046,"children":3047},{"style":298},[3048],{"type":79,"value":423},{"type":68,"tag":192,"props":3050,"children":3051},{"style":205},[3052],{"type":79,"value":2017},{"type":68,"tag":192,"props":3054,"children":3055},{"style":298},[3056],{"type":79,"value":423},{"type":68,"tag":192,"props":3058,"children":3059},{"style":304},[3060],{"type":79,"value":1239},{"type":68,"tag":192,"props":3062,"children":3063},{"style":298},[3064],{"type":79,"value":663},{"type":68,"tag":192,"props":3066,"children":3067},{"class":194,"line":529},[3068,3072],{"type":68,"tag":192,"props":3069,"children":3070},{"style":304},[3071],{"type":79,"value":2037},{"type":68,"tag":192,"props":3073,"children":3074},{"style":298},[3075],{"type":79,"value":663},{"type":68,"tag":192,"props":3077,"children":3078},{"class":194,"line":1165},[3079,3083,3087,3091,3095,3099,3103,3107],{"type":68,"tag":192,"props":3080,"children":3081},{"style":388},[3082],{"type":79,"value":2049},{"type":68,"tag":192,"props":3084,"children":3085},{"style":298},[3086],{"type":79,"value":396},{"type":68,"tag":192,"props":3088,"children":3089},{"style":292},[3090],{"type":79,"value":366},{"type":68,"tag":192,"props":3092,"children":3093},{"style":304},[3094],{"type":79,"value":1930},{"type":68,"tag":192,"props":3096,"children":3097},{"style":298},[3098],{"type":79,"value":230},{"type":68,"tag":192,"props":3100,"children":3101},{"style":369},[3102],{"type":79,"value":1939},{"type":68,"tag":192,"props":3104,"children":3105},{"style":304},[3106],{"type":79,"value":2558},{"type":68,"tag":192,"props":3108,"children":3109},{"style":298},[3110],{"type":79,"value":663},{"type":68,"tag":192,"props":3112,"children":3113},{"class":194,"line":1228},[3114,3119,3123],{"type":68,"tag":192,"props":3115,"children":3116},{"style":388},[3117],{"type":79,"value":3118},"  middleware",{"type":68,"tag":192,"props":3120,"children":3121},{"style":298},[3122],{"type":79,"value":396},{"type":68,"tag":192,"props":3124,"children":3125},{"style":304},[3126],{"type":79,"value":3127}," [\n",{"type":68,"tag":192,"props":3129,"children":3130},{"class":194,"line":1246},[3131],{"type":68,"tag":192,"props":3132,"children":3133},{"style":298},[3134],{"type":79,"value":3135},"    {\n",{"type":68,"tag":192,"props":3137,"children":3138},{"class":194,"line":1807},[3139,3144,3148,3152,3157,3161],{"type":68,"tag":192,"props":3140,"children":3141},{"style":388},[3142],{"type":79,"value":3143},"      name",{"type":68,"tag":192,"props":3145,"children":3146},{"style":298},[3147],{"type":79,"value":396},{"type":68,"tag":192,"props":3149,"children":3150},{"style":298},[3151],{"type":79,"value":322},{"type":68,"tag":192,"props":3153,"children":3154},{"style":205},[3155],{"type":79,"value":3156},"mcp-close",{"type":68,"tag":192,"props":3158,"children":3159},{"style":298},[3160],{"type":79,"value":423},{"type":68,"tag":192,"props":3162,"children":3163},{"style":298},[3164],{"type":79,"value":663},{"type":68,"tag":192,"props":3166,"children":3167},{"class":194,"line":1815},[3168,3173,3177,3182,3187,3191,3195,3200,3204],{"type":68,"tag":192,"props":3169,"children":3170},{"style":369},[3171],{"type":79,"value":3172},"      onFinish",{"type":68,"tag":192,"props":3174,"children":3175},{"style":298},[3176],{"type":79,"value":396},{"type":68,"tag":192,"props":3178,"children":3179},{"style":298},[3180],{"type":79,"value":3181}," ()",{"type":68,"tag":192,"props":3183,"children":3184},{"style":348},[3185],{"type":79,"value":3186}," =>",{"type":68,"tag":192,"props":3188,"children":3189},{"style":304},[3190],{"type":79,"value":1930},{"type":68,"tag":192,"props":3192,"children":3193},{"style":298},[3194],{"type":79,"value":230},{"type":68,"tag":192,"props":3196,"children":3197},{"style":369},[3198],{"type":79,"value":3199},"close",{"type":68,"tag":192,"props":3201,"children":3202},{"style":304},[3203],{"type":79,"value":2558},{"type":68,"tag":192,"props":3205,"children":3206},{"style":298},[3207],{"type":79,"value":663},{"type":68,"tag":192,"props":3209,"children":3210},{"class":194,"line":2651},[3211,3216,3220,3224,3228,3232,3236,3240,3244],{"type":68,"tag":192,"props":3212,"children":3213},{"style":369},[3214],{"type":79,"value":3215},"      onAbort",{"type":68,"tag":192,"props":3217,"children":3218},{"style":298},[3219],{"type":79,"value":396},{"type":68,"tag":192,"props":3221,"children":3222},{"style":298},[3223],{"type":79,"value":3181},{"type":68,"tag":192,"props":3225,"children":3226},{"style":348},[3227],{"type":79,"value":3186},{"type":68,"tag":192,"props":3229,"children":3230},{"style":304},[3231],{"type":79,"value":1930},{"type":68,"tag":192,"props":3233,"children":3234},{"style":298},[3235],{"type":79,"value":230},{"type":68,"tag":192,"props":3237,"children":3238},{"style":369},[3239],{"type":79,"value":3199},{"type":68,"tag":192,"props":3241,"children":3242},{"style":304},[3243],{"type":79,"value":2558},{"type":68,"tag":192,"props":3245,"children":3246},{"style":298},[3247],{"type":79,"value":663},{"type":68,"tag":192,"props":3249,"children":3250},{"class":194,"line":2715},[3251,3256,3260,3264,3268,3272,3276,3280,3284],{"type":68,"tag":192,"props":3252,"children":3253},{"style":369},[3254],{"type":79,"value":3255},"      onError",{"type":68,"tag":192,"props":3257,"children":3258},{"style":298},[3259],{"type":79,"value":396},{"type":68,"tag":192,"props":3261,"children":3262},{"style":298},[3263],{"type":79,"value":3181},{"type":68,"tag":192,"props":3265,"children":3266},{"style":348},[3267],{"type":79,"value":3186},{"type":68,"tag":192,"props":3269,"children":3270},{"style":304},[3271],{"type":79,"value":1930},{"type":68,"tag":192,"props":3273,"children":3274},{"style":298},[3275],{"type":79,"value":230},{"type":68,"tag":192,"props":3277,"children":3278},{"style":369},[3279],{"type":79,"value":3199},{"type":68,"tag":192,"props":3281,"children":3282},{"style":304},[3283],{"type":79,"value":2558},{"type":68,"tag":192,"props":3285,"children":3286},{"style":298},[3287],{"type":79,"value":663},{"type":68,"tag":192,"props":3289,"children":3290},{"class":194,"line":2727},[3291],{"type":68,"tag":192,"props":3292,"children":3293},{"style":298},[3294],{"type":79,"value":3295},"    },\n",{"type":68,"tag":192,"props":3297,"children":3298},{"class":194,"line":2735},[3299,3304],{"type":68,"tag":192,"props":3300,"children":3301},{"style":304},[3302],{"type":79,"value":3303},"  ]",{"type":68,"tag":192,"props":3305,"children":3306},{"style":298},[3307],{"type":79,"value":663},{"type":68,"tag":192,"props":3309,"children":3310},{"class":194,"line":2744},[3311,3315],{"type":68,"tag":192,"props":3312,"children":3313},{"style":298},[3314],{"type":79,"value":535},{"type":68,"tag":192,"props":3316,"children":3317},{"style":304},[3318],{"type":79,"value":540},{"type":68,"tag":192,"props":3320,"children":3322},{"class":194,"line":3321},18,[3323,3327,3332],{"type":68,"tag":192,"props":3324,"children":3325},{"style":292},[3326],{"type":79,"value":2867},{"type":68,"tag":192,"props":3328,"children":3329},{"style":369},[3330],{"type":79,"value":3331}," toServerSentEventsResponse",{"type":68,"tag":192,"props":3333,"children":3334},{"style":304},[3335],{"type":79,"value":3336},"(stream)\n",{"type":68,"tag":192,"props":3338,"children":3340},{"class":194,"line":3339},19,[3341],{"type":68,"tag":192,"props":3342,"children":3343},{"emptyLinePlaceholder":338},[3344],{"type":79,"value":341},{"type":68,"tag":192,"props":3346,"children":3348},{"class":194,"line":3347},20,[3349],{"type":68,"tag":192,"props":3350,"children":3351},{"style":488},[3352],{"type":79,"value":3353},"\u002F\u002F Option 2: explicit close after in-scope consumption\n",{"type":68,"tag":192,"props":3355,"children":3357},{"class":194,"line":3356},21,[3358,3362,3366,3370,3374,3378,3382],{"type":68,"tag":192,"props":3359,"children":3360},{"style":348},[3361],{"type":79,"value":351},{"type":68,"tag":192,"props":3363,"children":3364},{"style":304},[3365],{"type":79,"value":356},{"type":68,"tag":192,"props":3367,"children":3368},{"style":298},[3369],{"type":79,"value":361},{"type":68,"tag":192,"props":3371,"children":3372},{"style":292},[3373],{"type":79,"value":366},{"type":68,"tag":192,"props":3375,"children":3376},{"style":369},[3377],{"type":79,"value":307},{"type":68,"tag":192,"props":3379,"children":3380},{"style":304},[3381],{"type":79,"value":376},{"type":68,"tag":192,"props":3383,"children":3384},{"style":298},[3385],{"type":79,"value":381},{"type":68,"tag":192,"props":3387,"children":3389},{"class":194,"line":3388},22,[3390,3394,3398,3402,3406,3410,3414,3418,3422,3426,3430,3434,3438,3442,3446],{"type":68,"tag":192,"props":3391,"children":3392},{"style":388},[3393],{"type":79,"value":391},{"type":68,"tag":192,"props":3395,"children":3396},{"style":298},[3397],{"type":79,"value":396},{"type":68,"tag":192,"props":3399,"children":3400},{"style":298},[3401],{"type":79,"value":301},{"type":68,"tag":192,"props":3403,"children":3404},{"style":388},[3405],{"type":79,"value":405},{"type":68,"tag":192,"props":3407,"children":3408},{"style":298},[3409],{"type":79,"value":396},{"type":68,"tag":192,"props":3411,"children":3412},{"style":298},[3413],{"type":79,"value":322},{"type":68,"tag":192,"props":3415,"children":3416},{"style":205},[3417],{"type":79,"value":418},{"type":68,"tag":192,"props":3419,"children":3420},{"style":298},[3421],{"type":79,"value":423},{"type":68,"tag":192,"props":3423,"children":3424},{"style":298},[3425],{"type":79,"value":428},{"type":68,"tag":192,"props":3427,"children":3428},{"style":388},[3429],{"type":79,"value":433},{"type":68,"tag":192,"props":3431,"children":3432},{"style":298},[3433],{"type":79,"value":396},{"type":68,"tag":192,"props":3435,"children":3436},{"style":298},[3437],{"type":79,"value":322},{"type":68,"tag":192,"props":3439,"children":3440},{"style":205},[3441],{"type":79,"value":2979},{"type":68,"tag":192,"props":3443,"children":3444},{"style":298},[3445],{"type":79,"value":423},{"type":68,"tag":192,"props":3447,"children":3448},{"style":298},[3449],{"type":79,"value":455},{"type":68,"tag":192,"props":3451,"children":3453},{"class":194,"line":3452},23,[3454,3458],{"type":68,"tag":192,"props":3455,"children":3456},{"style":298},[3457],{"type":79,"value":535},{"type":68,"tag":192,"props":3459,"children":3460},{"style":304},[3461],{"type":79,"value":540},{"type":68,"tag":192,"props":3463,"children":3465},{"class":194,"line":3464},24,[3466,3471],{"type":68,"tag":192,"props":3467,"children":3468},{"style":292},[3469],{"type":79,"value":3470},"try",{"type":68,"tag":192,"props":3472,"children":3473},{"style":298},[3474],{"type":79,"value":634},{"type":68,"tag":192,"props":3476,"children":3478},{"class":194,"line":3477},25,[3479,3484,3489,3493,3497,3501],{"type":68,"tag":192,"props":3480,"children":3481},{"style":348},[3482],{"type":79,"value":3483},"  const",{"type":68,"tag":192,"props":3485,"children":3486},{"style":304},[3487],{"type":79,"value":3488}," stream",{"type":68,"tag":192,"props":3490,"children":3491},{"style":298},[3492],{"type":79,"value":1385},{"type":68,"tag":192,"props":3494,"children":3495},{"style":369},[3496],{"type":79,"value":1979},{"type":68,"tag":192,"props":3498,"children":3499},{"style":388},[3500],{"type":79,"value":376},{"type":68,"tag":192,"props":3502,"children":3503},{"style":298},[3504],{"type":79,"value":381},{"type":68,"tag":192,"props":3506,"children":3508},{"class":194,"line":3507},26,[3509,3514,3518,3522,3526,3530,3534,3538,3542],{"type":68,"tag":192,"props":3510,"children":3511},{"style":388},[3512],{"type":79,"value":3513},"    adapter",{"type":68,"tag":192,"props":3515,"children":3516},{"style":298},[3517],{"type":79,"value":396},{"type":68,"tag":192,"props":3519,"children":3520},{"style":369},[3521],{"type":79,"value":2004},{"type":68,"tag":192,"props":3523,"children":3524},{"style":388},[3525],{"type":79,"value":376},{"type":68,"tag":192,"props":3527,"children":3528},{"style":298},[3529],{"type":79,"value":423},{"type":68,"tag":192,"props":3531,"children":3532},{"style":205},[3533],{"type":79,"value":2017},{"type":68,"tag":192,"props":3535,"children":3536},{"style":298},[3537],{"type":79,"value":423},{"type":68,"tag":192,"props":3539,"children":3540},{"style":388},[3541],{"type":79,"value":1239},{"type":68,"tag":192,"props":3543,"children":3544},{"style":298},[3545],{"type":79,"value":663},{"type":68,"tag":192,"props":3547,"children":3549},{"class":194,"line":3548},27,[3550,3555],{"type":68,"tag":192,"props":3551,"children":3552},{"style":304},[3553],{"type":79,"value":3554},"    messages",{"type":68,"tag":192,"props":3556,"children":3557},{"style":298},[3558],{"type":79,"value":663},{"type":68,"tag":192,"props":3560,"children":3562},{"class":194,"line":3561},28,[3563,3568,3572,3576,3580,3584,3588,3592],{"type":68,"tag":192,"props":3564,"children":3565},{"style":388},[3566],{"type":79,"value":3567},"    tools",{"type":68,"tag":192,"props":3569,"children":3570},{"style":298},[3571],{"type":79,"value":396},{"type":68,"tag":192,"props":3573,"children":3574},{"style":292},[3575],{"type":79,"value":366},{"type":68,"tag":192,"props":3577,"children":3578},{"style":304},[3579],{"type":79,"value":1930},{"type":68,"tag":192,"props":3581,"children":3582},{"style":298},[3583],{"type":79,"value":230},{"type":68,"tag":192,"props":3585,"children":3586},{"style":369},[3587],{"type":79,"value":1939},{"type":68,"tag":192,"props":3589,"children":3590},{"style":388},[3591],{"type":79,"value":2558},{"type":68,"tag":192,"props":3593,"children":3594},{"style":298},[3595],{"type":79,"value":663},{"type":68,"tag":192,"props":3597,"children":3599},{"class":194,"line":3598},29,[3600,3604],{"type":68,"tag":192,"props":3601,"children":3602},{"style":298},[3603],{"type":79,"value":1234},{"type":68,"tag":192,"props":3605,"children":3606},{"style":388},[3607],{"type":79,"value":540},{"type":68,"tag":192,"props":3609,"children":3611},{"class":194,"line":3610},30,[3612,3617,3621,3626,3630,3635,3640,3644,3649],{"type":68,"tag":192,"props":3613,"children":3614},{"style":292},[3615],{"type":79,"value":3616},"  for",{"type":68,"tag":192,"props":3618,"children":3619},{"style":292},[3620],{"type":79,"value":366},{"type":68,"tag":192,"props":3622,"children":3623},{"style":388},[3624],{"type":79,"value":3625}," (",{"type":68,"tag":192,"props":3627,"children":3628},{"style":348},[3629],{"type":79,"value":351},{"type":68,"tag":192,"props":3631,"children":3632},{"style":304},[3633],{"type":79,"value":3634}," chunk",{"type":68,"tag":192,"props":3636,"children":3637},{"style":298},[3638],{"type":79,"value":3639}," of",{"type":68,"tag":192,"props":3641,"children":3642},{"style":304},[3643],{"type":79,"value":3488},{"type":68,"tag":192,"props":3645,"children":3646},{"style":388},[3647],{"type":79,"value":3648},") ",{"type":68,"tag":192,"props":3650,"children":3651},{"style":298},[3652],{"type":79,"value":381},{"type":68,"tag":192,"props":3654,"children":3656},{"class":194,"line":3655},31,[3657],{"type":68,"tag":192,"props":3658,"children":3659},{"style":488},[3660],{"type":79,"value":3661},"    \u002F\u002F stream fully consumed inside this block\n",{"type":68,"tag":192,"props":3663,"children":3665},{"class":194,"line":3664},32,[3666],{"type":68,"tag":192,"props":3667,"children":3668},{"style":298},[3669],{"type":79,"value":3670},"  }\n",{"type":68,"tag":192,"props":3672,"children":3674},{"class":194,"line":3673},33,[3675,3679,3684],{"type":68,"tag":192,"props":3676,"children":3677},{"style":298},[3678],{"type":79,"value":535},{"type":68,"tag":192,"props":3680,"children":3681},{"style":292},[3682],{"type":79,"value":3683}," finally",{"type":68,"tag":192,"props":3685,"children":3686},{"style":298},[3687],{"type":79,"value":634},{"type":68,"tag":192,"props":3689,"children":3691},{"class":194,"line":3690},34,[3692,3697,3701,3705,3709],{"type":68,"tag":192,"props":3693,"children":3694},{"style":292},[3695],{"type":79,"value":3696},"  await",{"type":68,"tag":192,"props":3698,"children":3699},{"style":304},[3700],{"type":79,"value":1930},{"type":68,"tag":192,"props":3702,"children":3703},{"style":298},[3704],{"type":79,"value":230},{"type":68,"tag":192,"props":3706,"children":3707},{"style":369},[3708],{"type":79,"value":3199},{"type":68,"tag":192,"props":3710,"children":3711},{"style":388},[3712],{"type":79,"value":1403},{"type":68,"tag":192,"props":3714,"children":3716},{"class":194,"line":3715},35,[3717],{"type":68,"tag":192,"props":3718,"children":3719},{"style":298},[3720],{"type":79,"value":3721},"}\n",{"type":68,"tag":192,"props":3723,"children":3725},{"class":194,"line":3724},36,[3726],{"type":68,"tag":192,"props":3727,"children":3728},{"emptyLinePlaceholder":338},[3729],{"type":79,"value":341},{"type":68,"tag":192,"props":3731,"children":3733},{"class":194,"line":3732},37,[3734],{"type":68,"tag":192,"props":3735,"children":3736},{"style":488},[3737],{"type":79,"value":3738},"\u002F\u002F Option 3: await using (TypeScript 5.2+ with Symbol.asyncDispose) —\n",{"type":68,"tag":192,"props":3740,"children":3742},{"class":194,"line":3741},38,[3743],{"type":68,"tag":192,"props":3744,"children":3745},{"style":488},[3746],{"type":79,"value":3747},"\u002F\u002F same rule: consume the stream before the scope exits.\n",{"type":68,"tag":192,"props":3749,"children":3751},{"class":194,"line":3750},39,[3752,3756,3760,3764,3768,3772,3776],{"type":68,"tag":192,"props":3753,"children":3754},{"style":348},[3755],{"type":79,"value":2875},{"type":68,"tag":192,"props":3757,"children":3758},{"style":304},[3759],{"type":79,"value":356},{"type":68,"tag":192,"props":3761,"children":3762},{"style":298},[3763],{"type":79,"value":361},{"type":68,"tag":192,"props":3765,"children":3766},{"style":292},[3767],{"type":79,"value":366},{"type":68,"tag":192,"props":3769,"children":3770},{"style":369},[3771],{"type":79,"value":307},{"type":68,"tag":192,"props":3773,"children":3774},{"style":304},[3775],{"type":79,"value":376},{"type":68,"tag":192,"props":3777,"children":3778},{"style":298},[3779],{"type":79,"value":381},{"type":68,"tag":192,"props":3781,"children":3783},{"class":194,"line":3782},40,[3784,3788,3792,3796,3800,3804,3808,3812,3816,3820,3824,3828,3832,3836,3840],{"type":68,"tag":192,"props":3785,"children":3786},{"style":388},[3787],{"type":79,"value":391},{"type":68,"tag":192,"props":3789,"children":3790},{"style":298},[3791],{"type":79,"value":396},{"type":68,"tag":192,"props":3793,"children":3794},{"style":298},[3795],{"type":79,"value":301},{"type":68,"tag":192,"props":3797,"children":3798},{"style":388},[3799],{"type":79,"value":405},{"type":68,"tag":192,"props":3801,"children":3802},{"style":298},[3803],{"type":79,"value":396},{"type":68,"tag":192,"props":3805,"children":3806},{"style":298},[3807],{"type":79,"value":322},{"type":68,"tag":192,"props":3809,"children":3810},{"style":205},[3811],{"type":79,"value":418},{"type":68,"tag":192,"props":3813,"children":3814},{"style":298},[3815],{"type":79,"value":423},{"type":68,"tag":192,"props":3817,"children":3818},{"style":298},[3819],{"type":79,"value":428},{"type":68,"tag":192,"props":3821,"children":3822},{"style":388},[3823],{"type":79,"value":433},{"type":68,"tag":192,"props":3825,"children":3826},{"style":298},[3827],{"type":79,"value":396},{"type":68,"tag":192,"props":3829,"children":3830},{"style":298},[3831],{"type":79,"value":322},{"type":68,"tag":192,"props":3833,"children":3834},{"style":205},[3835],{"type":79,"value":2979},{"type":68,"tag":192,"props":3837,"children":3838},{"style":298},[3839],{"type":79,"value":423},{"type":68,"tag":192,"props":3841,"children":3842},{"style":298},[3843],{"type":79,"value":455},{"type":68,"tag":192,"props":3845,"children":3847},{"class":194,"line":3846},41,[3848,3852],{"type":68,"tag":192,"props":3849,"children":3850},{"style":298},[3851],{"type":79,"value":535},{"type":68,"tag":192,"props":3853,"children":3854},{"style":304},[3855],{"type":79,"value":540},{"type":68,"tag":192,"props":3857,"children":3859},{"class":194,"line":3858},42,[3860],{"type":68,"tag":192,"props":3861,"children":3862},{"style":488},[3863],{"type":79,"value":3864},"\u002F\u002F ... consume the stream in this scope; close() runs at scope exit\n",{"type":68,"tag":111,"props":3866,"children":3868},{"id":3867},"chat-mcp-discovery-lifecycle-in-one-prop",[3869,3875],{"type":68,"tag":74,"props":3870,"children":3872},{"className":3871},[],[3873],{"type":79,"value":3874},"chat({ mcp })",{"type":79,"value":3876}," — discovery + lifecycle in one prop",{"type":68,"tag":82,"props":3878,"children":3879},{},[3880,3882,3887,3889,3895,3897,3902,3904,3909],{"type":79,"value":3881},"Rather than calling ",{"type":68,"tag":74,"props":3883,"children":3885},{"className":3884},[],[3886],{"type":79,"value":1888},{"type":79,"value":3888}," and ",{"type":68,"tag":74,"props":3890,"children":3892},{"className":3891},[],[3893],{"type":79,"value":3894},"client.close()",{"type":79,"value":3896}," yourself, pass the\n",{"type":68,"tag":74,"props":3898,"children":3900},{"className":3899},[],[3901],{"type":79,"value":14},{"type":79,"value":3903}," option to ",{"type":68,"tag":74,"props":3905,"children":3907},{"className":3906},[],[3908],{"type":79,"value":107},{"type":79,"value":3910}," and let it manage the full lifecycle.",{"type":68,"tag":181,"props":3912,"children":3914},{"className":281,"code":3913,"language":45,"meta":186,"style":186},"\u002F\u002F ChatMCPOptions shape:\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",[3915],{"type":68,"tag":74,"props":3916,"children":3917},{"__ignoreMap":186},[3918,3926,3934,3942,3955,3963,3971],{"type":68,"tag":192,"props":3919,"children":3920},{"class":194,"line":195},[3921],{"type":68,"tag":192,"props":3922,"children":3923},{"style":488},[3924],{"type":79,"value":3925},"\u002F\u002F ChatMCPOptions shape:\n",{"type":68,"tag":192,"props":3927,"children":3928},{"class":194,"line":334},[3929],{"type":68,"tag":192,"props":3930,"children":3931},{"style":488},[3932],{"type":79,"value":3933},"\u002F\u002F mcp: {\n",{"type":68,"tag":192,"props":3935,"children":3936},{"class":194,"line":344},[3937],{"type":68,"tag":192,"props":3938,"children":3939},{"style":488},[3940],{"type":79,"value":3941},"\u002F\u002F   clients: Array\u003CMCPClient | MCPClients>,\n",{"type":68,"tag":192,"props":3943,"children":3944},{"class":194,"line":384},[3945,3950],{"type":68,"tag":192,"props":3946,"children":3947},{"style":488},[3948],{"type":79,"value":3949},"\u002F\u002F   connection?: 'close' | 'keep-alive',",{"type":68,"tag":192,"props":3951,"children":3952},{"style":488},[3953],{"type":79,"value":3954},"  \u002F\u002F default: 'close'\n",{"type":68,"tag":192,"props":3956,"children":3957},{"class":194,"line":458},[3958],{"type":68,"tag":192,"props":3959,"children":3960},{"style":488},[3961],{"type":79,"value":3962},"\u002F\u002F   lazyTools?: boolean,\n",{"type":68,"tag":192,"props":3964,"children":3965},{"class":194,"line":494},[3966],{"type":68,"tag":192,"props":3967,"children":3968},{"style":488},[3969],{"type":79,"value":3970},"\u002F\u002F   onDiscoveryError?: (error: unknown, source) => void,\n",{"type":68,"tag":192,"props":3972,"children":3973},{"class":194,"line":529},[3974],{"type":68,"tag":192,"props":3975,"children":3976},{"style":488},[3977],{"type":79,"value":3978},"\u002F\u002F }\n",{"type":68,"tag":82,"props":3980,"children":3981},{},[3982],{"type":68,"tag":1476,"props":3983,"children":3984},{},[3985],{"type":79,"value":3986},"Behavior:",{"type":68,"tag":130,"props":3988,"children":3989},{},[3990,4016,4034,4059],{"type":68,"tag":134,"props":3991,"children":3992},{},[3993,3998,4000,4006,4008,4014],{"type":68,"tag":74,"props":3994,"children":3996},{"className":3995},[],[3997],{"type":79,"value":107},{"type":79,"value":3999}," calls ",{"type":68,"tag":74,"props":4001,"children":4003},{"className":4002},[],[4004],{"type":79,"value":4005},".tools()",{"type":79,"value":4007}," on every entry in ",{"type":68,"tag":74,"props":4009,"children":4011},{"className":4010},[],[4012],{"type":79,"value":4013},"clients",{"type":79,"value":4015}," at run start and merges\nall results into the tool list.",{"type":68,"tag":134,"props":4017,"children":4018},{},[4019,4025,4027,4033],{"type":68,"tag":74,"props":4020,"children":4022},{"className":4021},[],[4023],{"type":79,"value":4024},"lazyTools: true",{"type":79,"value":4026}," is forwarded to ",{"type":68,"tag":74,"props":4028,"children":4030},{"className":4029},[],[4031],{"type":79,"value":4032},"tools({ lazy: true })",{"type":79,"value":230},{"type":68,"tag":134,"props":4035,"children":4036},{},[4037,4043,4045,4051,4052,4057],{"type":68,"tag":74,"props":4038,"children":4040},{"className":4039},[],[4041],{"type":79,"value":4042},"connection: 'close'",{"type":79,"value":4044}," (default) — each client is closed when the run ends\n(after the agent loop completes and the stream is drained). With\n",{"type":68,"tag":74,"props":4046,"children":4048},{"className":4047},[],[4049],{"type":79,"value":4050},"'keep-alive'",{"type":79,"value":240},{"type":68,"tag":74,"props":4053,"children":4055},{"className":4054},[],[4056],{"type":79,"value":107},{"type":79,"value":4058}," never closes the clients — the caller owns their\nlifecycle (keep connections warm across requests).",{"type":68,"tag":134,"props":4060,"children":4061},{},[4062,4068],{"type":68,"tag":74,"props":4063,"children":4065},{"className":4064},[],[4066],{"type":79,"value":4067},"onDiscoveryError",{"type":79,"value":4069},": throw (or re-throw) to abort the entire call; return\nnormally to skip that source and continue. Omitting the handler re-throws\n(fail-fast).",{"type":68,"tag":82,"props":4071,"children":4072},{},[4073],{"type":68,"tag":1476,"props":4074,"children":4075},{},[4076,4078,4083],{"type":79,"value":4077},"When to use ",{"type":68,"tag":74,"props":4079,"children":4081},{"className":4080},[],[4082],{"type":79,"value":14},{"type":79,"value":4084}," vs. the tools spread:",{"type":68,"tag":4086,"props":4087,"children":4088},"table",{},[4089,4108],{"type":68,"tag":4090,"props":4091,"children":4092},"thead",{},[4093],{"type":68,"tag":4094,"props":4095,"children":4096},"tr",{},[4097,4103],{"type":68,"tag":4098,"props":4099,"children":4100},"th",{},[4101],{"type":79,"value":4102},"Approach",{"type":68,"tag":4098,"props":4104,"children":4105},{},[4106],{"type":79,"value":4107},"Use when",{"type":68,"tag":4109,"props":4110,"children":4111},"tbody",{},[4112,4130],{"type":68,"tag":4094,"props":4113,"children":4114},{},[4115,4125],{"type":68,"tag":4116,"props":4117,"children":4118},"td",{},[4119],{"type":68,"tag":74,"props":4120,"children":4122},{"className":4121},[],[4123],{"type":79,"value":4124},"chat({ mcp: { clients: [...] } })",{"type":68,"tag":4116,"props":4126,"children":4127},{},[4128],{"type":79,"value":4129},"Convenience: discovery + lifecycle handled for you; untyped args are fine",{"type":68,"tag":4094,"props":4131,"children":4132},{},[4133,4142],{"type":68,"tag":4116,"props":4134,"children":4135},{},[4136],{"type":68,"tag":74,"props":4137,"children":4139},{"className":4138},[],[4140],{"type":79,"value":4141},"tools: [...await client.tools([toolDefinition(...)])]",{"type":68,"tag":4116,"props":4143,"children":4144},{},[4145,4147,4152],{"type":79,"value":4146},"Fully-typed args\u002Fresults via Zod schemas (",{"type":68,"tag":74,"props":4148,"children":4150},{"className":4149},[],[4151],{"type":79,"value":2164},{"type":79,"value":4153}," mode)",{"type":68,"tag":82,"props":4155,"children":4156},{},[4157],{"type":68,"tag":1476,"props":4158,"children":4159},{},[4160],{"type":79,"value":4161},"Server-side example:",{"type":68,"tag":181,"props":4163,"children":4165},{"className":281,"code":4164,"language":45,"meta":186,"style":186},"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', \u002F\u002F chat() won't close it — reuse across requests\n            onDiscoveryError: (err, source) => {\n              console.warn('MCP discovery failed for source, skipping:', err)\n              \u002F\u002F returning skips this source; throw to fail the whole call fast\n            },\n          },\n        })\n\n        return toServerSentEventsResponse(stream)\n        \u002F\u002F connection: 'keep-alive' — chat() never closes mcpClient; it stays warm for the next request.\n      },\n    },\n  },\n})\n",[4166],{"type":68,"tag":74,"props":4167,"children":4168},{"__ignoreMap":186},[4169,4206,4249,4285,4320,4327,4378,4394,4410,4451,4497,4504,4536,4600,4612,4619,4646,4686,4698,4714,4743,4777,4819,4866,4874,4882,4890,4901,4908,4933,4941,4949,4956,4963],{"type":68,"tag":192,"props":4170,"children":4171},{"class":194,"line":195},[4172,4176,4180,4185,4189,4193,4197,4202],{"type":68,"tag":192,"props":4173,"children":4174},{"style":292},[4175],{"type":79,"value":295},{"type":68,"tag":192,"props":4177,"children":4178},{"style":298},[4179],{"type":79,"value":301},{"type":68,"tag":192,"props":4181,"children":4182},{"style":304},[4183],{"type":79,"value":4184}," createFileRoute",{"type":68,"tag":192,"props":4186,"children":4187},{"style":298},[4188],{"type":79,"value":312},{"type":68,"tag":192,"props":4190,"children":4191},{"style":292},[4192],{"type":79,"value":317},{"type":68,"tag":192,"props":4194,"children":4195},{"style":298},[4196],{"type":79,"value":322},{"type":68,"tag":192,"props":4198,"children":4199},{"style":205},[4200],{"type":79,"value":4201},"@tanstack\u002Freact-router",{"type":68,"tag":192,"props":4203,"children":4204},{"style":298},[4205],{"type":79,"value":331},{"type":68,"tag":192,"props":4207,"children":4208},{"class":194,"line":334},[4209,4213,4217,4221,4225,4229,4233,4237,4241,4245],{"type":68,"tag":192,"props":4210,"children":4211},{"style":292},[4212],{"type":79,"value":295},{"type":68,"tag":192,"props":4214,"children":4215},{"style":298},[4216],{"type":79,"value":301},{"type":68,"tag":192,"props":4218,"children":4219},{"style":304},[4220],{"type":79,"value":1979},{"type":68,"tag":192,"props":4222,"children":4223},{"style":298},[4224],{"type":79,"value":428},{"type":68,"tag":192,"props":4226,"children":4227},{"style":304},[4228],{"type":79,"value":3331},{"type":68,"tag":192,"props":4230,"children":4231},{"style":298},[4232],{"type":79,"value":312},{"type":68,"tag":192,"props":4234,"children":4235},{"style":292},[4236],{"type":79,"value":317},{"type":68,"tag":192,"props":4238,"children":4239},{"style":298},[4240],{"type":79,"value":322},{"type":68,"tag":192,"props":4242,"children":4243},{"style":205},[4244],{"type":79,"value":2259},{"type":68,"tag":192,"props":4246,"children":4247},{"style":298},[4248],{"type":79,"value":331},{"type":68,"tag":192,"props":4250,"children":4251},{"class":194,"line":344},[4252,4256,4260,4264,4268,4272,4276,4281],{"type":68,"tag":192,"props":4253,"children":4254},{"style":292},[4255],{"type":79,"value":295},{"type":68,"tag":192,"props":4257,"children":4258},{"style":298},[4259],{"type":79,"value":301},{"type":68,"tag":192,"props":4261,"children":4262},{"style":304},[4263],{"type":79,"value":2004},{"type":68,"tag":192,"props":4265,"children":4266},{"style":298},[4267],{"type":79,"value":312},{"type":68,"tag":192,"props":4269,"children":4270},{"style":292},[4271],{"type":79,"value":317},{"type":68,"tag":192,"props":4273,"children":4274},{"style":298},[4275],{"type":79,"value":322},{"type":68,"tag":192,"props":4277,"children":4278},{"style":205},[4279],{"type":79,"value":4280},"@tanstack\u002Fai-openai",{"type":68,"tag":192,"props":4282,"children":4283},{"style":298},[4284],{"type":79,"value":331},{"type":68,"tag":192,"props":4286,"children":4287},{"class":194,"line":384},[4288,4292,4296,4300,4304,4308,4312,4316],{"type":68,"tag":192,"props":4289,"children":4290},{"style":292},[4291],{"type":79,"value":295},{"type":68,"tag":192,"props":4293,"children":4294},{"style":298},[4295],{"type":79,"value":301},{"type":68,"tag":192,"props":4297,"children":4298},{"style":304},[4299],{"type":79,"value":307},{"type":68,"tag":192,"props":4301,"children":4302},{"style":298},[4303],{"type":79,"value":312},{"type":68,"tag":192,"props":4305,"children":4306},{"style":292},[4307],{"type":79,"value":317},{"type":68,"tag":192,"props":4309,"children":4310},{"style":298},[4311],{"type":79,"value":322},{"type":68,"tag":192,"props":4313,"children":4314},{"style":205},[4315],{"type":79,"value":80},{"type":68,"tag":192,"props":4317,"children":4318},{"style":298},[4319],{"type":79,"value":331},{"type":68,"tag":192,"props":4321,"children":4322},{"class":194,"line":458},[4323],{"type":68,"tag":192,"props":4324,"children":4325},{"emptyLinePlaceholder":338},[4326],{"type":79,"value":341},{"type":68,"tag":192,"props":4328,"children":4329},{"class":194,"line":494},[4330,4335,4339,4344,4348,4352,4356,4360,4365,4369,4374],{"type":68,"tag":192,"props":4331,"children":4332},{"style":292},[4333],{"type":79,"value":4334},"export",{"type":68,"tag":192,"props":4336,"children":4337},{"style":348},[4338],{"type":79,"value":1659},{"type":68,"tag":192,"props":4340,"children":4341},{"style":304},[4342],{"type":79,"value":4343}," Route ",{"type":68,"tag":192,"props":4345,"children":4346},{"style":298},[4347],{"type":79,"value":361},{"type":68,"tag":192,"props":4349,"children":4350},{"style":369},[4351],{"type":79,"value":4184},{"type":68,"tag":192,"props":4353,"children":4354},{"style":304},[4355],{"type":79,"value":376},{"type":68,"tag":192,"props":4357,"children":4358},{"style":298},[4359],{"type":79,"value":423},{"type":68,"tag":192,"props":4361,"children":4362},{"style":205},[4363],{"type":79,"value":4364},"\u002Fapi\u002Fchat",{"type":68,"tag":192,"props":4366,"children":4367},{"style":298},[4368],{"type":79,"value":423},{"type":68,"tag":192,"props":4370,"children":4371},{"style":304},[4372],{"type":79,"value":4373},")(",{"type":68,"tag":192,"props":4375,"children":4376},{"style":298},[4377],{"type":79,"value":381},{"type":68,"tag":192,"props":4379,"children":4380},{"class":194,"line":529},[4381,4386,4390],{"type":68,"tag":192,"props":4382,"children":4383},{"style":388},[4384],{"type":79,"value":4385},"  server",{"type":68,"tag":192,"props":4387,"children":4388},{"style":298},[4389],{"type":79,"value":396},{"type":68,"tag":192,"props":4391,"children":4392},{"style":298},[4393],{"type":79,"value":634},{"type":68,"tag":192,"props":4395,"children":4396},{"class":194,"line":1165},[4397,4402,4406],{"type":68,"tag":192,"props":4398,"children":4399},{"style":388},[4400],{"type":79,"value":4401},"    handlers",{"type":68,"tag":192,"props":4403,"children":4404},{"style":298},[4405],{"type":79,"value":396},{"type":68,"tag":192,"props":4407,"children":4408},{"style":298},[4409],{"type":79,"value":634},{"type":68,"tag":192,"props":4411,"children":4412},{"class":194,"line":1228},[4413,4418,4422,4427,4432,4438,4443,4447],{"type":68,"tag":192,"props":4414,"children":4415},{"style":369},[4416],{"type":79,"value":4417},"      POST",{"type":68,"tag":192,"props":4419,"children":4420},{"style":298},[4421],{"type":79,"value":396},{"type":68,"tag":192,"props":4423,"children":4424},{"style":348},[4425],{"type":79,"value":4426}," async",{"type":68,"tag":192,"props":4428,"children":4429},{"style":298},[4430],{"type":79,"value":4431}," ({",{"type":68,"tag":192,"props":4433,"children":4435},{"style":4434},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic",[4436],{"type":79,"value":4437}," request",{"type":68,"tag":192,"props":4439,"children":4440},{"style":298},[4441],{"type":79,"value":4442}," })",{"type":68,"tag":192,"props":4444,"children":4445},{"style":348},[4446],{"type":79,"value":3186},{"type":68,"tag":192,"props":4448,"children":4449},{"style":298},[4450],{"type":79,"value":634},{"type":68,"tag":192,"props":4452,"children":4453},{"class":194,"line":1246},[4454,4459,4463,4468,4472,4476,4480,4484,4488,4493],{"type":68,"tag":192,"props":4455,"children":4456},{"style":348},[4457],{"type":79,"value":4458},"        const",{"type":68,"tag":192,"props":4460,"children":4461},{"style":298},[4462],{"type":79,"value":301},{"type":68,"tag":192,"props":4464,"children":4465},{"style":304},[4466],{"type":79,"value":4467}," messages",{"type":68,"tag":192,"props":4469,"children":4470},{"style":298},[4471],{"type":79,"value":312},{"type":68,"tag":192,"props":4473,"children":4474},{"style":298},[4475],{"type":79,"value":1385},{"type":68,"tag":192,"props":4477,"children":4478},{"style":292},[4479],{"type":79,"value":366},{"type":68,"tag":192,"props":4481,"children":4482},{"style":304},[4483],{"type":79,"value":4437},{"type":68,"tag":192,"props":4485,"children":4486},{"style":298},[4487],{"type":79,"value":230},{"type":68,"tag":192,"props":4489,"children":4490},{"style":369},[4491],{"type":79,"value":4492},"json",{"type":68,"tag":192,"props":4494,"children":4495},{"style":388},[4496],{"type":79,"value":1403},{"type":68,"tag":192,"props":4498,"children":4499},{"class":194,"line":1807},[4500],{"type":68,"tag":192,"props":4501,"children":4502},{"emptyLinePlaceholder":338},[4503],{"type":79,"value":341},{"type":68,"tag":192,"props":4505,"children":4506},{"class":194,"line":1815},[4507,4511,4516,4520,4524,4528,4532],{"type":68,"tag":192,"props":4508,"children":4509},{"style":348},[4510],{"type":79,"value":4458},{"type":68,"tag":192,"props":4512,"children":4513},{"style":304},[4514],{"type":79,"value":4515}," mcpClient",{"type":68,"tag":192,"props":4517,"children":4518},{"style":298},[4519],{"type":79,"value":1385},{"type":68,"tag":192,"props":4521,"children":4522},{"style":292},[4523],{"type":79,"value":366},{"type":68,"tag":192,"props":4525,"children":4526},{"style":369},[4527],{"type":79,"value":307},{"type":68,"tag":192,"props":4529,"children":4530},{"style":388},[4531],{"type":79,"value":376},{"type":68,"tag":192,"props":4533,"children":4534},{"style":298},[4535],{"type":79,"value":381},{"type":68,"tag":192,"props":4537,"children":4538},{"class":194,"line":2651},[4539,4544,4548,4552,4556,4560,4564,4568,4572,4576,4580,4584,4588,4592,4596],{"type":68,"tag":192,"props":4540,"children":4541},{"style":388},[4542],{"type":79,"value":4543},"          transport",{"type":68,"tag":192,"props":4545,"children":4546},{"style":298},[4547],{"type":79,"value":396},{"type":68,"tag":192,"props":4549,"children":4550},{"style":298},[4551],{"type":79,"value":301},{"type":68,"tag":192,"props":4553,"children":4554},{"style":388},[4555],{"type":79,"value":405},{"type":68,"tag":192,"props":4557,"children":4558},{"style":298},[4559],{"type":79,"value":396},{"type":68,"tag":192,"props":4561,"children":4562},{"style":298},[4563],{"type":79,"value":322},{"type":68,"tag":192,"props":4565,"children":4566},{"style":205},[4567],{"type":79,"value":418},{"type":68,"tag":192,"props":4569,"children":4570},{"style":298},[4571],{"type":79,"value":423},{"type":68,"tag":192,"props":4573,"children":4574},{"style":298},[4575],{"type":79,"value":428},{"type":68,"tag":192,"props":4577,"children":4578},{"style":388},[4579],{"type":79,"value":433},{"type":68,"tag":192,"props":4581,"children":4582},{"style":298},[4583],{"type":79,"value":396},{"type":68,"tag":192,"props":4585,"children":4586},{"style":298},[4587],{"type":79,"value":322},{"type":68,"tag":192,"props":4589,"children":4590},{"style":205},[4591],{"type":79,"value":446},{"type":68,"tag":192,"props":4593,"children":4594},{"style":298},[4595],{"type":79,"value":423},{"type":68,"tag":192,"props":4597,"children":4598},{"style":298},[4599],{"type":79,"value":455},{"type":68,"tag":192,"props":4601,"children":4602},{"class":194,"line":2715},[4603,4608],{"type":68,"tag":192,"props":4604,"children":4605},{"style":298},[4606],{"type":79,"value":4607},"        }",{"type":68,"tag":192,"props":4609,"children":4610},{"style":388},[4611],{"type":79,"value":540},{"type":68,"tag":192,"props":4613,"children":4614},{"class":194,"line":2727},[4615],{"type":68,"tag":192,"props":4616,"children":4617},{"emptyLinePlaceholder":338},[4618],{"type":79,"value":341},{"type":68,"tag":192,"props":4620,"children":4621},{"class":194,"line":2735},[4622,4626,4630,4634,4638,4642],{"type":68,"tag":192,"props":4623,"children":4624},{"style":348},[4625],{"type":79,"value":4458},{"type":68,"tag":192,"props":4627,"children":4628},{"style":304},[4629],{"type":79,"value":3488},{"type":68,"tag":192,"props":4631,"children":4632},{"style":298},[4633],{"type":79,"value":1385},{"type":68,"tag":192,"props":4635,"children":4636},{"style":369},[4637],{"type":79,"value":1979},{"type":68,"tag":192,"props":4639,"children":4640},{"style":388},[4641],{"type":79,"value":376},{"type":68,"tag":192,"props":4643,"children":4644},{"style":298},[4645],{"type":79,"value":381},{"type":68,"tag":192,"props":4647,"children":4648},{"class":194,"line":2744},[4649,4654,4658,4662,4666,4670,4674,4678,4682],{"type":68,"tag":192,"props":4650,"children":4651},{"style":388},[4652],{"type":79,"value":4653},"          adapter",{"type":68,"tag":192,"props":4655,"children":4656},{"style":298},[4657],{"type":79,"value":396},{"type":68,"tag":192,"props":4659,"children":4660},{"style":369},[4661],{"type":79,"value":2004},{"type":68,"tag":192,"props":4663,"children":4664},{"style":388},[4665],{"type":79,"value":376},{"type":68,"tag":192,"props":4667,"children":4668},{"style":298},[4669],{"type":79,"value":423},{"type":68,"tag":192,"props":4671,"children":4672},{"style":205},[4673],{"type":79,"value":2017},{"type":68,"tag":192,"props":4675,"children":4676},{"style":298},[4677],{"type":79,"value":423},{"type":68,"tag":192,"props":4679,"children":4680},{"style":388},[4681],{"type":79,"value":1239},{"type":68,"tag":192,"props":4683,"children":4684},{"style":298},[4685],{"type":79,"value":663},{"type":68,"tag":192,"props":4687,"children":4688},{"class":194,"line":3321},[4689,4694],{"type":68,"tag":192,"props":4690,"children":4691},{"style":304},[4692],{"type":79,"value":4693},"          messages",{"type":68,"tag":192,"props":4695,"children":4696},{"style":298},[4697],{"type":79,"value":663},{"type":68,"tag":192,"props":4699,"children":4700},{"class":194,"line":3339},[4701,4706,4710],{"type":68,"tag":192,"props":4702,"children":4703},{"style":388},[4704],{"type":79,"value":4705},"          mcp",{"type":68,"tag":192,"props":4707,"children":4708},{"style":298},[4709],{"type":79,"value":396},{"type":68,"tag":192,"props":4711,"children":4712},{"style":298},[4713],{"type":79,"value":634},{"type":68,"tag":192,"props":4715,"children":4716},{"class":194,"line":3347},[4717,4722,4726,4730,4735,4739],{"type":68,"tag":192,"props":4718,"children":4719},{"style":388},[4720],{"type":79,"value":4721},"            clients",{"type":68,"tag":192,"props":4723,"children":4724},{"style":298},[4725],{"type":79,"value":396},{"type":68,"tag":192,"props":4727,"children":4728},{"style":388},[4729],{"type":79,"value":1123},{"type":68,"tag":192,"props":4731,"children":4732},{"style":304},[4733],{"type":79,"value":4734},"mcpClient",{"type":68,"tag":192,"props":4736,"children":4737},{"style":388},[4738],{"type":79,"value":1158},{"type":68,"tag":192,"props":4740,"children":4741},{"style":298},[4742],{"type":79,"value":663},{"type":68,"tag":192,"props":4744,"children":4745},{"class":194,"line":3356},[4746,4751,4755,4759,4764,4768,4772],{"type":68,"tag":192,"props":4747,"children":4748},{"style":388},[4749],{"type":79,"value":4750},"            connection",{"type":68,"tag":192,"props":4752,"children":4753},{"style":298},[4754],{"type":79,"value":396},{"type":68,"tag":192,"props":4756,"children":4757},{"style":298},[4758],{"type":79,"value":322},{"type":68,"tag":192,"props":4760,"children":4761},{"style":205},[4762],{"type":79,"value":4763},"keep-alive",{"type":68,"tag":192,"props":4765,"children":4766},{"style":298},[4767],{"type":79,"value":423},{"type":68,"tag":192,"props":4769,"children":4770},{"style":298},[4771],{"type":79,"value":428},{"type":68,"tag":192,"props":4773,"children":4774},{"style":488},[4775],{"type":79,"value":4776}," \u002F\u002F chat() won't close it — reuse across requests\n",{"type":68,"tag":192,"props":4778,"children":4779},{"class":194,"line":3388},[4780,4785,4789,4793,4798,4802,4807,4811,4815],{"type":68,"tag":192,"props":4781,"children":4782},{"style":369},[4783],{"type":79,"value":4784},"            onDiscoveryError",{"type":68,"tag":192,"props":4786,"children":4787},{"style":298},[4788],{"type":79,"value":396},{"type":68,"tag":192,"props":4790,"children":4791},{"style":298},[4792],{"type":79,"value":3625},{"type":68,"tag":192,"props":4794,"children":4795},{"style":4434},[4796],{"type":79,"value":4797},"err",{"type":68,"tag":192,"props":4799,"children":4800},{"style":298},[4801],{"type":79,"value":428},{"type":68,"tag":192,"props":4803,"children":4804},{"style":4434},[4805],{"type":79,"value":4806}," source",{"type":68,"tag":192,"props":4808,"children":4809},{"style":298},[4810],{"type":79,"value":1239},{"type":68,"tag":192,"props":4812,"children":4813},{"style":348},[4814],{"type":79,"value":3186},{"type":68,"tag":192,"props":4816,"children":4817},{"style":298},[4818],{"type":79,"value":634},{"type":68,"tag":192,"props":4820,"children":4821},{"class":194,"line":3452},[4822,4827,4831,4836,4840,4844,4849,4853,4857,4862],{"type":68,"tag":192,"props":4823,"children":4824},{"style":304},[4825],{"type":79,"value":4826},"              console",{"type":68,"tag":192,"props":4828,"children":4829},{"style":298},[4830],{"type":79,"value":230},{"type":68,"tag":192,"props":4832,"children":4833},{"style":369},[4834],{"type":79,"value":4835},"warn",{"type":68,"tag":192,"props":4837,"children":4838},{"style":388},[4839],{"type":79,"value":376},{"type":68,"tag":192,"props":4841,"children":4842},{"style":298},[4843],{"type":79,"value":423},{"type":68,"tag":192,"props":4845,"children":4846},{"style":205},[4847],{"type":79,"value":4848},"MCP discovery failed for source, skipping:",{"type":68,"tag":192,"props":4850,"children":4851},{"style":298},[4852],{"type":79,"value":423},{"type":68,"tag":192,"props":4854,"children":4855},{"style":298},[4856],{"type":79,"value":428},{"type":68,"tag":192,"props":4858,"children":4859},{"style":304},[4860],{"type":79,"value":4861}," err",{"type":68,"tag":192,"props":4863,"children":4864},{"style":388},[4865],{"type":79,"value":540},{"type":68,"tag":192,"props":4867,"children":4868},{"class":194,"line":3464},[4869],{"type":68,"tag":192,"props":4870,"children":4871},{"style":488},[4872],{"type":79,"value":4873},"              \u002F\u002F returning skips this source; throw to fail the whole call fast\n",{"type":68,"tag":192,"props":4875,"children":4876},{"class":194,"line":3477},[4877],{"type":68,"tag":192,"props":4878,"children":4879},{"style":298},[4880],{"type":79,"value":4881},"            },\n",{"type":68,"tag":192,"props":4883,"children":4884},{"class":194,"line":3507},[4885],{"type":68,"tag":192,"props":4886,"children":4887},{"style":298},[4888],{"type":79,"value":4889},"          },\n",{"type":68,"tag":192,"props":4891,"children":4892},{"class":194,"line":3548},[4893,4897],{"type":68,"tag":192,"props":4894,"children":4895},{"style":298},[4896],{"type":79,"value":4607},{"type":68,"tag":192,"props":4898,"children":4899},{"style":388},[4900],{"type":79,"value":540},{"type":68,"tag":192,"props":4902,"children":4903},{"class":194,"line":3561},[4904],{"type":68,"tag":192,"props":4905,"children":4906},{"emptyLinePlaceholder":338},[4907],{"type":79,"value":341},{"type":68,"tag":192,"props":4909,"children":4910},{"class":194,"line":3598},[4911,4916,4920,4924,4929],{"type":68,"tag":192,"props":4912,"children":4913},{"style":292},[4914],{"type":79,"value":4915},"        return",{"type":68,"tag":192,"props":4917,"children":4918},{"style":369},[4919],{"type":79,"value":3331},{"type":68,"tag":192,"props":4921,"children":4922},{"style":388},[4923],{"type":79,"value":376},{"type":68,"tag":192,"props":4925,"children":4926},{"style":304},[4927],{"type":79,"value":4928},"stream",{"type":68,"tag":192,"props":4930,"children":4931},{"style":388},[4932],{"type":79,"value":540},{"type":68,"tag":192,"props":4934,"children":4935},{"class":194,"line":3610},[4936],{"type":68,"tag":192,"props":4937,"children":4938},{"style":488},[4939],{"type":79,"value":4940},"        \u002F\u002F connection: 'keep-alive' — chat() never closes mcpClient; it stays warm for the next request.\n",{"type":68,"tag":192,"props":4942,"children":4943},{"class":194,"line":3655},[4944],{"type":68,"tag":192,"props":4945,"children":4946},{"style":298},[4947],{"type":79,"value":4948},"      },\n",{"type":68,"tag":192,"props":4950,"children":4951},{"class":194,"line":3664},[4952],{"type":68,"tag":192,"props":4953,"children":4954},{"style":298},[4955],{"type":79,"value":3295},{"type":68,"tag":192,"props":4957,"children":4958},{"class":194,"line":3673},[4959],{"type":68,"tag":192,"props":4960,"children":4961},{"style":298},[4962],{"type":79,"value":741},{"type":68,"tag":192,"props":4964,"children":4965},{"class":194,"line":3690},[4966,4970],{"type":68,"tag":192,"props":4967,"children":4968},{"style":298},[4969],{"type":79,"value":535},{"type":68,"tag":192,"props":4971,"children":4972},{"style":304},[4973],{"type":79,"value":540},{"type":68,"tag":82,"props":4975,"children":4976},{},[4977,4979,4985],{"type":79,"value":4978},"You can also pass an ",{"type":68,"tag":74,"props":4980,"children":4982},{"className":4981},[],[4983],{"type":79,"value":4984},"MCPClients",{"type":79,"value":4986}," pool directly:",{"type":68,"tag":181,"props":4988,"children":4990},{"className":281,"code":4989,"language":45,"meta":186,"style":186},"const 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\nconst stream = chat({\n  adapter: openaiText('gpt-5.5'),\n  messages,\n  mcp: { clients: [pool], connection: 'keep-alive' },\n})\n",[4991],{"type":68,"tag":74,"props":4992,"children":4993},{"__ignoreMap":186},[4994,5027,5108,5189,5200,5207,5234,5273,5284,5343],{"type":68,"tag":192,"props":4995,"children":4996},{"class":194,"line":195},[4997,5001,5006,5010,5014,5019,5023],{"type":68,"tag":192,"props":4998,"children":4999},{"style":348},[5000],{"type":79,"value":351},{"type":68,"tag":192,"props":5002,"children":5003},{"style":304},[5004],{"type":79,"value":5005}," pool ",{"type":68,"tag":192,"props":5007,"children":5008},{"style":298},[5009],{"type":79,"value":361},{"type":68,"tag":192,"props":5011,"children":5012},{"style":292},[5013],{"type":79,"value":366},{"type":68,"tag":192,"props":5015,"children":5016},{"style":369},[5017],{"type":79,"value":5018}," createMCPClients",{"type":68,"tag":192,"props":5020,"children":5021},{"style":304},[5022],{"type":79,"value":376},{"type":68,"tag":192,"props":5024,"children":5025},{"style":298},[5026],{"type":79,"value":381},{"type":68,"tag":192,"props":5028,"children":5029},{"class":194,"line":334},[5030,5035,5039,5043,5047,5051,5055,5059,5063,5067,5071,5075,5079,5083,5087,5091,5096,5100,5104],{"type":68,"tag":192,"props":5031,"children":5032},{"style":388},[5033],{"type":79,"value":5034},"  github",{"type":68,"tag":192,"props":5036,"children":5037},{"style":298},[5038],{"type":79,"value":396},{"type":68,"tag":192,"props":5040,"children":5041},{"style":298},[5042],{"type":79,"value":301},{"type":68,"tag":192,"props":5044,"children":5045},{"style":388},[5046],{"type":79,"value":1440},{"type":68,"tag":192,"props":5048,"children":5049},{"style":298},[5050],{"type":79,"value":396},{"type":68,"tag":192,"props":5052,"children":5053},{"style":298},[5054],{"type":79,"value":301},{"type":68,"tag":192,"props":5056,"children":5057},{"style":388},[5058],{"type":79,"value":405},{"type":68,"tag":192,"props":5060,"children":5061},{"style":298},[5062],{"type":79,"value":396},{"type":68,"tag":192,"props":5064,"children":5065},{"style":298},[5066],{"type":79,"value":322},{"type":68,"tag":192,"props":5068,"children":5069},{"style":205},[5070],{"type":79,"value":418},{"type":68,"tag":192,"props":5072,"children":5073},{"style":298},[5074],{"type":79,"value":423},{"type":68,"tag":192,"props":5076,"children":5077},{"style":298},[5078],{"type":79,"value":428},{"type":68,"tag":192,"props":5080,"children":5081},{"style":388},[5082],{"type":79,"value":433},{"type":68,"tag":192,"props":5084,"children":5085},{"style":298},[5086],{"type":79,"value":396},{"type":68,"tag":192,"props":5088,"children":5089},{"style":298},[5090],{"type":79,"value":322},{"type":68,"tag":192,"props":5092,"children":5093},{"style":205},[5094],{"type":79,"value":5095},"https:\u002F\u002Fmcp.github.com\u002Fmcp",{"type":68,"tag":192,"props":5097,"children":5098},{"style":298},[5099],{"type":79,"value":423},{"type":68,"tag":192,"props":5101,"children":5102},{"style":298},[5103],{"type":79,"value":312},{"type":68,"tag":192,"props":5105,"children":5106},{"style":298},[5107],{"type":79,"value":455},{"type":68,"tag":192,"props":5109,"children":5110},{"class":194,"line":344},[5111,5116,5120,5124,5128,5132,5136,5140,5144,5148,5152,5156,5160,5164,5168,5172,5177,5181,5185],{"type":68,"tag":192,"props":5112,"children":5113},{"style":388},[5114],{"type":79,"value":5115},"  linear",{"type":68,"tag":192,"props":5117,"children":5118},{"style":298},[5119],{"type":79,"value":396},{"type":68,"tag":192,"props":5121,"children":5122},{"style":298},[5123],{"type":79,"value":301},{"type":68,"tag":192,"props":5125,"children":5126},{"style":388},[5127],{"type":79,"value":1440},{"type":68,"tag":192,"props":5129,"children":5130},{"style":298},[5131],{"type":79,"value":396},{"type":68,"tag":192,"props":5133,"children":5134},{"style":298},[5135],{"type":79,"value":301},{"type":68,"tag":192,"props":5137,"children":5138},{"style":388},[5139],{"type":79,"value":405},{"type":68,"tag":192,"props":5141,"children":5142},{"style":298},[5143],{"type":79,"value":396},{"type":68,"tag":192,"props":5145,"children":5146},{"style":298},[5147],{"type":79,"value":322},{"type":68,"tag":192,"props":5149,"children":5150},{"style":205},[5151],{"type":79,"value":418},{"type":68,"tag":192,"props":5153,"children":5154},{"style":298},[5155],{"type":79,"value":423},{"type":68,"tag":192,"props":5157,"children":5158},{"style":298},[5159],{"type":79,"value":428},{"type":68,"tag":192,"props":5161,"children":5162},{"style":388},[5163],{"type":79,"value":433},{"type":68,"tag":192,"props":5165,"children":5166},{"style":298},[5167],{"type":79,"value":396},{"type":68,"tag":192,"props":5169,"children":5170},{"style":298},[5171],{"type":79,"value":322},{"type":68,"tag":192,"props":5173,"children":5174},{"style":205},[5175],{"type":79,"value":5176},"https:\u002F\u002Fmcp.linear.app\u002Fmcp",{"type":68,"tag":192,"props":5178,"children":5179},{"style":298},[5180],{"type":79,"value":423},{"type":68,"tag":192,"props":5182,"children":5183},{"style":298},[5184],{"type":79,"value":312},{"type":68,"tag":192,"props":5186,"children":5187},{"style":298},[5188],{"type":79,"value":455},{"type":68,"tag":192,"props":5190,"children":5191},{"class":194,"line":384},[5192,5196],{"type":68,"tag":192,"props":5193,"children":5194},{"style":298},[5195],{"type":79,"value":535},{"type":68,"tag":192,"props":5197,"children":5198},{"style":304},[5199],{"type":79,"value":540},{"type":68,"tag":192,"props":5201,"children":5202},{"class":194,"line":458},[5203],{"type":68,"tag":192,"props":5204,"children":5205},{"emptyLinePlaceholder":338},[5206],{"type":79,"value":341},{"type":68,"tag":192,"props":5208,"children":5209},{"class":194,"line":494},[5210,5214,5218,5222,5226,5230],{"type":68,"tag":192,"props":5211,"children":5212},{"style":348},[5213],{"type":79,"value":351},{"type":68,"tag":192,"props":5215,"children":5216},{"style":304},[5217],{"type":79,"value":1970},{"type":68,"tag":192,"props":5219,"children":5220},{"style":298},[5221],{"type":79,"value":361},{"type":68,"tag":192,"props":5223,"children":5224},{"style":369},[5225],{"type":79,"value":1979},{"type":68,"tag":192,"props":5227,"children":5228},{"style":304},[5229],{"type":79,"value":376},{"type":68,"tag":192,"props":5231,"children":5232},{"style":298},[5233],{"type":79,"value":381},{"type":68,"tag":192,"props":5235,"children":5236},{"class":194,"line":529},[5237,5241,5245,5249,5253,5257,5261,5265,5269],{"type":68,"tag":192,"props":5238,"children":5239},{"style":388},[5240],{"type":79,"value":1995},{"type":68,"tag":192,"props":5242,"children":5243},{"style":298},[5244],{"type":79,"value":396},{"type":68,"tag":192,"props":5246,"children":5247},{"style":369},[5248],{"type":79,"value":2004},{"type":68,"tag":192,"props":5250,"children":5251},{"style":304},[5252],{"type":79,"value":376},{"type":68,"tag":192,"props":5254,"children":5255},{"style":298},[5256],{"type":79,"value":423},{"type":68,"tag":192,"props":5258,"children":5259},{"style":205},[5260],{"type":79,"value":2017},{"type":68,"tag":192,"props":5262,"children":5263},{"style":298},[5264],{"type":79,"value":423},{"type":68,"tag":192,"props":5266,"children":5267},{"style":304},[5268],{"type":79,"value":1239},{"type":68,"tag":192,"props":5270,"children":5271},{"style":298},[5272],{"type":79,"value":663},{"type":68,"tag":192,"props":5274,"children":5275},{"class":194,"line":1165},[5276,5280],{"type":68,"tag":192,"props":5277,"children":5278},{"style":304},[5279],{"type":79,"value":2037},{"type":68,"tag":192,"props":5281,"children":5282},{"style":298},[5283],{"type":79,"value":663},{"type":68,"tag":192,"props":5285,"children":5286},{"class":194,"line":1228},[5287,5292,5296,5300,5305,5309,5314,5318,5323,5327,5331,5335,5339],{"type":68,"tag":192,"props":5288,"children":5289},{"style":388},[5290],{"type":79,"value":5291},"  mcp",{"type":68,"tag":192,"props":5293,"children":5294},{"style":298},[5295],{"type":79,"value":396},{"type":68,"tag":192,"props":5297,"children":5298},{"style":298},[5299],{"type":79,"value":301},{"type":68,"tag":192,"props":5301,"children":5302},{"style":388},[5303],{"type":79,"value":5304}," clients",{"type":68,"tag":192,"props":5306,"children":5307},{"style":298},[5308],{"type":79,"value":396},{"type":68,"tag":192,"props":5310,"children":5311},{"style":304},[5312],{"type":79,"value":5313}," [pool]",{"type":68,"tag":192,"props":5315,"children":5316},{"style":298},[5317],{"type":79,"value":428},{"type":68,"tag":192,"props":5319,"children":5320},{"style":388},[5321],{"type":79,"value":5322}," connection",{"type":68,"tag":192,"props":5324,"children":5325},{"style":298},[5326],{"type":79,"value":396},{"type":68,"tag":192,"props":5328,"children":5329},{"style":298},[5330],{"type":79,"value":322},{"type":68,"tag":192,"props":5332,"children":5333},{"style":205},[5334],{"type":79,"value":4763},{"type":68,"tag":192,"props":5336,"children":5337},{"style":298},[5338],{"type":79,"value":423},{"type":68,"tag":192,"props":5340,"children":5341},{"style":298},[5342],{"type":79,"value":455},{"type":68,"tag":192,"props":5344,"children":5345},{"class":194,"line":1246},[5346,5350],{"type":68,"tag":192,"props":5347,"children":5348},{"style":298},[5349],{"type":79,"value":535},{"type":68,"tag":192,"props":5351,"children":5352},{"style":304},[5353],{"type":79,"value":540},{"type":68,"tag":111,"props":5355,"children":5357},{"id":5356},"createmcpclients-multiple-servers",[5358,5363],{"type":68,"tag":74,"props":5359,"children":5361},{"className":5360},[],[5362],{"type":79,"value":246},{"type":79,"value":5364}," — multiple servers",{"type":68,"tag":82,"props":5366,"children":5367},{},[5368],{"type":79,"value":5369},"Connect to many MCP servers in parallel. Each config key becomes the default\nprefix for that server's tools, preventing name collisions across servers.",{"type":68,"tag":181,"props":5371,"children":5373},{"className":281,"code":5372,"language":45,"meta":186,"style":186},"import { createMCPClients } from '@tanstack\u002Fai-mcp'\n\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 Tool names auto-prefixed: 'github_search_repos', 'linear_create_issue', etc.\nconst tools = await pool.tools()\n\n\u002F\u002F Forward lazy flag to every server:\nconst lazyTools = await pool.tools({ lazy: true })\n\n\u002F\u002F Per-server typed access:\nconst githubTools = await pool.clients.github.tools()\n",[5374],{"type":68,"tag":74,"props":5375,"children":5376},{"__ignoreMap":186},[5377,5412,5419,5450,5529,5608,5619,5626,5634,5670,5677,5685,5745,5752,5760],{"type":68,"tag":192,"props":5378,"children":5379},{"class":194,"line":195},[5380,5384,5388,5392,5396,5400,5404,5408],{"type":68,"tag":192,"props":5381,"children":5382},{"style":292},[5383],{"type":79,"value":295},{"type":68,"tag":192,"props":5385,"children":5386},{"style":298},[5387],{"type":79,"value":301},{"type":68,"tag":192,"props":5389,"children":5390},{"style":304},[5391],{"type":79,"value":5018},{"type":68,"tag":192,"props":5393,"children":5394},{"style":298},[5395],{"type":79,"value":312},{"type":68,"tag":192,"props":5397,"children":5398},{"style":292},[5399],{"type":79,"value":317},{"type":68,"tag":192,"props":5401,"children":5402},{"style":298},[5403],{"type":79,"value":322},{"type":68,"tag":192,"props":5405,"children":5406},{"style":205},[5407],{"type":79,"value":80},{"type":68,"tag":192,"props":5409,"children":5410},{"style":298},[5411],{"type":79,"value":331},{"type":68,"tag":192,"props":5413,"children":5414},{"class":194,"line":334},[5415],{"type":68,"tag":192,"props":5416,"children":5417},{"emptyLinePlaceholder":338},[5418],{"type":79,"value":341},{"type":68,"tag":192,"props":5420,"children":5421},{"class":194,"line":344},[5422,5426,5430,5434,5438,5442,5446],{"type":68,"tag":192,"props":5423,"children":5424},{"style":348},[5425],{"type":79,"value":2875},{"type":68,"tag":192,"props":5427,"children":5428},{"style":304},[5429],{"type":79,"value":5005},{"type":68,"tag":192,"props":5431,"children":5432},{"style":298},[5433],{"type":79,"value":361},{"type":68,"tag":192,"props":5435,"children":5436},{"style":292},[5437],{"type":79,"value":366},{"type":68,"tag":192,"props":5439,"children":5440},{"style":369},[5441],{"type":79,"value":5018},{"type":68,"tag":192,"props":5443,"children":5444},{"style":304},[5445],{"type":79,"value":376},{"type":68,"tag":192,"props":5447,"children":5448},{"style":298},[5449],{"type":79,"value":381},{"type":68,"tag":192,"props":5451,"children":5452},{"class":194,"line":384},[5453,5457,5461,5465,5469,5473,5477,5481,5485,5489,5493,5497,5501,5505,5509,5513,5517,5521,5525],{"type":68,"tag":192,"props":5454,"children":5455},{"style":388},[5456],{"type":79,"value":5034},{"type":68,"tag":192,"props":5458,"children":5459},{"style":298},[5460],{"type":79,"value":396},{"type":68,"tag":192,"props":5462,"children":5463},{"style":298},[5464],{"type":79,"value":301},{"type":68,"tag":192,"props":5466,"children":5467},{"style":388},[5468],{"type":79,"value":1440},{"type":68,"tag":192,"props":5470,"children":5471},{"style":298},[5472],{"type":79,"value":396},{"type":68,"tag":192,"props":5474,"children":5475},{"style":298},[5476],{"type":79,"value":301},{"type":68,"tag":192,"props":5478,"children":5479},{"style":388},[5480],{"type":79,"value":405},{"type":68,"tag":192,"props":5482,"children":5483},{"style":298},[5484],{"type":79,"value":396},{"type":68,"tag":192,"props":5486,"children":5487},{"style":298},[5488],{"type":79,"value":322},{"type":68,"tag":192,"props":5490,"children":5491},{"style":205},[5492],{"type":79,"value":418},{"type":68,"tag":192,"props":5494,"children":5495},{"style":298},[5496],{"type":79,"value":423},{"type":68,"tag":192,"props":5498,"children":5499},{"style":298},[5500],{"type":79,"value":428},{"type":68,"tag":192,"props":5502,"children":5503},{"style":388},[5504],{"type":79,"value":433},{"type":68,"tag":192,"props":5506,"children":5507},{"style":298},[5508],{"type":79,"value":396},{"type":68,"tag":192,"props":5510,"children":5511},{"style":298},[5512],{"type":79,"value":322},{"type":68,"tag":192,"props":5514,"children":5515},{"style":205},[5516],{"type":79,"value":5095},{"type":68,"tag":192,"props":5518,"children":5519},{"style":298},[5520],{"type":79,"value":423},{"type":68,"tag":192,"props":5522,"children":5523},{"style":298},[5524],{"type":79,"value":312},{"type":68,"tag":192,"props":5526,"children":5527},{"style":298},[5528],{"type":79,"value":455},{"type":68,"tag":192,"props":5530,"children":5531},{"class":194,"line":458},[5532,5536,5540,5544,5548,5552,5556,5560,5564,5568,5572,5576,5580,5584,5588,5592,5596,5600,5604],{"type":68,"tag":192,"props":5533,"children":5534},{"style":388},[5535],{"type":79,"value":5115},{"type":68,"tag":192,"props":5537,"children":5538},{"style":298},[5539],{"type":79,"value":396},{"type":68,"tag":192,"props":5541,"children":5542},{"style":298},[5543],{"type":79,"value":301},{"type":68,"tag":192,"props":5545,"children":5546},{"style":388},[5547],{"type":79,"value":1440},{"type":68,"tag":192,"props":5549,"children":5550},{"style":298},[5551],{"type":79,"value":396},{"type":68,"tag":192,"props":5553,"children":5554},{"style":298},[5555],{"type":79,"value":301},{"type":68,"tag":192,"props":5557,"children":5558},{"style":388},[5559],{"type":79,"value":405},{"type":68,"tag":192,"props":5561,"children":5562},{"style":298},[5563],{"type":79,"value":396},{"type":68,"tag":192,"props":5565,"children":5566},{"style":298},[5567],{"type":79,"value":322},{"type":68,"tag":192,"props":5569,"children":5570},{"style":205},[5571],{"type":79,"value":418},{"type":68,"tag":192,"props":5573,"children":5574},{"style":298},[5575],{"type":79,"value":423},{"type":68,"tag":192,"props":5577,"children":5578},{"style":298},[5579],{"type":79,"value":428},{"type":68,"tag":192,"props":5581,"children":5582},{"style":388},[5583],{"type":79,"value":433},{"type":68,"tag":192,"props":5585,"children":5586},{"style":298},[5587],{"type":79,"value":396},{"type":68,"tag":192,"props":5589,"children":5590},{"style":298},[5591],{"type":79,"value":322},{"type":68,"tag":192,"props":5593,"children":5594},{"style":205},[5595],{"type":79,"value":5176},{"type":68,"tag":192,"props":5597,"children":5598},{"style":298},[5599],{"type":79,"value":423},{"type":68,"tag":192,"props":5601,"children":5602},{"style":298},[5603],{"type":79,"value":312},{"type":68,"tag":192,"props":5605,"children":5606},{"style":298},[5607],{"type":79,"value":455},{"type":68,"tag":192,"props":5609,"children":5610},{"class":194,"line":494},[5611,5615],{"type":68,"tag":192,"props":5612,"children":5613},{"style":298},[5614],{"type":79,"value":535},{"type":68,"tag":192,"props":5616,"children":5617},{"style":304},[5618],{"type":79,"value":540},{"type":68,"tag":192,"props":5620,"children":5621},{"class":194,"line":529},[5622],{"type":68,"tag":192,"props":5623,"children":5624},{"emptyLinePlaceholder":338},[5625],{"type":79,"value":341},{"type":68,"tag":192,"props":5627,"children":5628},{"class":194,"line":1165},[5629],{"type":68,"tag":192,"props":5630,"children":5631},{"style":488},[5632],{"type":79,"value":5633},"\u002F\u002F Tool names auto-prefixed: 'github_search_repos', 'linear_create_issue', etc.\n",{"type":68,"tag":192,"props":5635,"children":5636},{"class":194,"line":1228},[5637,5641,5645,5649,5653,5658,5662,5666],{"type":68,"tag":192,"props":5638,"children":5639},{"style":348},[5640],{"type":79,"value":351},{"type":68,"tag":192,"props":5642,"children":5643},{"style":304},[5644],{"type":79,"value":1917},{"type":68,"tag":192,"props":5646,"children":5647},{"style":298},[5648],{"type":79,"value":361},{"type":68,"tag":192,"props":5650,"children":5651},{"style":292},[5652],{"type":79,"value":366},{"type":68,"tag":192,"props":5654,"children":5655},{"style":304},[5656],{"type":79,"value":5657}," pool",{"type":68,"tag":192,"props":5659,"children":5660},{"style":298},[5661],{"type":79,"value":230},{"type":68,"tag":192,"props":5663,"children":5664},{"style":369},[5665],{"type":79,"value":1939},{"type":68,"tag":192,"props":5667,"children":5668},{"style":304},[5669],{"type":79,"value":1403},{"type":68,"tag":192,"props":5671,"children":5672},{"class":194,"line":1246},[5673],{"type":68,"tag":192,"props":5674,"children":5675},{"emptyLinePlaceholder":338},[5676],{"type":79,"value":341},{"type":68,"tag":192,"props":5678,"children":5679},{"class":194,"line":1807},[5680],{"type":68,"tag":192,"props":5681,"children":5682},{"style":488},[5683],{"type":79,"value":5684},"\u002F\u002F Forward lazy flag to every server:\n",{"type":68,"tag":192,"props":5686,"children":5687},{"class":194,"line":1815},[5688,5692,5697,5701,5705,5709,5713,5717,5721,5725,5729,5733,5737,5741],{"type":68,"tag":192,"props":5689,"children":5690},{"style":348},[5691],{"type":79,"value":351},{"type":68,"tag":192,"props":5693,"children":5694},{"style":304},[5695],{"type":79,"value":5696}," lazyTools ",{"type":68,"tag":192,"props":5698,"children":5699},{"style":298},[5700],{"type":79,"value":361},{"type":68,"tag":192,"props":5702,"children":5703},{"style":292},[5704],{"type":79,"value":366},{"type":68,"tag":192,"props":5706,"children":5707},{"style":304},[5708],{"type":79,"value":5657},{"type":68,"tag":192,"props":5710,"children":5711},{"style":298},[5712],{"type":79,"value":230},{"type":68,"tag":192,"props":5714,"children":5715},{"style":369},[5716],{"type":79,"value":1939},{"type":68,"tag":192,"props":5718,"children":5719},{"style":304},[5720],{"type":79,"value":376},{"type":68,"tag":192,"props":5722,"children":5723},{"style":298},[5724],{"type":79,"value":1435},{"type":68,"tag":192,"props":5726,"children":5727},{"style":388},[5728],{"type":79,"value":2134},{"type":68,"tag":192,"props":5730,"children":5731},{"style":298},[5732],{"type":79,"value":396},{"type":68,"tag":192,"props":5734,"children":5735},{"style":2141},[5736],{"type":79,"value":2144},{"type":68,"tag":192,"props":5738,"children":5739},{"style":298},[5740],{"type":79,"value":312},{"type":68,"tag":192,"props":5742,"children":5743},{"style":304},[5744],{"type":79,"value":540},{"type":68,"tag":192,"props":5746,"children":5747},{"class":194,"line":2651},[5748],{"type":68,"tag":192,"props":5749,"children":5750},{"emptyLinePlaceholder":338},[5751],{"type":79,"value":341},{"type":68,"tag":192,"props":5753,"children":5754},{"class":194,"line":2715},[5755],{"type":68,"tag":192,"props":5756,"children":5757},{"style":488},[5758],{"type":79,"value":5759},"\u002F\u002F Per-server typed access:\n",{"type":68,"tag":192,"props":5761,"children":5762},{"class":194,"line":2727},[5763,5767,5772,5776,5780,5784,5788,5792,5796,5801,5805,5809],{"type":68,"tag":192,"props":5764,"children":5765},{"style":348},[5766],{"type":79,"value":351},{"type":68,"tag":192,"props":5768,"children":5769},{"style":304},[5770],{"type":79,"value":5771}," githubTools ",{"type":68,"tag":192,"props":5773,"children":5774},{"style":298},[5775],{"type":79,"value":361},{"type":68,"tag":192,"props":5777,"children":5778},{"style":292},[5779],{"type":79,"value":366},{"type":68,"tag":192,"props":5781,"children":5782},{"style":304},[5783],{"type":79,"value":5657},{"type":68,"tag":192,"props":5785,"children":5786},{"style":298},[5787],{"type":79,"value":230},{"type":68,"tag":192,"props":5789,"children":5790},{"style":304},[5791],{"type":79,"value":4013},{"type":68,"tag":192,"props":5793,"children":5794},{"style":298},[5795],{"type":79,"value":230},{"type":68,"tag":192,"props":5797,"children":5798},{"style":304},[5799],{"type":79,"value":5800},"github",{"type":68,"tag":192,"props":5802,"children":5803},{"style":298},[5804],{"type":79,"value":230},{"type":68,"tag":192,"props":5806,"children":5807},{"style":369},[5808],{"type":79,"value":1939},{"type":68,"tag":192,"props":5810,"children":5811},{"style":304},[5812],{"type":79,"value":1403},{"type":68,"tag":82,"props":5814,"children":5815},{},[5816,5821,5823,5828],{"type":68,"tag":74,"props":5817,"children":5819},{"className":5818},[],[5820],{"type":79,"value":246},{"type":79,"value":5822}," connects in parallel, closes already-connected clients if\nany connection fails (no leaks), and throws ",{"type":68,"tag":74,"props":5824,"children":5826},{"className":5825},[],[5827],{"type":79,"value":564},{"type":79,"value":5829}," naming the\nfailed server(s).",{"type":68,"tag":82,"props":5831,"children":5832},{},[5833],{"type":79,"value":5834},"Override or disable prefixing:",{"type":68,"tag":181,"props":5836,"children":5838},{"className":281,"code":5837,"language":45,"meta":186,"style":186},"await using pool = await createMCPClients({\n  github: { transport: { ... }, prefix: 'gh' },    \u002F\u002F 'gh_search_repos'\n  linear: { transport: { ... }, prefix: '' },        \u002F\u002F 'create_issue' (no prefix)\n})\n",[5839],{"type":68,"tag":74,"props":5840,"children":5841},{"__ignoreMap":186},[5842,5873,5941,5997],{"type":68,"tag":192,"props":5843,"children":5844},{"class":194,"line":195},[5845,5849,5853,5857,5861,5865,5869],{"type":68,"tag":192,"props":5846,"children":5847},{"style":348},[5848],{"type":79,"value":2875},{"type":68,"tag":192,"props":5850,"children":5851},{"style":304},[5852],{"type":79,"value":5005},{"type":68,"tag":192,"props":5854,"children":5855},{"style":298},[5856],{"type":79,"value":361},{"type":68,"tag":192,"props":5858,"children":5859},{"style":292},[5860],{"type":79,"value":366},{"type":68,"tag":192,"props":5862,"children":5863},{"style":369},[5864],{"type":79,"value":5018},{"type":68,"tag":192,"props":5866,"children":5867},{"style":304},[5868],{"type":79,"value":376},{"type":68,"tag":192,"props":5870,"children":5871},{"style":298},[5872],{"type":79,"value":381},{"type":68,"tag":192,"props":5874,"children":5875},{"class":194,"line":334},[5876,5880,5884,5888,5892,5896,5900,5905,5910,5915,5919,5923,5928,5932,5936],{"type":68,"tag":192,"props":5877,"children":5878},{"style":388},[5879],{"type":79,"value":5034},{"type":68,"tag":192,"props":5881,"children":5882},{"style":298},[5883],{"type":79,"value":396},{"type":68,"tag":192,"props":5885,"children":5886},{"style":298},[5887],{"type":79,"value":301},{"type":68,"tag":192,"props":5889,"children":5890},{"style":388},[5891],{"type":79,"value":1440},{"type":68,"tag":192,"props":5893,"children":5894},{"style":298},[5895],{"type":79,"value":396},{"type":68,"tag":192,"props":5897,"children":5898},{"style":298},[5899],{"type":79,"value":301},{"type":68,"tag":192,"props":5901,"children":5902},{"style":298},[5903],{"type":79,"value":5904}," ...",{"type":68,"tag":192,"props":5906,"children":5907},{"style":298},[5908],{"type":79,"value":5909}," },",{"type":68,"tag":192,"props":5911,"children":5912},{"style":388},[5913],{"type":79,"value":5914}," prefix",{"type":68,"tag":192,"props":5916,"children":5917},{"style":298},[5918],{"type":79,"value":396},{"type":68,"tag":192,"props":5920,"children":5921},{"style":298},[5922],{"type":79,"value":322},{"type":68,"tag":192,"props":5924,"children":5925},{"style":205},[5926],{"type":79,"value":5927},"gh",{"type":68,"tag":192,"props":5929,"children":5930},{"style":298},[5931],{"type":79,"value":423},{"type":68,"tag":192,"props":5933,"children":5934},{"style":298},[5935],{"type":79,"value":5909},{"type":68,"tag":192,"props":5937,"children":5938},{"style":488},[5939],{"type":79,"value":5940},"    \u002F\u002F 'gh_search_repos'\n",{"type":68,"tag":192,"props":5942,"children":5943},{"class":194,"line":344},[5944,5948,5952,5956,5960,5964,5968,5972,5976,5980,5984,5988,5992],{"type":68,"tag":192,"props":5945,"children":5946},{"style":388},[5947],{"type":79,"value":5115},{"type":68,"tag":192,"props":5949,"children":5950},{"style":298},[5951],{"type":79,"value":396},{"type":68,"tag":192,"props":5953,"children":5954},{"style":298},[5955],{"type":79,"value":301},{"type":68,"tag":192,"props":5957,"children":5958},{"style":388},[5959],{"type":79,"value":1440},{"type":68,"tag":192,"props":5961,"children":5962},{"style":298},[5963],{"type":79,"value":396},{"type":68,"tag":192,"props":5965,"children":5966},{"style":298},[5967],{"type":79,"value":301},{"type":68,"tag":192,"props":5969,"children":5970},{"style":298},[5971],{"type":79,"value":5904},{"type":68,"tag":192,"props":5973,"children":5974},{"style":298},[5975],{"type":79,"value":5909},{"type":68,"tag":192,"props":5977,"children":5978},{"style":388},[5979],{"type":79,"value":5914},{"type":68,"tag":192,"props":5981,"children":5982},{"style":298},[5983],{"type":79,"value":396},{"type":68,"tag":192,"props":5985,"children":5986},{"style":298},[5987],{"type":79,"value":1221},{"type":68,"tag":192,"props":5989,"children":5990},{"style":298},[5991],{"type":79,"value":5909},{"type":68,"tag":192,"props":5993,"children":5994},{"style":488},[5995],{"type":79,"value":5996},"        \u002F\u002F 'create_issue' (no prefix)\n",{"type":68,"tag":192,"props":5998,"children":5999},{"class":194,"line":384},[6000,6004],{"type":68,"tag":192,"props":6001,"children":6002},{"style":298},[6003],{"type":79,"value":535},{"type":68,"tag":192,"props":6005,"children":6006},{"style":304},[6007],{"type":79,"value":540},{"type":68,"tag":111,"props":6009,"children":6011},{"id":6010},"abort-signal-cancelling-in-flight-mcp-calls",[6012],{"type":79,"value":6013},"Abort signal — cancelling in-flight MCP calls",{"type":68,"tag":82,"props":6015,"children":6016},{},[6017,6019,6025,6027,6033,6035,6041,6043,6048],{"type":79,"value":6018},"MCP tool calls are automatically cancelled when the chat run's ",{"type":68,"tag":74,"props":6020,"children":6022},{"className":6021},[],[6023],{"type":79,"value":6024},"AbortController",{"type":79,"value":6026},"\nfires (e.g. client disconnect, server abort). The ",{"type":68,"tag":74,"props":6028,"children":6030},{"className":6029},[],[6031],{"type":79,"value":6032},"abortSignal",{"type":79,"value":6034}," is threaded\nthrough ",{"type":68,"tag":74,"props":6036,"children":6038},{"className":6037},[],[6039],{"type":79,"value":6040},"ToolExecutionContext",{"type":79,"value":6042}," into every ",{"type":68,"tag":74,"props":6044,"children":6046},{"className":6045},[],[6047],{"type":79,"value":2201},{"type":79,"value":6049}," call with no extra code.",{"type":68,"tag":82,"props":6051,"children":6052},{},[6053],{"type":79,"value":6054},"You can also read it in a hand-written server tool that wraps an MCP call:",{"type":68,"tag":181,"props":6056,"children":6058},{"className":281,"code":6057,"language":45,"meta":186,"style":186},"const myTool = myDef.server(async (args, ctx) => {\n  \u002F\u002F Forward to any async work that accepts an AbortSignal.\n  const result = await fetch('https:\u002F\u002Fslow.api\u002Fdata', {\n    signal: ctx?.abortSignal,\n  })\n  return result.json()\n})\n",[6059],{"type":68,"tag":74,"props":6060,"children":6061},{"__ignoreMap":186},[6062,6131,6139,6189,6218,6229,6253],{"type":68,"tag":192,"props":6063,"children":6064},{"class":194,"line":195},[6065,6069,6074,6078,6083,6087,6092,6096,6101,6105,6110,6114,6119,6123,6127],{"type":68,"tag":192,"props":6066,"children":6067},{"style":348},[6068],{"type":79,"value":351},{"type":68,"tag":192,"props":6070,"children":6071},{"style":304},[6072],{"type":79,"value":6073}," myTool ",{"type":68,"tag":192,"props":6075,"children":6076},{"style":298},[6077],{"type":79,"value":361},{"type":68,"tag":192,"props":6079,"children":6080},{"style":304},[6081],{"type":79,"value":6082}," myDef",{"type":68,"tag":192,"props":6084,"children":6085},{"style":298},[6086],{"type":79,"value":230},{"type":68,"tag":192,"props":6088,"children":6089},{"style":369},[6090],{"type":79,"value":6091},"server",{"type":68,"tag":192,"props":6093,"children":6094},{"style":304},[6095],{"type":79,"value":376},{"type":68,"tag":192,"props":6097,"children":6098},{"style":348},[6099],{"type":79,"value":6100},"async",{"type":68,"tag":192,"props":6102,"children":6103},{"style":298},[6104],{"type":79,"value":3625},{"type":68,"tag":192,"props":6106,"children":6107},{"style":4434},[6108],{"type":79,"value":6109},"args",{"type":68,"tag":192,"props":6111,"children":6112},{"style":298},[6113],{"type":79,"value":428},{"type":68,"tag":192,"props":6115,"children":6116},{"style":4434},[6117],{"type":79,"value":6118}," ctx",{"type":68,"tag":192,"props":6120,"children":6121},{"style":298},[6122],{"type":79,"value":1239},{"type":68,"tag":192,"props":6124,"children":6125},{"style":348},[6126],{"type":79,"value":3186},{"type":68,"tag":192,"props":6128,"children":6129},{"style":298},[6130],{"type":79,"value":634},{"type":68,"tag":192,"props":6132,"children":6133},{"class":194,"line":334},[6134],{"type":68,"tag":192,"props":6135,"children":6136},{"style":488},[6137],{"type":79,"value":6138},"  \u002F\u002F Forward to any async work that accepts an AbortSignal.\n",{"type":68,"tag":192,"props":6140,"children":6141},{"class":194,"line":344},[6142,6146,6151,6155,6159,6164,6168,6172,6177,6181,6185],{"type":68,"tag":192,"props":6143,"children":6144},{"style":348},[6145],{"type":79,"value":3483},{"type":68,"tag":192,"props":6147,"children":6148},{"style":304},[6149],{"type":79,"value":6150}," result",{"type":68,"tag":192,"props":6152,"children":6153},{"style":298},[6154],{"type":79,"value":1385},{"type":68,"tag":192,"props":6156,"children":6157},{"style":292},[6158],{"type":79,"value":366},{"type":68,"tag":192,"props":6160,"children":6161},{"style":369},[6162],{"type":79,"value":6163}," fetch",{"type":68,"tag":192,"props":6165,"children":6166},{"style":388},[6167],{"type":79,"value":376},{"type":68,"tag":192,"props":6169,"children":6170},{"style":298},[6171],{"type":79,"value":423},{"type":68,"tag":192,"props":6173,"children":6174},{"style":205},[6175],{"type":79,"value":6176},"https:\u002F\u002Fslow.api\u002Fdata",{"type":68,"tag":192,"props":6178,"children":6179},{"style":298},[6180],{"type":79,"value":423},{"type":68,"tag":192,"props":6182,"children":6183},{"style":298},[6184],{"type":79,"value":428},{"type":68,"tag":192,"props":6186,"children":6187},{"style":298},[6188],{"type":79,"value":634},{"type":68,"tag":192,"props":6190,"children":6191},{"class":194,"line":384},[6192,6197,6201,6205,6210,6214],{"type":68,"tag":192,"props":6193,"children":6194},{"style":388},[6195],{"type":79,"value":6196},"    signal",{"type":68,"tag":192,"props":6198,"children":6199},{"style":298},[6200],{"type":79,"value":396},{"type":68,"tag":192,"props":6202,"children":6203},{"style":304},[6204],{"type":79,"value":6118},{"type":68,"tag":192,"props":6206,"children":6207},{"style":298},[6208],{"type":79,"value":6209},"?.",{"type":68,"tag":192,"props":6211,"children":6212},{"style":304},[6213],{"type":79,"value":6032},{"type":68,"tag":192,"props":6215,"children":6216},{"style":298},[6217],{"type":79,"value":663},{"type":68,"tag":192,"props":6219,"children":6220},{"class":194,"line":458},[6221,6225],{"type":68,"tag":192,"props":6222,"children":6223},{"style":298},[6224],{"type":79,"value":1234},{"type":68,"tag":192,"props":6226,"children":6227},{"style":388},[6228],{"type":79,"value":540},{"type":68,"tag":192,"props":6230,"children":6231},{"class":194,"line":494},[6232,6237,6241,6245,6249],{"type":68,"tag":192,"props":6233,"children":6234},{"style":292},[6235],{"type":79,"value":6236},"  return",{"type":68,"tag":192,"props":6238,"children":6239},{"style":304},[6240],{"type":79,"value":6150},{"type":68,"tag":192,"props":6242,"children":6243},{"style":298},[6244],{"type":79,"value":230},{"type":68,"tag":192,"props":6246,"children":6247},{"style":369},[6248],{"type":79,"value":4492},{"type":68,"tag":192,"props":6250,"children":6251},{"style":388},[6252],{"type":79,"value":1403},{"type":68,"tag":192,"props":6254,"children":6255},{"class":194,"line":529},[6256,6260],{"type":68,"tag":192,"props":6257,"children":6258},{"style":298},[6259],{"type":79,"value":535},{"type":68,"tag":192,"props":6261,"children":6262},{"style":304},[6263],{"type":79,"value":540},{"type":68,"tag":111,"props":6265,"children":6267},{"id":6266},"resources",[6268],{"type":79,"value":6269},"Resources",{"type":68,"tag":181,"props":6271,"children":6273},{"className":281,"code":6272,"language":45,"meta":186,"style":186},"\u002F\u002F List all resources the server exposes.\nconst resources = await client.resources()\n\n\u002F\u002F Read a specific resource by URI.\nconst resource = await client.readResource(resources[0].uri)\n\n\u002F\u002F Convert one content block to a TanStack ContentPart.\nimport { mcpResourceToContentPart } from '@tanstack\u002Fai-mcp'\n\nconst part = mcpResourceToContentPart(resource.contents[0])\n\u002F\u002F part: ContentPart  (type: 'text' always for v1)\n",[6274],{"type":68,"tag":74,"props":6275,"children":6276},{"__ignoreMap":186},[6277,6285,6321,6328,6336,6393,6400,6408,6444,6451,6494],{"type":68,"tag":192,"props":6278,"children":6279},{"class":194,"line":195},[6280],{"type":68,"tag":192,"props":6281,"children":6282},{"style":488},[6283],{"type":79,"value":6284},"\u002F\u002F List all resources the server exposes.\n",{"type":68,"tag":192,"props":6286,"children":6287},{"class":194,"line":334},[6288,6292,6297,6301,6305,6309,6313,6317],{"type":68,"tag":192,"props":6289,"children":6290},{"style":348},[6291],{"type":79,"value":351},{"type":68,"tag":192,"props":6293,"children":6294},{"style":304},[6295],{"type":79,"value":6296}," resources ",{"type":68,"tag":192,"props":6298,"children":6299},{"style":298},[6300],{"type":79,"value":361},{"type":68,"tag":192,"props":6302,"children":6303},{"style":292},[6304],{"type":79,"value":366},{"type":68,"tag":192,"props":6306,"children":6307},{"style":304},[6308],{"type":79,"value":1930},{"type":68,"tag":192,"props":6310,"children":6311},{"style":298},[6312],{"type":79,"value":230},{"type":68,"tag":192,"props":6314,"children":6315},{"style":369},[6316],{"type":79,"value":6266},{"type":68,"tag":192,"props":6318,"children":6319},{"style":304},[6320],{"type":79,"value":1403},{"type":68,"tag":192,"props":6322,"children":6323},{"class":194,"line":344},[6324],{"type":68,"tag":192,"props":6325,"children":6326},{"emptyLinePlaceholder":338},[6327],{"type":79,"value":341},{"type":68,"tag":192,"props":6329,"children":6330},{"class":194,"line":384},[6331],{"type":68,"tag":192,"props":6332,"children":6333},{"style":488},[6334],{"type":79,"value":6335},"\u002F\u002F Read a specific resource by URI.\n",{"type":68,"tag":192,"props":6337,"children":6338},{"class":194,"line":458},[6339,6343,6348,6352,6356,6360,6364,6369,6374,6380,6384,6388],{"type":68,"tag":192,"props":6340,"children":6341},{"style":348},[6342],{"type":79,"value":351},{"type":68,"tag":192,"props":6344,"children":6345},{"style":304},[6346],{"type":79,"value":6347}," resource ",{"type":68,"tag":192,"props":6349,"children":6350},{"style":298},[6351],{"type":79,"value":361},{"type":68,"tag":192,"props":6353,"children":6354},{"style":292},[6355],{"type":79,"value":366},{"type":68,"tag":192,"props":6357,"children":6358},{"style":304},[6359],{"type":79,"value":1930},{"type":68,"tag":192,"props":6361,"children":6362},{"style":298},[6363],{"type":79,"value":230},{"type":68,"tag":192,"props":6365,"children":6366},{"style":369},[6367],{"type":79,"value":6368},"readResource",{"type":68,"tag":192,"props":6370,"children":6371},{"style":304},[6372],{"type":79,"value":6373},"(resources[",{"type":68,"tag":192,"props":6375,"children":6377},{"style":6376},"--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C",[6378],{"type":79,"value":6379},"0",{"type":68,"tag":192,"props":6381,"children":6382},{"style":304},[6383],{"type":79,"value":1158},{"type":68,"tag":192,"props":6385,"children":6386},{"style":298},[6387],{"type":79,"value":230},{"type":68,"tag":192,"props":6389,"children":6390},{"style":304},[6391],{"type":79,"value":6392},"uri)\n",{"type":68,"tag":192,"props":6394,"children":6395},{"class":194,"line":494},[6396],{"type":68,"tag":192,"props":6397,"children":6398},{"emptyLinePlaceholder":338},[6399],{"type":79,"value":341},{"type":68,"tag":192,"props":6401,"children":6402},{"class":194,"line":529},[6403],{"type":68,"tag":192,"props":6404,"children":6405},{"style":488},[6406],{"type":79,"value":6407},"\u002F\u002F Convert one content block to a TanStack ContentPart.\n",{"type":68,"tag":192,"props":6409,"children":6410},{"class":194,"line":1165},[6411,6415,6419,6424,6428,6432,6436,6440],{"type":68,"tag":192,"props":6412,"children":6413},{"style":292},[6414],{"type":79,"value":295},{"type":68,"tag":192,"props":6416,"children":6417},{"style":298},[6418],{"type":79,"value":301},{"type":68,"tag":192,"props":6420,"children":6421},{"style":304},[6422],{"type":79,"value":6423}," mcpResourceToContentPart",{"type":68,"tag":192,"props":6425,"children":6426},{"style":298},[6427],{"type":79,"value":312},{"type":68,"tag":192,"props":6429,"children":6430},{"style":292},[6431],{"type":79,"value":317},{"type":68,"tag":192,"props":6433,"children":6434},{"style":298},[6435],{"type":79,"value":322},{"type":68,"tag":192,"props":6437,"children":6438},{"style":205},[6439],{"type":79,"value":80},{"type":68,"tag":192,"props":6441,"children":6442},{"style":298},[6443],{"type":79,"value":331},{"type":68,"tag":192,"props":6445,"children":6446},{"class":194,"line":1228},[6447],{"type":68,"tag":192,"props":6448,"children":6449},{"emptyLinePlaceholder":338},[6450],{"type":79,"value":341},{"type":68,"tag":192,"props":6452,"children":6453},{"class":194,"line":1246},[6454,6458,6463,6467,6471,6476,6480,6485,6489],{"type":68,"tag":192,"props":6455,"children":6456},{"style":348},[6457],{"type":79,"value":351},{"type":68,"tag":192,"props":6459,"children":6460},{"style":304},[6461],{"type":79,"value":6462}," part ",{"type":68,"tag":192,"props":6464,"children":6465},{"style":298},[6466],{"type":79,"value":361},{"type":68,"tag":192,"props":6468,"children":6469},{"style":369},[6470],{"type":79,"value":6423},{"type":68,"tag":192,"props":6472,"children":6473},{"style":304},[6474],{"type":79,"value":6475},"(resource",{"type":68,"tag":192,"props":6477,"children":6478},{"style":298},[6479],{"type":79,"value":230},{"type":68,"tag":192,"props":6481,"children":6482},{"style":304},[6483],{"type":79,"value":6484},"contents[",{"type":68,"tag":192,"props":6486,"children":6487},{"style":6376},[6488],{"type":79,"value":6379},{"type":68,"tag":192,"props":6490,"children":6491},{"style":304},[6492],{"type":79,"value":6493},"])\n",{"type":68,"tag":192,"props":6495,"children":6496},{"class":194,"line":1807},[6497],{"type":68,"tag":192,"props":6498,"children":6499},{"style":488},[6500],{"type":79,"value":6501},"\u002F\u002F part: ContentPart  (type: 'text' always for v1)\n",{"type":68,"tag":82,"props":6503,"children":6504},{},[6505],{"type":79,"value":6506},"Inject resources into a chat turn:",{"type":68,"tag":181,"props":6508,"children":6510},{"className":281,"code":6509,"language":45,"meta":186,"style":186},"import { chat } from '@tanstack\u002Fai'\nimport { createMCPClient, mcpResourceToContentPart } from '@tanstack\u002Fai-mcp'\n\nconst client = await createMCPClient({\n  transport: { type: 'http', url: '...' },\n})\nconst resource = await client.readResource('file:\u002F\u002F\u002Fproject\u002FREADME.md')\nconst parts = resource.contents.map(mcpResourceToContentPart)\n\nconst stream = chat({\n  adapter: openaiText('gpt-5.5'),\n  messages: [\n    {\n      role: 'user',\n      content: [\n        ...parts,\n        { type: 'text', content: 'Summarize this document.' },\n      ],\n    },\n  ],\n})\n",[6511],{"type":68,"tag":74,"props":6512,"children":6513},{"__ignoreMap":186},[6514,6549,6592,6599,6630,6693,6704,6756,6800,6807,6834,6873,6888,6895,6924,6940,6957,7015,7027,7034,7045],{"type":68,"tag":192,"props":6515,"children":6516},{"class":194,"line":195},[6517,6521,6525,6529,6533,6537,6541,6545],{"type":68,"tag":192,"props":6518,"children":6519},{"style":292},[6520],{"type":79,"value":295},{"type":68,"tag":192,"props":6522,"children":6523},{"style":298},[6524],{"type":79,"value":301},{"type":68,"tag":192,"props":6526,"children":6527},{"style":304},[6528],{"type":79,"value":1979},{"type":68,"tag":192,"props":6530,"children":6531},{"style":298},[6532],{"type":79,"value":312},{"type":68,"tag":192,"props":6534,"children":6535},{"style":292},[6536],{"type":79,"value":317},{"type":68,"tag":192,"props":6538,"children":6539},{"style":298},[6540],{"type":79,"value":322},{"type":68,"tag":192,"props":6542,"children":6543},{"style":205},[6544],{"type":79,"value":2259},{"type":68,"tag":192,"props":6546,"children":6547},{"style":298},[6548],{"type":79,"value":331},{"type":68,"tag":192,"props":6550,"children":6551},{"class":194,"line":334},[6552,6556,6560,6564,6568,6572,6576,6580,6584,6588],{"type":68,"tag":192,"props":6553,"children":6554},{"style":292},[6555],{"type":79,"value":295},{"type":68,"tag":192,"props":6557,"children":6558},{"style":298},[6559],{"type":79,"value":301},{"type":68,"tag":192,"props":6561,"children":6562},{"style":304},[6563],{"type":79,"value":307},{"type":68,"tag":192,"props":6565,"children":6566},{"style":298},[6567],{"type":79,"value":428},{"type":68,"tag":192,"props":6569,"children":6570},{"style":304},[6571],{"type":79,"value":6423},{"type":68,"tag":192,"props":6573,"children":6574},{"style":298},[6575],{"type":79,"value":312},{"type":68,"tag":192,"props":6577,"children":6578},{"style":292},[6579],{"type":79,"value":317},{"type":68,"tag":192,"props":6581,"children":6582},{"style":298},[6583],{"type":79,"value":322},{"type":68,"tag":192,"props":6585,"children":6586},{"style":205},[6587],{"type":79,"value":80},{"type":68,"tag":192,"props":6589,"children":6590},{"style":298},[6591],{"type":79,"value":331},{"type":68,"tag":192,"props":6593,"children":6594},{"class":194,"line":344},[6595],{"type":68,"tag":192,"props":6596,"children":6597},{"emptyLinePlaceholder":338},[6598],{"type":79,"value":341},{"type":68,"tag":192,"props":6600,"children":6601},{"class":194,"line":384},[6602,6606,6610,6614,6618,6622,6626],{"type":68,"tag":192,"props":6603,"children":6604},{"style":348},[6605],{"type":79,"value":351},{"type":68,"tag":192,"props":6607,"children":6608},{"style":304},[6609],{"type":79,"value":356},{"type":68,"tag":192,"props":6611,"children":6612},{"style":298},[6613],{"type":79,"value":361},{"type":68,"tag":192,"props":6615,"children":6616},{"style":292},[6617],{"type":79,"value":366},{"type":68,"tag":192,"props":6619,"children":6620},{"style":369},[6621],{"type":79,"value":307},{"type":68,"tag":192,"props":6623,"children":6624},{"style":304},[6625],{"type":79,"value":376},{"type":68,"tag":192,"props":6627,"children":6628},{"style":298},[6629],{"type":79,"value":381},{"type":68,"tag":192,"props":6631,"children":6632},{"class":194,"line":458},[6633,6637,6641,6645,6649,6653,6657,6661,6665,6669,6673,6677,6681,6685,6689],{"type":68,"tag":192,"props":6634,"children":6635},{"style":388},[6636],{"type":79,"value":391},{"type":68,"tag":192,"props":6638,"children":6639},{"style":298},[6640],{"type":79,"value":396},{"type":68,"tag":192,"props":6642,"children":6643},{"style":298},[6644],{"type":79,"value":301},{"type":68,"tag":192,"props":6646,"children":6647},{"style":388},[6648],{"type":79,"value":405},{"type":68,"tag":192,"props":6650,"children":6651},{"style":298},[6652],{"type":79,"value":396},{"type":68,"tag":192,"props":6654,"children":6655},{"style":298},[6656],{"type":79,"value":322},{"type":68,"tag":192,"props":6658,"children":6659},{"style":205},[6660],{"type":79,"value":418},{"type":68,"tag":192,"props":6662,"children":6663},{"style":298},[6664],{"type":79,"value":423},{"type":68,"tag":192,"props":6666,"children":6667},{"style":298},[6668],{"type":79,"value":428},{"type":68,"tag":192,"props":6670,"children":6671},{"style":388},[6672],{"type":79,"value":433},{"type":68,"tag":192,"props":6674,"children":6675},{"style":298},[6676],{"type":79,"value":396},{"type":68,"tag":192,"props":6678,"children":6679},{"style":298},[6680],{"type":79,"value":322},{"type":68,"tag":192,"props":6682,"children":6683},{"style":205},[6684],{"type":79,"value":2979},{"type":68,"tag":192,"props":6686,"children":6687},{"style":298},[6688],{"type":79,"value":423},{"type":68,"tag":192,"props":6690,"children":6691},{"style":298},[6692],{"type":79,"value":455},{"type":68,"tag":192,"props":6694,"children":6695},{"class":194,"line":494},[6696,6700],{"type":68,"tag":192,"props":6697,"children":6698},{"style":298},[6699],{"type":79,"value":535},{"type":68,"tag":192,"props":6701,"children":6702},{"style":304},[6703],{"type":79,"value":540},{"type":68,"tag":192,"props":6705,"children":6706},{"class":194,"line":529},[6707,6711,6715,6719,6723,6727,6731,6735,6739,6743,6748,6752],{"type":68,"tag":192,"props":6708,"children":6709},{"style":348},[6710],{"type":79,"value":351},{"type":68,"tag":192,"props":6712,"children":6713},{"style":304},[6714],{"type":79,"value":6347},{"type":68,"tag":192,"props":6716,"children":6717},{"style":298},[6718],{"type":79,"value":361},{"type":68,"tag":192,"props":6720,"children":6721},{"style":292},[6722],{"type":79,"value":366},{"type":68,"tag":192,"props":6724,"children":6725},{"style":304},[6726],{"type":79,"value":1930},{"type":68,"tag":192,"props":6728,"children":6729},{"style":298},[6730],{"type":79,"value":230},{"type":68,"tag":192,"props":6732,"children":6733},{"style":369},[6734],{"type":79,"value":6368},{"type":68,"tag":192,"props":6736,"children":6737},{"style":304},[6738],{"type":79,"value":376},{"type":68,"tag":192,"props":6740,"children":6741},{"style":298},[6742],{"type":79,"value":423},{"type":68,"tag":192,"props":6744,"children":6745},{"style":205},[6746],{"type":79,"value":6747},"file:\u002F\u002F\u002Fproject\u002FREADME.md",{"type":68,"tag":192,"props":6749,"children":6750},{"style":298},[6751],{"type":79,"value":423},{"type":68,"tag":192,"props":6753,"children":6754},{"style":304},[6755],{"type":79,"value":540},{"type":68,"tag":192,"props":6757,"children":6758},{"class":194,"line":1165},[6759,6763,6768,6772,6777,6781,6786,6790,6795],{"type":68,"tag":192,"props":6760,"children":6761},{"style":348},[6762],{"type":79,"value":351},{"type":68,"tag":192,"props":6764,"children":6765},{"style":304},[6766],{"type":79,"value":6767}," parts ",{"type":68,"tag":192,"props":6769,"children":6770},{"style":298},[6771],{"type":79,"value":361},{"type":68,"tag":192,"props":6773,"children":6774},{"style":304},[6775],{"type":79,"value":6776}," resource",{"type":68,"tag":192,"props":6778,"children":6779},{"style":298},[6780],{"type":79,"value":230},{"type":68,"tag":192,"props":6782,"children":6783},{"style":304},[6784],{"type":79,"value":6785},"contents",{"type":68,"tag":192,"props":6787,"children":6788},{"style":298},[6789],{"type":79,"value":230},{"type":68,"tag":192,"props":6791,"children":6792},{"style":369},[6793],{"type":79,"value":6794},"map",{"type":68,"tag":192,"props":6796,"children":6797},{"style":304},[6798],{"type":79,"value":6799},"(mcpResourceToContentPart)\n",{"type":68,"tag":192,"props":6801,"children":6802},{"class":194,"line":1228},[6803],{"type":68,"tag":192,"props":6804,"children":6805},{"emptyLinePlaceholder":338},[6806],{"type":79,"value":341},{"type":68,"tag":192,"props":6808,"children":6809},{"class":194,"line":1246},[6810,6814,6818,6822,6826,6830],{"type":68,"tag":192,"props":6811,"children":6812},{"style":348},[6813],{"type":79,"value":351},{"type":68,"tag":192,"props":6815,"children":6816},{"style":304},[6817],{"type":79,"value":1970},{"type":68,"tag":192,"props":6819,"children":6820},{"style":298},[6821],{"type":79,"value":361},{"type":68,"tag":192,"props":6823,"children":6824},{"style":369},[6825],{"type":79,"value":1979},{"type":68,"tag":192,"props":6827,"children":6828},{"style":304},[6829],{"type":79,"value":376},{"type":68,"tag":192,"props":6831,"children":6832},{"style":298},[6833],{"type":79,"value":381},{"type":68,"tag":192,"props":6835,"children":6836},{"class":194,"line":1807},[6837,6841,6845,6849,6853,6857,6861,6865,6869],{"type":68,"tag":192,"props":6838,"children":6839},{"style":388},[6840],{"type":79,"value":1995},{"type":68,"tag":192,"props":6842,"children":6843},{"style":298},[6844],{"type":79,"value":396},{"type":68,"tag":192,"props":6846,"children":6847},{"style":369},[6848],{"type":79,"value":2004},{"type":68,"tag":192,"props":6850,"children":6851},{"style":304},[6852],{"type":79,"value":376},{"type":68,"tag":192,"props":6854,"children":6855},{"style":298},[6856],{"type":79,"value":423},{"type":68,"tag":192,"props":6858,"children":6859},{"style":205},[6860],{"type":79,"value":2017},{"type":68,"tag":192,"props":6862,"children":6863},{"style":298},[6864],{"type":79,"value":423},{"type":68,"tag":192,"props":6866,"children":6867},{"style":304},[6868],{"type":79,"value":1239},{"type":68,"tag":192,"props":6870,"children":6871},{"style":298},[6872],{"type":79,"value":663},{"type":68,"tag":192,"props":6874,"children":6875},{"class":194,"line":1815},[6876,6880,6884],{"type":68,"tag":192,"props":6877,"children":6878},{"style":388},[6879],{"type":79,"value":2037},{"type":68,"tag":192,"props":6881,"children":6882},{"style":298},[6883],{"type":79,"value":396},{"type":68,"tag":192,"props":6885,"children":6886},{"style":304},[6887],{"type":79,"value":3127},{"type":68,"tag":192,"props":6889,"children":6890},{"class":194,"line":2651},[6891],{"type":68,"tag":192,"props":6892,"children":6893},{"style":298},[6894],{"type":79,"value":3135},{"type":68,"tag":192,"props":6896,"children":6897},{"class":194,"line":2715},[6898,6903,6907,6911,6916,6920],{"type":68,"tag":192,"props":6899,"children":6900},{"style":388},[6901],{"type":79,"value":6902},"      role",{"type":68,"tag":192,"props":6904,"children":6905},{"style":298},[6906],{"type":79,"value":396},{"type":68,"tag":192,"props":6908,"children":6909},{"style":298},[6910],{"type":79,"value":322},{"type":68,"tag":192,"props":6912,"children":6913},{"style":205},[6914],{"type":79,"value":6915},"user",{"type":68,"tag":192,"props":6917,"children":6918},{"style":298},[6919],{"type":79,"value":423},{"type":68,"tag":192,"props":6921,"children":6922},{"style":298},[6923],{"type":79,"value":663},{"type":68,"tag":192,"props":6925,"children":6926},{"class":194,"line":2727},[6927,6932,6936],{"type":68,"tag":192,"props":6928,"children":6929},{"style":388},[6930],{"type":79,"value":6931},"      content",{"type":68,"tag":192,"props":6933,"children":6934},{"style":298},[6935],{"type":79,"value":396},{"type":68,"tag":192,"props":6937,"children":6938},{"style":304},[6939],{"type":79,"value":3127},{"type":68,"tag":192,"props":6941,"children":6942},{"class":194,"line":2735},[6943,6948,6953],{"type":68,"tag":192,"props":6944,"children":6945},{"style":298},[6946],{"type":79,"value":6947},"        ...",{"type":68,"tag":192,"props":6949,"children":6950},{"style":304},[6951],{"type":79,"value":6952},"parts",{"type":68,"tag":192,"props":6954,"children":6955},{"style":298},[6956],{"type":79,"value":663},{"type":68,"tag":192,"props":6958,"children":6959},{"class":194,"line":2744},[6960,6965,6969,6973,6977,6981,6985,6989,6994,6998,7002,7007,7011],{"type":68,"tag":192,"props":6961,"children":6962},{"style":298},[6963],{"type":79,"value":6964},"        {",{"type":68,"tag":192,"props":6966,"children":6967},{"style":388},[6968],{"type":79,"value":405},{"type":68,"tag":192,"props":6970,"children":6971},{"style":298},[6972],{"type":79,"value":396},{"type":68,"tag":192,"props":6974,"children":6975},{"style":298},[6976],{"type":79,"value":322},{"type":68,"tag":192,"props":6978,"children":6979},{"style":205},[6980],{"type":79,"value":79},{"type":68,"tag":192,"props":6982,"children":6983},{"style":298},[6984],{"type":79,"value":423},{"type":68,"tag":192,"props":6986,"children":6987},{"style":298},[6988],{"type":79,"value":428},{"type":68,"tag":192,"props":6990,"children":6991},{"style":388},[6992],{"type":79,"value":6993}," content",{"type":68,"tag":192,"props":6995,"children":6996},{"style":298},[6997],{"type":79,"value":396},{"type":68,"tag":192,"props":6999,"children":7000},{"style":298},[7001],{"type":79,"value":322},{"type":68,"tag":192,"props":7003,"children":7004},{"style":205},[7005],{"type":79,"value":7006},"Summarize this document.",{"type":68,"tag":192,"props":7008,"children":7009},{"style":298},[7010],{"type":79,"value":423},{"type":68,"tag":192,"props":7012,"children":7013},{"style":298},[7014],{"type":79,"value":455},{"type":68,"tag":192,"props":7016,"children":7017},{"class":194,"line":3321},[7018,7023],{"type":68,"tag":192,"props":7019,"children":7020},{"style":304},[7021],{"type":79,"value":7022},"      ]",{"type":68,"tag":192,"props":7024,"children":7025},{"style":298},[7026],{"type":79,"value":663},{"type":68,"tag":192,"props":7028,"children":7029},{"class":194,"line":3339},[7030],{"type":68,"tag":192,"props":7031,"children":7032},{"style":298},[7033],{"type":79,"value":3295},{"type":68,"tag":192,"props":7035,"children":7036},{"class":194,"line":3347},[7037,7041],{"type":68,"tag":192,"props":7038,"children":7039},{"style":304},[7040],{"type":79,"value":3303},{"type":68,"tag":192,"props":7042,"children":7043},{"style":298},[7044],{"type":79,"value":663},{"type":68,"tag":192,"props":7046,"children":7047},{"class":194,"line":3356},[7048,7052],{"type":68,"tag":192,"props":7049,"children":7050},{"style":298},[7051],{"type":79,"value":535},{"type":68,"tag":192,"props":7053,"children":7054},{"style":304},[7055],{"type":79,"value":540},{"type":68,"tag":111,"props":7057,"children":7059},{"id":7058},"prompts",[7060],{"type":79,"value":7061},"Prompts",{"type":68,"tag":181,"props":7063,"children":7065},{"className":281,"code":7064,"language":45,"meta":186,"style":186},"\u002F\u002F List prompts the server exposes.\nconst prompts = await client.prompts()\n\n\u002F\u002F Get a prompt (with optional arguments).\nconst prompt = await client.getPrompt('review_code', { language: 'TypeScript' })\n\n\u002F\u002F Convert to TanStack ModelMessage[] for use in chat().\nimport { mcpPromptToMessages } from '@tanstack\u002Fai-mcp'\n\nconst messages = mcpPromptToMessages(prompt)\n\u002F\u002F messages: ModelMessage[]  (role: 'user' | 'assistant')\n\nconst stream = chat({\n  adapter: openaiText('gpt-5.5'),\n  messages: [...messages, ...userMessages],\n})\n",[7066],{"type":68,"tag":74,"props":7067,"children":7068},{"__ignoreMap":186},[7069,7077,7113,7120,7128,7216,7223,7231,7267,7274,7299,7307,7314,7341,7380,7421],{"type":68,"tag":192,"props":7070,"children":7071},{"class":194,"line":195},[7072],{"type":68,"tag":192,"props":7073,"children":7074},{"style":488},[7075],{"type":79,"value":7076},"\u002F\u002F List prompts the server exposes.\n",{"type":68,"tag":192,"props":7078,"children":7079},{"class":194,"line":334},[7080,7084,7089,7093,7097,7101,7105,7109],{"type":68,"tag":192,"props":7081,"children":7082},{"style":348},[7083],{"type":79,"value":351},{"type":68,"tag":192,"props":7085,"children":7086},{"style":304},[7087],{"type":79,"value":7088}," prompts ",{"type":68,"tag":192,"props":7090,"children":7091},{"style":298},[7092],{"type":79,"value":361},{"type":68,"tag":192,"props":7094,"children":7095},{"style":292},[7096],{"type":79,"value":366},{"type":68,"tag":192,"props":7098,"children":7099},{"style":304},[7100],{"type":79,"value":1930},{"type":68,"tag":192,"props":7102,"children":7103},{"style":298},[7104],{"type":79,"value":230},{"type":68,"tag":192,"props":7106,"children":7107},{"style":369},[7108],{"type":79,"value":7058},{"type":68,"tag":192,"props":7110,"children":7111},{"style":304},[7112],{"type":79,"value":1403},{"type":68,"tag":192,"props":7114,"children":7115},{"class":194,"line":344},[7116],{"type":68,"tag":192,"props":7117,"children":7118},{"emptyLinePlaceholder":338},[7119],{"type":79,"value":341},{"type":68,"tag":192,"props":7121,"children":7122},{"class":194,"line":384},[7123],{"type":68,"tag":192,"props":7124,"children":7125},{"style":488},[7126],{"type":79,"value":7127},"\u002F\u002F Get a prompt (with optional arguments).\n",{"type":68,"tag":192,"props":7129,"children":7130},{"class":194,"line":458},[7131,7135,7140,7144,7148,7152,7156,7161,7165,7169,7174,7178,7182,7186,7191,7195,7199,7204,7208,7212],{"type":68,"tag":192,"props":7132,"children":7133},{"style":348},[7134],{"type":79,"value":351},{"type":68,"tag":192,"props":7136,"children":7137},{"style":304},[7138],{"type":79,"value":7139}," prompt ",{"type":68,"tag":192,"props":7141,"children":7142},{"style":298},[7143],{"type":79,"value":361},{"type":68,"tag":192,"props":7145,"children":7146},{"style":292},[7147],{"type":79,"value":366},{"type":68,"tag":192,"props":7149,"children":7150},{"style":304},[7151],{"type":79,"value":1930},{"type":68,"tag":192,"props":7153,"children":7154},{"style":298},[7155],{"type":79,"value":230},{"type":68,"tag":192,"props":7157,"children":7158},{"style":369},[7159],{"type":79,"value":7160},"getPrompt",{"type":68,"tag":192,"props":7162,"children":7163},{"style":304},[7164],{"type":79,"value":376},{"type":68,"tag":192,"props":7166,"children":7167},{"style":298},[7168],{"type":79,"value":423},{"type":68,"tag":192,"props":7170,"children":7171},{"style":205},[7172],{"type":79,"value":7173},"review_code",{"type":68,"tag":192,"props":7175,"children":7176},{"style":298},[7177],{"type":79,"value":423},{"type":68,"tag":192,"props":7179,"children":7180},{"style":298},[7181],{"type":79,"value":428},{"type":68,"tag":192,"props":7183,"children":7184},{"style":298},[7185],{"type":79,"value":301},{"type":68,"tag":192,"props":7187,"children":7188},{"style":388},[7189],{"type":79,"value":7190}," language",{"type":68,"tag":192,"props":7192,"children":7193},{"style":298},[7194],{"type":79,"value":396},{"type":68,"tag":192,"props":7196,"children":7197},{"style":298},[7198],{"type":79,"value":322},{"type":68,"tag":192,"props":7200,"children":7201},{"style":205},[7202],{"type":79,"value":7203},"TypeScript",{"type":68,"tag":192,"props":7205,"children":7206},{"style":298},[7207],{"type":79,"value":423},{"type":68,"tag":192,"props":7209,"children":7210},{"style":298},[7211],{"type":79,"value":312},{"type":68,"tag":192,"props":7213,"children":7214},{"style":304},[7215],{"type":79,"value":540},{"type":68,"tag":192,"props":7217,"children":7218},{"class":194,"line":494},[7219],{"type":68,"tag":192,"props":7220,"children":7221},{"emptyLinePlaceholder":338},[7222],{"type":79,"value":341},{"type":68,"tag":192,"props":7224,"children":7225},{"class":194,"line":529},[7226],{"type":68,"tag":192,"props":7227,"children":7228},{"style":488},[7229],{"type":79,"value":7230},"\u002F\u002F Convert to TanStack ModelMessage[] for use in chat().\n",{"type":68,"tag":192,"props":7232,"children":7233},{"class":194,"line":1165},[7234,7238,7242,7247,7251,7255,7259,7263],{"type":68,"tag":192,"props":7235,"children":7236},{"style":292},[7237],{"type":79,"value":295},{"type":68,"tag":192,"props":7239,"children":7240},{"style":298},[7241],{"type":79,"value":301},{"type":68,"tag":192,"props":7243,"children":7244},{"style":304},[7245],{"type":79,"value":7246}," mcpPromptToMessages",{"type":68,"tag":192,"props":7248,"children":7249},{"style":298},[7250],{"type":79,"value":312},{"type":68,"tag":192,"props":7252,"children":7253},{"style":292},[7254],{"type":79,"value":317},{"type":68,"tag":192,"props":7256,"children":7257},{"style":298},[7258],{"type":79,"value":322},{"type":68,"tag":192,"props":7260,"children":7261},{"style":205},[7262],{"type":79,"value":80},{"type":68,"tag":192,"props":7264,"children":7265},{"style":298},[7266],{"type":79,"value":331},{"type":68,"tag":192,"props":7268,"children":7269},{"class":194,"line":1228},[7270],{"type":68,"tag":192,"props":7271,"children":7272},{"emptyLinePlaceholder":338},[7273],{"type":79,"value":341},{"type":68,"tag":192,"props":7275,"children":7276},{"class":194,"line":1246},[7277,7281,7286,7290,7294],{"type":68,"tag":192,"props":7278,"children":7279},{"style":348},[7280],{"type":79,"value":351},{"type":68,"tag":192,"props":7282,"children":7283},{"style":304},[7284],{"type":79,"value":7285}," messages ",{"type":68,"tag":192,"props":7287,"children":7288},{"style":298},[7289],{"type":79,"value":361},{"type":68,"tag":192,"props":7291,"children":7292},{"style":369},[7293],{"type":79,"value":7246},{"type":68,"tag":192,"props":7295,"children":7296},{"style":304},[7297],{"type":79,"value":7298},"(prompt)\n",{"type":68,"tag":192,"props":7300,"children":7301},{"class":194,"line":1807},[7302],{"type":68,"tag":192,"props":7303,"children":7304},{"style":488},[7305],{"type":79,"value":7306},"\u002F\u002F messages: ModelMessage[]  (role: 'user' | 'assistant')\n",{"type":68,"tag":192,"props":7308,"children":7309},{"class":194,"line":1815},[7310],{"type":68,"tag":192,"props":7311,"children":7312},{"emptyLinePlaceholder":338},[7313],{"type":79,"value":341},{"type":68,"tag":192,"props":7315,"children":7316},{"class":194,"line":2651},[7317,7321,7325,7329,7333,7337],{"type":68,"tag":192,"props":7318,"children":7319},{"style":348},[7320],{"type":79,"value":351},{"type":68,"tag":192,"props":7322,"children":7323},{"style":304},[7324],{"type":79,"value":1970},{"type":68,"tag":192,"props":7326,"children":7327},{"style":298},[7328],{"type":79,"value":361},{"type":68,"tag":192,"props":7330,"children":7331},{"style":369},[7332],{"type":79,"value":1979},{"type":68,"tag":192,"props":7334,"children":7335},{"style":304},[7336],{"type":79,"value":376},{"type":68,"tag":192,"props":7338,"children":7339},{"style":298},[7340],{"type":79,"value":381},{"type":68,"tag":192,"props":7342,"children":7343},{"class":194,"line":2715},[7344,7348,7352,7356,7360,7364,7368,7372,7376],{"type":68,"tag":192,"props":7345,"children":7346},{"style":388},[7347],{"type":79,"value":1995},{"type":68,"tag":192,"props":7349,"children":7350},{"style":298},[7351],{"type":79,"value":396},{"type":68,"tag":192,"props":7353,"children":7354},{"style":369},[7355],{"type":79,"value":2004},{"type":68,"tag":192,"props":7357,"children":7358},{"style":304},[7359],{"type":79,"value":376},{"type":68,"tag":192,"props":7361,"children":7362},{"style":298},[7363],{"type":79,"value":423},{"type":68,"tag":192,"props":7365,"children":7366},{"style":205},[7367],{"type":79,"value":2017},{"type":68,"tag":192,"props":7369,"children":7370},{"style":298},[7371],{"type":79,"value":423},{"type":68,"tag":192,"props":7373,"children":7374},{"style":304},[7375],{"type":79,"value":1239},{"type":68,"tag":192,"props":7377,"children":7378},{"style":298},[7379],{"type":79,"value":663},{"type":68,"tag":192,"props":7381,"children":7382},{"class":194,"line":2727},[7383,7387,7391,7395,7399,7404,7408,7412,7417],{"type":68,"tag":192,"props":7384,"children":7385},{"style":388},[7386],{"type":79,"value":2037},{"type":68,"tag":192,"props":7388,"children":7389},{"style":298},[7390],{"type":79,"value":396},{"type":68,"tag":192,"props":7392,"children":7393},{"style":304},[7394],{"type":79,"value":1123},{"type":68,"tag":192,"props":7396,"children":7397},{"style":298},[7398],{"type":79,"value":2979},{"type":68,"tag":192,"props":7400,"children":7401},{"style":304},[7402],{"type":79,"value":7403},"messages",{"type":68,"tag":192,"props":7405,"children":7406},{"style":298},[7407],{"type":79,"value":428},{"type":68,"tag":192,"props":7409,"children":7410},{"style":298},[7411],{"type":79,"value":5904},{"type":68,"tag":192,"props":7413,"children":7414},{"style":304},[7415],{"type":79,"value":7416},"userMessages]",{"type":68,"tag":192,"props":7418,"children":7419},{"style":298},[7420],{"type":79,"value":663},{"type":68,"tag":192,"props":7422,"children":7423},{"class":194,"line":2735},[7424,7428],{"type":68,"tag":192,"props":7425,"children":7426},{"style":298},[7427],{"type":79,"value":535},{"type":68,"tag":192,"props":7429,"children":7430},{"style":304},[7431],{"type":79,"value":540},{"type":68,"tag":111,"props":7433,"children":7435},{"id":7434},"mcp-apps",[7436],{"type":79,"value":7437},"MCP Apps",{"type":68,"tag":82,"props":7439,"children":7440},{},[7441,7443,7449],{"type":79,"value":7442},"MCP Apps let an MCP tool surface a UI widget (static or interactive) on the\nclient. Two variants exist. See ",{"type":68,"tag":74,"props":7444,"children":7446},{"className":7445},[],[7447],{"type":79,"value":7448},"docs\u002Fmcp\u002Fapps.md",{"type":79,"value":7450}," for the full guide.",{"type":68,"tag":568,"props":7452,"children":7454},{"id":7453},"static-widgets-uiresourcepart",[7455,7457],{"type":79,"value":7456},"Static widgets — ",{"type":68,"tag":74,"props":7458,"children":7460},{"className":7459},[],[7461],{"type":79,"value":7462},"UIResourcePart",{"type":68,"tag":82,"props":7464,"children":7465},{},[7466,7468,7474,7476,7481,7482,7493,7495,7501,7503,7509,7511,7516,7518,7523,7525,7530,7532,7537],{"type":79,"value":7467},"When an MCP tool result carries a ",{"type":68,"tag":74,"props":7469,"children":7471},{"className":7470},[],[7472],{"type":79,"value":7473},"ui:\u002F\u002F",{"type":79,"value":7475}," resource, TanStack AI emits a\n",{"type":68,"tag":74,"props":7477,"children":7479},{"className":7478},[],[7480],{"type":79,"value":7462},{"type":79,"value":1490},{"type":68,"tag":1476,"props":7483,"children":7484},{},[7485,7487],{"type":79,"value":7486},"assistant ",{"type":68,"tag":74,"props":7488,"children":7490},{"className":7489},[],[7491],{"type":79,"value":7492},"UIMessage",{"type":79,"value":7494},", alongside the normal\n",{"type":68,"tag":74,"props":7496,"children":7498},{"className":7497},[],[7499],{"type":79,"value":7500},"ToolCallPart",{"type":79,"value":7502}," \u002F ",{"type":68,"tag":74,"props":7504,"children":7506},{"className":7505},[],[7507],{"type":79,"value":7508},"ToolResultPart",{"type":79,"value":7510},". It is purely presentational — it never\nenters model input. The resource is read eagerly during the ",{"type":68,"tag":74,"props":7512,"children":7514},{"className":7513},[],[7515],{"type":79,"value":107},{"type":79,"value":7517}," run; if\nthe read fails the tool result still flows to the model and the widget is\nsimply absent (fail-soft). Static widgets require the MCP source to expose\n",{"type":68,"tag":74,"props":7519,"children":7521},{"className":7520},[],[7522],{"type":79,"value":6368},{"type":79,"value":7524}," — both ",{"type":68,"tag":74,"props":7526,"children":7528},{"className":7527},[],[7529],{"type":79,"value":238},{"type":79,"value":7531}," and a ",{"type":68,"tag":74,"props":7533,"children":7535},{"className":7534},[],[7536],{"type":79,"value":246},{"type":79,"value":7538}," pool do.",{"type":68,"tag":181,"props":7540,"children":7542},{"className":281,"code":7541,"language":45,"meta":186,"style":186},"import type { UIResourcePart } from '@tanstack\u002Fai'\n\n\u002F\u002F UIResourcePart shape (on the assistant UIMessage):\n\u002F\u002F {\n\u002F\u002F   type: 'ui-resource'\n\u002F\u002F   resource: { uri: string; mimeType: string; text?: string; blob?: string }\n\u002F\u002F   serverId?: string     \u002F\u002F pool prefix \u002F config key — routes interactive calls\n\u002F\u002F   toolCallId: string    \u002F\u002F links to the originating tool call\n\u002F\u002F   toolName: string      \u002F\u002F server-native MCP tool name whose UI this renders\n\u002F\u002F   meta?: Record\u003Cstring, unknown>  \u002F\u002F reserved — currently always undefined\n\u002F\u002F }\n",[7543],{"type":68,"tag":74,"props":7544,"children":7545},{"__ignoreMap":186},[7546,7586,7593,7601,7609,7617,7625,7638,7651,7664,7677],{"type":68,"tag":192,"props":7547,"children":7548},{"class":194,"line":195},[7549,7553,7557,7561,7566,7570,7574,7578,7582],{"type":68,"tag":192,"props":7550,"children":7551},{"style":292},[7552],{"type":79,"value":295},{"type":68,"tag":192,"props":7554,"children":7555},{"style":292},[7556],{"type":79,"value":405},{"type":68,"tag":192,"props":7558,"children":7559},{"style":298},[7560],{"type":79,"value":301},{"type":68,"tag":192,"props":7562,"children":7563},{"style":304},[7564],{"type":79,"value":7565}," UIResourcePart",{"type":68,"tag":192,"props":7567,"children":7568},{"style":298},[7569],{"type":79,"value":312},{"type":68,"tag":192,"props":7571,"children":7572},{"style":292},[7573],{"type":79,"value":317},{"type":68,"tag":192,"props":7575,"children":7576},{"style":298},[7577],{"type":79,"value":322},{"type":68,"tag":192,"props":7579,"children":7580},{"style":205},[7581],{"type":79,"value":2259},{"type":68,"tag":192,"props":7583,"children":7584},{"style":298},[7585],{"type":79,"value":331},{"type":68,"tag":192,"props":7587,"children":7588},{"class":194,"line":334},[7589],{"type":68,"tag":192,"props":7590,"children":7591},{"emptyLinePlaceholder":338},[7592],{"type":79,"value":341},{"type":68,"tag":192,"props":7594,"children":7595},{"class":194,"line":344},[7596],{"type":68,"tag":192,"props":7597,"children":7598},{"style":488},[7599],{"type":79,"value":7600},"\u002F\u002F UIResourcePart shape (on the assistant UIMessage):\n",{"type":68,"tag":192,"props":7602,"children":7603},{"class":194,"line":384},[7604],{"type":68,"tag":192,"props":7605,"children":7606},{"style":488},[7607],{"type":79,"value":7608},"\u002F\u002F {\n",{"type":68,"tag":192,"props":7610,"children":7611},{"class":194,"line":458},[7612],{"type":68,"tag":192,"props":7613,"children":7614},{"style":488},[7615],{"type":79,"value":7616},"\u002F\u002F   type: 'ui-resource'\n",{"type":68,"tag":192,"props":7618,"children":7619},{"class":194,"line":494},[7620],{"type":68,"tag":192,"props":7621,"children":7622},{"style":488},[7623],{"type":79,"value":7624},"\u002F\u002F   resource: { uri: string; mimeType: string; text?: string; blob?: string }\n",{"type":68,"tag":192,"props":7626,"children":7627},{"class":194,"line":529},[7628,7633],{"type":68,"tag":192,"props":7629,"children":7630},{"style":488},[7631],{"type":79,"value":7632},"\u002F\u002F   serverId?: string",{"type":68,"tag":192,"props":7634,"children":7635},{"style":488},[7636],{"type":79,"value":7637},"     \u002F\u002F pool prefix \u002F config key — routes interactive calls\n",{"type":68,"tag":192,"props":7639,"children":7640},{"class":194,"line":1165},[7641,7646],{"type":68,"tag":192,"props":7642,"children":7643},{"style":488},[7644],{"type":79,"value":7645},"\u002F\u002F   toolCallId: string",{"type":68,"tag":192,"props":7647,"children":7648},{"style":488},[7649],{"type":79,"value":7650},"    \u002F\u002F links to the originating tool call\n",{"type":68,"tag":192,"props":7652,"children":7653},{"class":194,"line":1228},[7654,7659],{"type":68,"tag":192,"props":7655,"children":7656},{"style":488},[7657],{"type":79,"value":7658},"\u002F\u002F   toolName: string",{"type":68,"tag":192,"props":7660,"children":7661},{"style":488},[7662],{"type":79,"value":7663},"      \u002F\u002F server-native MCP tool name whose UI this renders\n",{"type":68,"tag":192,"props":7665,"children":7666},{"class":194,"line":1246},[7667,7672],{"type":68,"tag":192,"props":7668,"children":7669},{"style":488},[7670],{"type":79,"value":7671},"\u002F\u002F   meta?: Record\u003Cstring, unknown>",{"type":68,"tag":192,"props":7673,"children":7674},{"style":488},[7675],{"type":79,"value":7676},"  \u002F\u002F reserved — currently always undefined\n",{"type":68,"tag":192,"props":7678,"children":7679},{"class":194,"line":1807},[7680],{"type":68,"tag":192,"props":7681,"children":7682},{"style":488},[7683],{"type":79,"value":3978},{"type":68,"tag":568,"props":7685,"children":7687},{"id":7686},"interactive-apps-createmcpappcallhandler",[7688,7690],{"type":79,"value":7689},"Interactive apps — ",{"type":68,"tag":74,"props":7691,"children":7693},{"className":7692},[],[7694],{"type":79,"value":7695},"createMcpAppCallHandler",{"type":68,"tag":82,"props":7697,"children":7698},{},[7699,7701,7706,7708,7714,7716,7721,7723,7728,7730,7736,7738,7744,7746,7751,7753,7759,7761,7767],{"type":79,"value":7700},"For interactive apps (the widget iframe posts tool-call \u002F prompt \u002F link\nactions back), mount ",{"type":68,"tag":74,"props":7702,"children":7704},{"className":7703},[],[7705],{"type":79,"value":7695},{"type":79,"value":7707}," from ",{"type":68,"tag":74,"props":7709,"children":7711},{"className":7710},[],[7712],{"type":79,"value":7713},"@tanstack\u002Fai-mcp\u002Fapps",{"type":79,"value":7715},"\nat a POST route. Pass the MCP client(s) you already created — a single\n",{"type":68,"tag":74,"props":7717,"children":7719},{"className":7718},[],[7720],{"type":79,"value":556},{"type":79,"value":7722},", an ",{"type":68,"tag":74,"props":7724,"children":7726},{"className":7725},[],[7727],{"type":79,"value":4984},{"type":79,"value":7729}," pool, or an array of either. The handler reads\neach client's transport descriptor via ",{"type":68,"tag":74,"props":7731,"children":7733},{"className":7732},[],[7734],{"type":79,"value":7735},"client.getInfo()",{"type":79,"value":7737}," \u002F\n",{"type":68,"tag":74,"props":7739,"children":7741},{"className":7740},[],[7742],{"type":79,"value":7743},"pool.getServers()",{"type":79,"value":7745}," (pure config, not a live socket) and ",{"type":68,"tag":1476,"props":7747,"children":7748},{},[7749],{"type":79,"value":7750},"reconnects\nper-call",{"type":79,"value":7752}," (stateless \u002F serverless-safe). It matches the widget-supplied\nnative (unprefixed) tool name against the server's unprefixed tool names,\nenforces a same-server allowlist, and returns ",{"type":68,"tag":74,"props":7754,"children":7756},{"className":7755},[],[7757],{"type":79,"value":7758},"{ ok: true, result }",{"type":79,"value":7760}," or\n",{"type":68,"tag":74,"props":7762,"children":7764},{"className":7763},[],[7765],{"type":79,"value":7766},"{ ok: false, error }",{"type":79,"value":230},{"type":68,"tag":82,"props":7769,"children":7770},{},[7771,7773,7779,7780,7785,7787,7793,7795,7800],{"type":79,"value":7772},"For a pool, the ",{"type":68,"tag":74,"props":7774,"children":7776},{"className":7775},[],[7777],{"type":79,"value":7778},"serverId",{"type":79,"value":1490},{"type":68,"tag":74,"props":7781,"children":7783},{"className":7782},[],[7784],{"type":79,"value":7462},{"type":79,"value":7786}," is the config key (the\ntool prefix); for a single client it is the client's ",{"type":68,"tag":74,"props":7788,"children":7790},{"className":7789},[],[7791],{"type":79,"value":7792},"prefix",{"type":79,"value":7794}," (or the sole\ndefault when ",{"type":68,"tag":74,"props":7796,"children":7798},{"className":7797},[],[7799],{"type":79,"value":7778},{"type":79,"value":7801}," is absent and there is exactly one client).",{"type":68,"tag":181,"props":7803,"children":7805},{"className":281,"code":7804,"language":45,"meta":186,"style":186},"import { createMCPClients } from '@tanstack\u002Fai-mcp'\nimport {\n  createMcpAppCallHandler,\n  inMemoryMcpSessionStore,\n} from '@tanstack\u002Fai-mcp\u002Fapps'\n\n\u002F\u002F Reuse the same pool you pass to chat({ mcp: { clients: [mcp] } }).\nconst mcp = await createMCPClients({\n  weather: {\n    transport: { type: 'http', url: 'https:\u002F\u002Fmcp-app.example.com\u002Fmcp' },\n  },\n})\n\n\u002F\u002F Minimal — reconnect-per-call via getServers() descriptor.\nconst handler = createMcpAppCallHandler({ clients: mcp })\n\n\u002F\u002F Options:\n\u002F\u002F clients   — MCPClient | MCPClients | Array\u003CMCPClient | MCPClients> (required).\n\u002F\u002F             The handler reads transport descriptors via client.getInfo() \u002F\n\u002F\u002F             pool.getServers() — the client does not need a live connection.\n\u002F\u002F store     — optional dynamic\u002Fstateful session store (e.g.\n\u002F\u002F             inMemoryMcpSessionStore()); used alongside clients.\n\u002F\u002F allowTool — optional authorizer receiving the WHOLE request:\n\u002F\u002F             (req: McpAppCallRequest) => boolean | Promise\u003Cboolean>.\n\u002F\u002F             The server-exposure check is ALWAYS enforced (the handler\n\u002F\u002F             rejects any tool the server does not expose). `allowTool`\n\u002F\u002F             is an ADDITIONAL restriction AND-ed on top: a request must\n\u002F\u002F             satisfy BOTH the server-exposure check and allowTool.\nconst handlerWithStore = createMcpAppCallHandler({\n  clients: mcp,\n  store: inMemoryMcpSessionStore(),\n  allowTool: (req) => req.toolName === 'place_order',\n})\n",[7806],{"type":68,"tag":74,"props":7807,"children":7808},{"__ignoreMap":186},[7809,7844,7855,7867,7879,7902,7909,7917,7949,7965,8030,8037,8048,8055,8063,8112,8119,8127,8135,8143,8151,8159,8167,8175,8183,8191,8199,8207,8215,8243,8264,8289,8354],{"type":68,"tag":192,"props":7810,"children":7811},{"class":194,"line":195},[7812,7816,7820,7824,7828,7832,7836,7840],{"type":68,"tag":192,"props":7813,"children":7814},{"style":292},[7815],{"type":79,"value":295},{"type":68,"tag":192,"props":7817,"children":7818},{"style":298},[7819],{"type":79,"value":301},{"type":68,"tag":192,"props":7821,"children":7822},{"style":304},[7823],{"type":79,"value":5018},{"type":68,"tag":192,"props":7825,"children":7826},{"style":298},[7827],{"type":79,"value":312},{"type":68,"tag":192,"props":7829,"children":7830},{"style":292},[7831],{"type":79,"value":317},{"type":68,"tag":192,"props":7833,"children":7834},{"style":298},[7835],{"type":79,"value":322},{"type":68,"tag":192,"props":7837,"children":7838},{"style":205},[7839],{"type":79,"value":80},{"type":68,"tag":192,"props":7841,"children":7842},{"style":298},[7843],{"type":79,"value":331},{"type":68,"tag":192,"props":7845,"children":7846},{"class":194,"line":334},[7847,7851],{"type":68,"tag":192,"props":7848,"children":7849},{"style":292},[7850],{"type":79,"value":295},{"type":68,"tag":192,"props":7852,"children":7853},{"style":298},[7854],{"type":79,"value":634},{"type":68,"tag":192,"props":7856,"children":7857},{"class":194,"line":344},[7858,7863],{"type":68,"tag":192,"props":7859,"children":7860},{"style":304},[7861],{"type":79,"value":7862},"  createMcpAppCallHandler",{"type":68,"tag":192,"props":7864,"children":7865},{"style":298},[7866],{"type":79,"value":663},{"type":68,"tag":192,"props":7868,"children":7869},{"class":194,"line":384},[7870,7875],{"type":68,"tag":192,"props":7871,"children":7872},{"style":304},[7873],{"type":79,"value":7874},"  inMemoryMcpSessionStore",{"type":68,"tag":192,"props":7876,"children":7877},{"style":298},[7878],{"type":79,"value":663},{"type":68,"tag":192,"props":7880,"children":7881},{"class":194,"line":458},[7882,7886,7890,7894,7898],{"type":68,"tag":192,"props":7883,"children":7884},{"style":298},[7885],{"type":79,"value":535},{"type":68,"tag":192,"props":7887,"children":7888},{"style":292},[7889],{"type":79,"value":317},{"type":68,"tag":192,"props":7891,"children":7892},{"style":298},[7893],{"type":79,"value":322},{"type":68,"tag":192,"props":7895,"children":7896},{"style":205},[7897],{"type":79,"value":7713},{"type":68,"tag":192,"props":7899,"children":7900},{"style":298},[7901],{"type":79,"value":331},{"type":68,"tag":192,"props":7903,"children":7904},{"class":194,"line":494},[7905],{"type":68,"tag":192,"props":7906,"children":7907},{"emptyLinePlaceholder":338},[7908],{"type":79,"value":341},{"type":68,"tag":192,"props":7910,"children":7911},{"class":194,"line":529},[7912],{"type":68,"tag":192,"props":7913,"children":7914},{"style":488},[7915],{"type":79,"value":7916},"\u002F\u002F Reuse the same pool you pass to chat({ mcp: { clients: [mcp] } }).\n",{"type":68,"tag":192,"props":7918,"children":7919},{"class":194,"line":1165},[7920,7924,7929,7933,7937,7941,7945],{"type":68,"tag":192,"props":7921,"children":7922},{"style":348},[7923],{"type":79,"value":351},{"type":68,"tag":192,"props":7925,"children":7926},{"style":304},[7927],{"type":79,"value":7928}," mcp ",{"type":68,"tag":192,"props":7930,"children":7931},{"style":298},[7932],{"type":79,"value":361},{"type":68,"tag":192,"props":7934,"children":7935},{"style":292},[7936],{"type":79,"value":366},{"type":68,"tag":192,"props":7938,"children":7939},{"style":369},[7940],{"type":79,"value":5018},{"type":68,"tag":192,"props":7942,"children":7943},{"style":304},[7944],{"type":79,"value":376},{"type":68,"tag":192,"props":7946,"children":7947},{"style":298},[7948],{"type":79,"value":381},{"type":68,"tag":192,"props":7950,"children":7951},{"class":194,"line":1228},[7952,7957,7961],{"type":68,"tag":192,"props":7953,"children":7954},{"style":388},[7955],{"type":79,"value":7956},"  weather",{"type":68,"tag":192,"props":7958,"children":7959},{"style":298},[7960],{"type":79,"value":396},{"type":68,"tag":192,"props":7962,"children":7963},{"style":298},[7964],{"type":79,"value":634},{"type":68,"tag":192,"props":7966,"children":7967},{"class":194,"line":1246},[7968,7973,7977,7981,7985,7989,7993,7997,8001,8005,8009,8013,8017,8022,8026],{"type":68,"tag":192,"props":7969,"children":7970},{"style":388},[7971],{"type":79,"value":7972},"    transport",{"type":68,"tag":192,"props":7974,"children":7975},{"style":298},[7976],{"type":79,"value":396},{"type":68,"tag":192,"props":7978,"children":7979},{"style":298},[7980],{"type":79,"value":301},{"type":68,"tag":192,"props":7982,"children":7983},{"style":388},[7984],{"type":79,"value":405},{"type":68,"tag":192,"props":7986,"children":7987},{"style":298},[7988],{"type":79,"value":396},{"type":68,"tag":192,"props":7990,"children":7991},{"style":298},[7992],{"type":79,"value":322},{"type":68,"tag":192,"props":7994,"children":7995},{"style":205},[7996],{"type":79,"value":418},{"type":68,"tag":192,"props":7998,"children":7999},{"style":298},[8000],{"type":79,"value":423},{"type":68,"tag":192,"props":8002,"children":8003},{"style":298},[8004],{"type":79,"value":428},{"type":68,"tag":192,"props":8006,"children":8007},{"style":388},[8008],{"type":79,"value":433},{"type":68,"tag":192,"props":8010,"children":8011},{"style":298},[8012],{"type":79,"value":396},{"type":68,"tag":192,"props":8014,"children":8015},{"style":298},[8016],{"type":79,"value":322},{"type":68,"tag":192,"props":8018,"children":8019},{"style":205},[8020],{"type":79,"value":8021},"https:\u002F\u002Fmcp-app.example.com\u002Fmcp",{"type":68,"tag":192,"props":8023,"children":8024},{"style":298},[8025],{"type":79,"value":423},{"type":68,"tag":192,"props":8027,"children":8028},{"style":298},[8029],{"type":79,"value":455},{"type":68,"tag":192,"props":8031,"children":8032},{"class":194,"line":1807},[8033],{"type":68,"tag":192,"props":8034,"children":8035},{"style":298},[8036],{"type":79,"value":741},{"type":68,"tag":192,"props":8038,"children":8039},{"class":194,"line":1815},[8040,8044],{"type":68,"tag":192,"props":8041,"children":8042},{"style":298},[8043],{"type":79,"value":535},{"type":68,"tag":192,"props":8045,"children":8046},{"style":304},[8047],{"type":79,"value":540},{"type":68,"tag":192,"props":8049,"children":8050},{"class":194,"line":2651},[8051],{"type":68,"tag":192,"props":8052,"children":8053},{"emptyLinePlaceholder":338},[8054],{"type":79,"value":341},{"type":68,"tag":192,"props":8056,"children":8057},{"class":194,"line":2715},[8058],{"type":68,"tag":192,"props":8059,"children":8060},{"style":488},[8061],{"type":79,"value":8062},"\u002F\u002F Minimal — reconnect-per-call via getServers() descriptor.\n",{"type":68,"tag":192,"props":8064,"children":8065},{"class":194,"line":2727},[8066,8070,8075,8079,8084,8088,8092,8096,8100,8104,8108],{"type":68,"tag":192,"props":8067,"children":8068},{"style":348},[8069],{"type":79,"value":351},{"type":68,"tag":192,"props":8071,"children":8072},{"style":304},[8073],{"type":79,"value":8074}," handler ",{"type":68,"tag":192,"props":8076,"children":8077},{"style":298},[8078],{"type":79,"value":361},{"type":68,"tag":192,"props":8080,"children":8081},{"style":369},[8082],{"type":79,"value":8083}," createMcpAppCallHandler",{"type":68,"tag":192,"props":8085,"children":8086},{"style":304},[8087],{"type":79,"value":376},{"type":68,"tag":192,"props":8089,"children":8090},{"style":298},[8091],{"type":79,"value":1435},{"type":68,"tag":192,"props":8093,"children":8094},{"style":388},[8095],{"type":79,"value":5304},{"type":68,"tag":192,"props":8097,"children":8098},{"style":298},[8099],{"type":79,"value":396},{"type":68,"tag":192,"props":8101,"children":8102},{"style":304},[8103],{"type":79,"value":7928},{"type":68,"tag":192,"props":8105,"children":8106},{"style":298},[8107],{"type":79,"value":535},{"type":68,"tag":192,"props":8109,"children":8110},{"style":304},[8111],{"type":79,"value":540},{"type":68,"tag":192,"props":8113,"children":8114},{"class":194,"line":2735},[8115],{"type":68,"tag":192,"props":8116,"children":8117},{"emptyLinePlaceholder":338},[8118],{"type":79,"value":341},{"type":68,"tag":192,"props":8120,"children":8121},{"class":194,"line":2744},[8122],{"type":68,"tag":192,"props":8123,"children":8124},{"style":488},[8125],{"type":79,"value":8126},"\u002F\u002F Options:\n",{"type":68,"tag":192,"props":8128,"children":8129},{"class":194,"line":3321},[8130],{"type":68,"tag":192,"props":8131,"children":8132},{"style":488},[8133],{"type":79,"value":8134},"\u002F\u002F clients   — MCPClient | MCPClients | Array\u003CMCPClient | MCPClients> (required).\n",{"type":68,"tag":192,"props":8136,"children":8137},{"class":194,"line":3339},[8138],{"type":68,"tag":192,"props":8139,"children":8140},{"style":488},[8141],{"type":79,"value":8142},"\u002F\u002F             The handler reads transport descriptors via client.getInfo() \u002F\n",{"type":68,"tag":192,"props":8144,"children":8145},{"class":194,"line":3347},[8146],{"type":68,"tag":192,"props":8147,"children":8148},{"style":488},[8149],{"type":79,"value":8150},"\u002F\u002F             pool.getServers() — the client does not need a live connection.\n",{"type":68,"tag":192,"props":8152,"children":8153},{"class":194,"line":3356},[8154],{"type":68,"tag":192,"props":8155,"children":8156},{"style":488},[8157],{"type":79,"value":8158},"\u002F\u002F store     — optional dynamic\u002Fstateful session store (e.g.\n",{"type":68,"tag":192,"props":8160,"children":8161},{"class":194,"line":3388},[8162],{"type":68,"tag":192,"props":8163,"children":8164},{"style":488},[8165],{"type":79,"value":8166},"\u002F\u002F             inMemoryMcpSessionStore()); used alongside clients.\n",{"type":68,"tag":192,"props":8168,"children":8169},{"class":194,"line":3452},[8170],{"type":68,"tag":192,"props":8171,"children":8172},{"style":488},[8173],{"type":79,"value":8174},"\u002F\u002F allowTool — optional authorizer receiving the WHOLE request:\n",{"type":68,"tag":192,"props":8176,"children":8177},{"class":194,"line":3464},[8178],{"type":68,"tag":192,"props":8179,"children":8180},{"style":488},[8181],{"type":79,"value":8182},"\u002F\u002F             (req: McpAppCallRequest) => boolean | Promise\u003Cboolean>.\n",{"type":68,"tag":192,"props":8184,"children":8185},{"class":194,"line":3477},[8186],{"type":68,"tag":192,"props":8187,"children":8188},{"style":488},[8189],{"type":79,"value":8190},"\u002F\u002F             The server-exposure check is ALWAYS enforced (the handler\n",{"type":68,"tag":192,"props":8192,"children":8193},{"class":194,"line":3507},[8194],{"type":68,"tag":192,"props":8195,"children":8196},{"style":488},[8197],{"type":79,"value":8198},"\u002F\u002F             rejects any tool the server does not expose). `allowTool`\n",{"type":68,"tag":192,"props":8200,"children":8201},{"class":194,"line":3548},[8202],{"type":68,"tag":192,"props":8203,"children":8204},{"style":488},[8205],{"type":79,"value":8206},"\u002F\u002F             is an ADDITIONAL restriction AND-ed on top: a request must\n",{"type":68,"tag":192,"props":8208,"children":8209},{"class":194,"line":3561},[8210],{"type":68,"tag":192,"props":8211,"children":8212},{"style":488},[8213],{"type":79,"value":8214},"\u002F\u002F             satisfy BOTH the server-exposure check and allowTool.\n",{"type":68,"tag":192,"props":8216,"children":8217},{"class":194,"line":3598},[8218,8222,8227,8231,8235,8239],{"type":68,"tag":192,"props":8219,"children":8220},{"style":348},[8221],{"type":79,"value":351},{"type":68,"tag":192,"props":8223,"children":8224},{"style":304},[8225],{"type":79,"value":8226}," handlerWithStore ",{"type":68,"tag":192,"props":8228,"children":8229},{"style":298},[8230],{"type":79,"value":361},{"type":68,"tag":192,"props":8232,"children":8233},{"style":369},[8234],{"type":79,"value":8083},{"type":68,"tag":192,"props":8236,"children":8237},{"style":304},[8238],{"type":79,"value":376},{"type":68,"tag":192,"props":8240,"children":8241},{"style":298},[8242],{"type":79,"value":381},{"type":68,"tag":192,"props":8244,"children":8245},{"class":194,"line":3610},[8246,8251,8255,8260],{"type":68,"tag":192,"props":8247,"children":8248},{"style":388},[8249],{"type":79,"value":8250},"  clients",{"type":68,"tag":192,"props":8252,"children":8253},{"style":298},[8254],{"type":79,"value":396},{"type":68,"tag":192,"props":8256,"children":8257},{"style":304},[8258],{"type":79,"value":8259}," mcp",{"type":68,"tag":192,"props":8261,"children":8262},{"style":298},[8263],{"type":79,"value":663},{"type":68,"tag":192,"props":8265,"children":8266},{"class":194,"line":3655},[8267,8272,8276,8281,8285],{"type":68,"tag":192,"props":8268,"children":8269},{"style":388},[8270],{"type":79,"value":8271},"  store",{"type":68,"tag":192,"props":8273,"children":8274},{"style":298},[8275],{"type":79,"value":396},{"type":68,"tag":192,"props":8277,"children":8278},{"style":369},[8279],{"type":79,"value":8280}," inMemoryMcpSessionStore",{"type":68,"tag":192,"props":8282,"children":8283},{"style":304},[8284],{"type":79,"value":2558},{"type":68,"tag":192,"props":8286,"children":8287},{"style":298},[8288],{"type":79,"value":663},{"type":68,"tag":192,"props":8290,"children":8291},{"class":194,"line":3664},[8292,8297,8301,8305,8310,8314,8318,8323,8327,8332,8337,8341,8346,8350],{"type":68,"tag":192,"props":8293,"children":8294},{"style":369},[8295],{"type":79,"value":8296},"  allowTool",{"type":68,"tag":192,"props":8298,"children":8299},{"style":298},[8300],{"type":79,"value":396},{"type":68,"tag":192,"props":8302,"children":8303},{"style":298},[8304],{"type":79,"value":3625},{"type":68,"tag":192,"props":8306,"children":8307},{"style":4434},[8308],{"type":79,"value":8309},"req",{"type":68,"tag":192,"props":8311,"children":8312},{"style":298},[8313],{"type":79,"value":1239},{"type":68,"tag":192,"props":8315,"children":8316},{"style":348},[8317],{"type":79,"value":3186},{"type":68,"tag":192,"props":8319,"children":8320},{"style":304},[8321],{"type":79,"value":8322}," req",{"type":68,"tag":192,"props":8324,"children":8325},{"style":298},[8326],{"type":79,"value":230},{"type":68,"tag":192,"props":8328,"children":8329},{"style":304},[8330],{"type":79,"value":8331},"toolName ",{"type":68,"tag":192,"props":8333,"children":8334},{"style":298},[8335],{"type":79,"value":8336},"===",{"type":68,"tag":192,"props":8338,"children":8339},{"style":298},[8340],{"type":79,"value":322},{"type":68,"tag":192,"props":8342,"children":8343},{"style":205},[8344],{"type":79,"value":8345},"place_order",{"type":68,"tag":192,"props":8347,"children":8348},{"style":298},[8349],{"type":79,"value":423},{"type":68,"tag":192,"props":8351,"children":8352},{"style":298},[8353],{"type":79,"value":663},{"type":68,"tag":192,"props":8355,"children":8356},{"class":194,"line":3673},[8357,8361],{"type":68,"tag":192,"props":8358,"children":8359},{"style":298},[8360],{"type":79,"value":535},{"type":68,"tag":192,"props":8362,"children":8363},{"style":304},[8364],{"type":79,"value":540},{"type":68,"tag":82,"props":8366,"children":8367},{},[8368,8370,8376],{"type":79,"value":8369},"The handler invokes the server (",{"type":68,"tag":74,"props":8371,"children":8373},{"className":8372},[],[8374],{"type":79,"value":8375},"body: { threadId, serverId?, toolName, args?, messageId? }",{"type":79,"value":8377},"):",{"type":68,"tag":181,"props":8379,"children":8381},{"className":281,"code":8380,"language":45,"meta":186,"style":186},"const result = await handler(body)\n\u002F\u002F { ok: true; result: unknown } | { ok: false; error: string }\n",[8382],{"type":68,"tag":74,"props":8383,"children":8384},{"__ignoreMap":186},[8385,8415],{"type":68,"tag":192,"props":8386,"children":8387},{"class":194,"line":195},[8388,8392,8397,8401,8405,8410],{"type":68,"tag":192,"props":8389,"children":8390},{"style":348},[8391],{"type":79,"value":351},{"type":68,"tag":192,"props":8393,"children":8394},{"style":304},[8395],{"type":79,"value":8396}," result ",{"type":68,"tag":192,"props":8398,"children":8399},{"style":298},[8400],{"type":79,"value":361},{"type":68,"tag":192,"props":8402,"children":8403},{"style":292},[8404],{"type":79,"value":366},{"type":68,"tag":192,"props":8406,"children":8407},{"style":369},[8408],{"type":79,"value":8409}," handler",{"type":68,"tag":192,"props":8411,"children":8412},{"style":304},[8413],{"type":79,"value":8414},"(body)\n",{"type":68,"tag":192,"props":8416,"children":8417},{"class":194,"line":334},[8418],{"type":68,"tag":192,"props":8419,"children":8420},{"style":488},[8421],{"type":79,"value":8422},"\u002F\u002F { ok: true; result: unknown } | { ok: false; error: string }\n",{"type":68,"tag":568,"props":8424,"children":8426},{"id":8425},"client-side-usemcpappbridge-mcpappresource",[8427,8429,8435,8437],{"type":79,"value":8428},"Client side — ",{"type":68,"tag":74,"props":8430,"children":8432},{"className":8431},[],[8433],{"type":79,"value":8434},"useMcpAppBridge",{"type":79,"value":8436}," + ",{"type":68,"tag":74,"props":8438,"children":8440},{"className":8439},[],[8441],{"type":79,"value":8442},"MCPAppResource",{"type":68,"tag":82,"props":8444,"children":8445},{},[8446,8448,8453,8455,8461,8462,8468,8470,8475,8477,8483,8484,8490,8492,8498,8499,8505,8507,8513,8514,8520,8522,8528,8530,8536,8538,8543,8544,8550,8552,8558,8560,8566,8568,8573,8575,8581,8583,8589],{"type":79,"value":8447},"In React\u002FPreact, create the bridge with the ",{"type":68,"tag":74,"props":8449,"children":8451},{"className":8450},[],[8452],{"type":79,"value":8434},{"type":79,"value":8454}," hook (from\n",{"type":68,"tag":74,"props":8456,"children":8458},{"className":8457},[],[8459],{"type":79,"value":8460},"@tanstack\u002Fai-react",{"type":79,"value":7502},{"type":68,"tag":74,"props":8463,"children":8465},{"className":8464},[],[8466],{"type":79,"value":8467},"@tanstack\u002Fai-preact",{"type":79,"value":8469},") — it returns a ",{"type":68,"tag":1476,"props":8471,"children":8472},{},[8473],{"type":79,"value":8474},"stable",{"type":79,"value":8476}," bridge\nper ",{"type":68,"tag":74,"props":8478,"children":8480},{"className":8479},[],[8481],{"type":79,"value":8482},"threadId",{"type":79,"value":1497},{"type":68,"tag":74,"props":8485,"children":8487},{"className":8486},[],[8488],{"type":79,"value":8489},"callEndpoint",{"type":79,"value":8491}," and always calls your latest ",{"type":68,"tag":74,"props":8493,"children":8495},{"className":8494},[],[8496],{"type":79,"value":8497},"sendMessage",{"type":79,"value":1497},{"type":68,"tag":74,"props":8500,"children":8502},{"className":8501},[],[8503],{"type":79,"value":8504},"onLink",{"type":79,"value":8506},",\nso the bridge isn't recreated on every render (no ",{"type":68,"tag":74,"props":8508,"children":8510},{"className":8509},[],[8511],{"type":79,"value":8512},"useMemo",{"type":79,"value":7502},{"type":68,"tag":74,"props":8515,"children":8517},{"className":8516},[],[8518],{"type":79,"value":8519},"exhaustive-deps",{"type":79,"value":8521},"\nby hand). It's a thin wrapper over the framework-agnostic ",{"type":68,"tag":74,"props":8523,"children":8525},{"className":8524},[],[8526],{"type":79,"value":8527},"createMcpAppBridge",{"type":79,"value":8529},"\nfrom ",{"type":68,"tag":74,"props":8531,"children":8533},{"className":8532},[],[8534],{"type":79,"value":8535},"@tanstack\u002Fai-client",{"type":79,"value":8537}," (use that directly outside React\u002FPreact). Render\nresources with ",{"type":68,"tag":74,"props":8539,"children":8541},{"className":8540},[],[8542],{"type":79,"value":8442},{"type":79,"value":7707},{"type":68,"tag":74,"props":8545,"children":8547},{"className":8546},[],[8548],{"type":79,"value":8549},"@tanstack\u002Fai-react\u002Fmcp-apps",{"type":79,"value":8551}," (also\n",{"type":68,"tag":74,"props":8553,"children":8555},{"className":8554},[],[8556],{"type":79,"value":8557},"@tanstack\u002Fai-preact\u002Fmcp-apps",{"type":79,"value":8559},", which requires a ",{"type":68,"tag":74,"props":8561,"children":8563},{"className":8562},[],[8564],{"type":79,"value":8565},"preact\u002Fcompat",{"type":79,"value":8567}," alias).\n",{"type":68,"tag":74,"props":8569,"children":8571},{"className":8570},[],[8572],{"type":79,"value":8442},{"type":79,"value":8574}," uses ",{"type":68,"tag":74,"props":8576,"children":8578},{"className":8577},[],[8579],{"type":79,"value":8580},"@mcp-ui\u002Fclient",{"type":79,"value":8582},"'s ",{"type":68,"tag":74,"props":8584,"children":8586},{"className":8585},[],[8587],{"type":79,"value":8588},"AppRenderer",{"type":79,"value":8590}," under the hood — React\nonly. Solid, Vue, Svelte, and Angular renderers are deferred.",{"type":68,"tag":82,"props":8592,"children":8593},{},[8594,8596,8602,8604,8610,8612,8617,8619,8625,8627,8633,8634,8640,8642,8648,8650,8656,8658,8664,8666,8672,8674,8680,8682,8688],{"type":79,"value":8595},"The bridge exposes ",{"type":68,"tag":74,"props":8597,"children":8599},{"className":8598},[],[8600],{"type":79,"value":8601},"{ callTool, sendPrompt, openLink }",{"type":79,"value":8603}," and routes the\niframe's actions: ",{"type":68,"tag":74,"props":8605,"children":8607},{"className":8606},[],[8608],{"type":79,"value":8609},"tool",{"type":79,"value":8611}," → POST to ",{"type":68,"tag":74,"props":8613,"children":8615},{"className":8614},[],[8616],{"type":79,"value":8489},{"type":79,"value":8618},"; ",{"type":68,"tag":74,"props":8620,"children":8622},{"className":8621},[],[8623],{"type":79,"value":8624},"prompt",{"type":79,"value":8626}," →\n",{"type":68,"tag":74,"props":8628,"children":8630},{"className":8629},[],[8631],{"type":79,"value":8632},"chat.sendMessage",{"type":79,"value":8618},{"type":68,"tag":74,"props":8635,"children":8637},{"className":8636},[],[8638],{"type":79,"value":8639},"link",{"type":79,"value":8641}," → ",{"type":68,"tag":74,"props":8643,"children":8645},{"className":8644},[],[8646],{"type":79,"value":8647},"onLink(url)",{"type":79,"value":8649}," if provided, otherwise the link\nis dropped (with a console warning) and ",{"type":68,"tag":74,"props":8651,"children":8653},{"className":8652},[],[8654],{"type":79,"value":8655},"openLink",{"type":79,"value":8657}," returns ",{"type":68,"tag":74,"props":8659,"children":8661},{"className":8660},[],[8662],{"type":79,"value":8663},"{ isError: true }",{"type":79,"value":8665},"\n— it does NOT hang. ",{"type":68,"tag":74,"props":8667,"children":8669},{"className":8668},[],[8670],{"type":79,"value":8671},"toolName",{"type":79,"value":8673}," is read from ",{"type":68,"tag":74,"props":8675,"children":8677},{"className":8676},[],[8678],{"type":79,"value":8679},"part.toolName",{"type":79,"value":8681},"; it is not a\nprop. Omit ",{"type":68,"tag":74,"props":8683,"children":8685},{"className":8684},[],[8686],{"type":79,"value":8687},"bridge",{"type":79,"value":8689}," for display-only (inert) rendering.",{"type":68,"tag":181,"props":8691,"children":8695},{"className":8692,"code":8693,"language":8694,"meta":186,"style":186},"language-tsx shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { useChat, useMcpAppBridge } from '@tanstack\u002Fai-react'\nimport { fetchServerSentEvents } from '@tanstack\u002Fai-client'\nimport { MCPAppResource } from '@tanstack\u002Fai-react\u002Fmcp-apps'\n\nfunction ChatPage() {\n  const threadId = 'weather-chat'\n  const { messages, sendMessage } = useChat({\n    connection: fetchServerSentEvents('\u002Fapi\u002Fchat'),\n  })\n\n  const bridge = useMcpAppBridge({\n    threadId,\n    callEndpoint: '\u002Fapi\u002Fmcp-app\u002Fcall',\n    chat: { sendMessage: async (content) => void sendMessage({ content }) },\n    \u002F\u002F Opt in to link navigation — absent means links are dropped.\n    onLink: (url) => window.open(url, '_blank', 'noopener'),\n  })\n\n  return (\n    \u003Cdiv>\n      {messages.map((msg) =>\n        msg.parts.map((part, i) => {\n          if (part.type === 'text') return \u003Cp key={i}>{part.content}\u003C\u002Fp>\n          if (part.type === 'ui-resource') {\n            return (\n              \u003CMCPAppResource\n                key={i}\n                part={part}\n                bridge={bridge}\n                sandbox={{ url: new URL('https:\u002F\u002Fsandbox.example.com') }}\n                \u002F\u002F toolInput is optional; toolName comes from part.toolName.\n              \u002F>\n            )\n          }\n          return null\n        }),\n      )}\n    \u003C\u002Fdiv>\n  )\n}\n","tsx",[8696],{"type":68,"tag":74,"props":8697,"children":8698},{"__ignoreMap":186},[8699,8744,8780,8816,8823,8844,8873,8917,8957,8968,8975,9003,9015,9044,9123,9131,9224,9235,9242,9254,9272,9314,9372,9476,9524,9536,9549,9569,9589,9609,9666,9674,9682,9690,9698,9711,9726,9738,9754,9762],{"type":68,"tag":192,"props":8700,"children":8701},{"class":194,"line":195},[8702,8706,8710,8715,8719,8724,8728,8732,8736,8740],{"type":68,"tag":192,"props":8703,"children":8704},{"style":292},[8705],{"type":79,"value":295},{"type":68,"tag":192,"props":8707,"children":8708},{"style":298},[8709],{"type":79,"value":301},{"type":68,"tag":192,"props":8711,"children":8712},{"style":304},[8713],{"type":79,"value":8714}," useChat",{"type":68,"tag":192,"props":8716,"children":8717},{"style":298},[8718],{"type":79,"value":428},{"type":68,"tag":192,"props":8720,"children":8721},{"style":304},[8722],{"type":79,"value":8723}," useMcpAppBridge",{"type":68,"tag":192,"props":8725,"children":8726},{"style":298},[8727],{"type":79,"value":312},{"type":68,"tag":192,"props":8729,"children":8730},{"style":292},[8731],{"type":79,"value":317},{"type":68,"tag":192,"props":8733,"children":8734},{"style":298},[8735],{"type":79,"value":322},{"type":68,"tag":192,"props":8737,"children":8738},{"style":205},[8739],{"type":79,"value":8460},{"type":68,"tag":192,"props":8741,"children":8742},{"style":298},[8743],{"type":79,"value":331},{"type":68,"tag":192,"props":8745,"children":8746},{"class":194,"line":334},[8747,8751,8755,8760,8764,8768,8772,8776],{"type":68,"tag":192,"props":8748,"children":8749},{"style":292},[8750],{"type":79,"value":295},{"type":68,"tag":192,"props":8752,"children":8753},{"style":298},[8754],{"type":79,"value":301},{"type":68,"tag":192,"props":8756,"children":8757},{"style":304},[8758],{"type":79,"value":8759}," fetchServerSentEvents",{"type":68,"tag":192,"props":8761,"children":8762},{"style":298},[8763],{"type":79,"value":312},{"type":68,"tag":192,"props":8765,"children":8766},{"style":292},[8767],{"type":79,"value":317},{"type":68,"tag":192,"props":8769,"children":8770},{"style":298},[8771],{"type":79,"value":322},{"type":68,"tag":192,"props":8773,"children":8774},{"style":205},[8775],{"type":79,"value":8535},{"type":68,"tag":192,"props":8777,"children":8778},{"style":298},[8779],{"type":79,"value":331},{"type":68,"tag":192,"props":8781,"children":8782},{"class":194,"line":344},[8783,8787,8791,8796,8800,8804,8808,8812],{"type":68,"tag":192,"props":8784,"children":8785},{"style":292},[8786],{"type":79,"value":295},{"type":68,"tag":192,"props":8788,"children":8789},{"style":298},[8790],{"type":79,"value":301},{"type":68,"tag":192,"props":8792,"children":8793},{"style":304},[8794],{"type":79,"value":8795}," MCPAppResource",{"type":68,"tag":192,"props":8797,"children":8798},{"style":298},[8799],{"type":79,"value":312},{"type":68,"tag":192,"props":8801,"children":8802},{"style":292},[8803],{"type":79,"value":317},{"type":68,"tag":192,"props":8805,"children":8806},{"style":298},[8807],{"type":79,"value":322},{"type":68,"tag":192,"props":8809,"children":8810},{"style":205},[8811],{"type":79,"value":8549},{"type":68,"tag":192,"props":8813,"children":8814},{"style":298},[8815],{"type":79,"value":331},{"type":68,"tag":192,"props":8817,"children":8818},{"class":194,"line":384},[8819],{"type":68,"tag":192,"props":8820,"children":8821},{"emptyLinePlaceholder":338},[8822],{"type":79,"value":341},{"type":68,"tag":192,"props":8824,"children":8825},{"class":194,"line":458},[8826,8831,8836,8840],{"type":68,"tag":192,"props":8827,"children":8828},{"style":348},[8829],{"type":79,"value":8830},"function",{"type":68,"tag":192,"props":8832,"children":8833},{"style":369},[8834],{"type":79,"value":8835}," ChatPage",{"type":68,"tag":192,"props":8837,"children":8838},{"style":298},[8839],{"type":79,"value":2558},{"type":68,"tag":192,"props":8841,"children":8842},{"style":298},[8843],{"type":79,"value":634},{"type":68,"tag":192,"props":8845,"children":8846},{"class":194,"line":494},[8847,8851,8856,8860,8864,8869],{"type":68,"tag":192,"props":8848,"children":8849},{"style":348},[8850],{"type":79,"value":3483},{"type":68,"tag":192,"props":8852,"children":8853},{"style":304},[8854],{"type":79,"value":8855}," threadId",{"type":68,"tag":192,"props":8857,"children":8858},{"style":298},[8859],{"type":79,"value":1385},{"type":68,"tag":192,"props":8861,"children":8862},{"style":298},[8863],{"type":79,"value":322},{"type":68,"tag":192,"props":8865,"children":8866},{"style":205},[8867],{"type":79,"value":8868},"weather-chat",{"type":68,"tag":192,"props":8870,"children":8871},{"style":298},[8872],{"type":79,"value":331},{"type":68,"tag":192,"props":8874,"children":8875},{"class":194,"line":529},[8876,8880,8884,8888,8892,8897,8901,8905,8909,8913],{"type":68,"tag":192,"props":8877,"children":8878},{"style":348},[8879],{"type":79,"value":3483},{"type":68,"tag":192,"props":8881,"children":8882},{"style":298},[8883],{"type":79,"value":301},{"type":68,"tag":192,"props":8885,"children":8886},{"style":304},[8887],{"type":79,"value":4467},{"type":68,"tag":192,"props":8889,"children":8890},{"style":298},[8891],{"type":79,"value":428},{"type":68,"tag":192,"props":8893,"children":8894},{"style":304},[8895],{"type":79,"value":8896}," sendMessage",{"type":68,"tag":192,"props":8898,"children":8899},{"style":298},[8900],{"type":79,"value":312},{"type":68,"tag":192,"props":8902,"children":8903},{"style":298},[8904],{"type":79,"value":1385},{"type":68,"tag":192,"props":8906,"children":8907},{"style":369},[8908],{"type":79,"value":8714},{"type":68,"tag":192,"props":8910,"children":8911},{"style":388},[8912],{"type":79,"value":376},{"type":68,"tag":192,"props":8914,"children":8915},{"style":298},[8916],{"type":79,"value":381},{"type":68,"tag":192,"props":8918,"children":8919},{"class":194,"line":1165},[8920,8925,8929,8933,8937,8941,8945,8949,8953],{"type":68,"tag":192,"props":8921,"children":8922},{"style":388},[8923],{"type":79,"value":8924},"    connection",{"type":68,"tag":192,"props":8926,"children":8927},{"style":298},[8928],{"type":79,"value":396},{"type":68,"tag":192,"props":8930,"children":8931},{"style":369},[8932],{"type":79,"value":8759},{"type":68,"tag":192,"props":8934,"children":8935},{"style":388},[8936],{"type":79,"value":376},{"type":68,"tag":192,"props":8938,"children":8939},{"style":298},[8940],{"type":79,"value":423},{"type":68,"tag":192,"props":8942,"children":8943},{"style":205},[8944],{"type":79,"value":4364},{"type":68,"tag":192,"props":8946,"children":8947},{"style":298},[8948],{"type":79,"value":423},{"type":68,"tag":192,"props":8950,"children":8951},{"style":388},[8952],{"type":79,"value":1239},{"type":68,"tag":192,"props":8954,"children":8955},{"style":298},[8956],{"type":79,"value":663},{"type":68,"tag":192,"props":8958,"children":8959},{"class":194,"line":1228},[8960,8964],{"type":68,"tag":192,"props":8961,"children":8962},{"style":298},[8963],{"type":79,"value":1234},{"type":68,"tag":192,"props":8965,"children":8966},{"style":388},[8967],{"type":79,"value":540},{"type":68,"tag":192,"props":8969,"children":8970},{"class":194,"line":1246},[8971],{"type":68,"tag":192,"props":8972,"children":8973},{"emptyLinePlaceholder":338},[8974],{"type":79,"value":341},{"type":68,"tag":192,"props":8976,"children":8977},{"class":194,"line":1807},[8978,8982,8987,8991,8995,8999],{"type":68,"tag":192,"props":8979,"children":8980},{"style":348},[8981],{"type":79,"value":3483},{"type":68,"tag":192,"props":8983,"children":8984},{"style":304},[8985],{"type":79,"value":8986}," bridge",{"type":68,"tag":192,"props":8988,"children":8989},{"style":298},[8990],{"type":79,"value":1385},{"type":68,"tag":192,"props":8992,"children":8993},{"style":369},[8994],{"type":79,"value":8723},{"type":68,"tag":192,"props":8996,"children":8997},{"style":388},[8998],{"type":79,"value":376},{"type":68,"tag":192,"props":9000,"children":9001},{"style":298},[9002],{"type":79,"value":381},{"type":68,"tag":192,"props":9004,"children":9005},{"class":194,"line":1815},[9006,9011],{"type":68,"tag":192,"props":9007,"children":9008},{"style":304},[9009],{"type":79,"value":9010},"    threadId",{"type":68,"tag":192,"props":9012,"children":9013},{"style":298},[9014],{"type":79,"value":663},{"type":68,"tag":192,"props":9016,"children":9017},{"class":194,"line":2651},[9018,9023,9027,9031,9036,9040],{"type":68,"tag":192,"props":9019,"children":9020},{"style":388},[9021],{"type":79,"value":9022},"    callEndpoint",{"type":68,"tag":192,"props":9024,"children":9025},{"style":298},[9026],{"type":79,"value":396},{"type":68,"tag":192,"props":9028,"children":9029},{"style":298},[9030],{"type":79,"value":322},{"type":68,"tag":192,"props":9032,"children":9033},{"style":205},[9034],{"type":79,"value":9035},"\u002Fapi\u002Fmcp-app\u002Fcall",{"type":68,"tag":192,"props":9037,"children":9038},{"style":298},[9039],{"type":79,"value":423},{"type":68,"tag":192,"props":9041,"children":9042},{"style":298},[9043],{"type":79,"value":663},{"type":68,"tag":192,"props":9045,"children":9046},{"class":194,"line":2715},[9047,9052,9056,9060,9064,9068,9072,9076,9081,9085,9089,9094,9098,9102,9106,9110,9114,9118],{"type":68,"tag":192,"props":9048,"children":9049},{"style":388},[9050],{"type":79,"value":9051},"    chat",{"type":68,"tag":192,"props":9053,"children":9054},{"style":298},[9055],{"type":79,"value":396},{"type":68,"tag":192,"props":9057,"children":9058},{"style":298},[9059],{"type":79,"value":301},{"type":68,"tag":192,"props":9061,"children":9062},{"style":369},[9063],{"type":79,"value":8896},{"type":68,"tag":192,"props":9065,"children":9066},{"style":298},[9067],{"type":79,"value":396},{"type":68,"tag":192,"props":9069,"children":9070},{"style":348},[9071],{"type":79,"value":4426},{"type":68,"tag":192,"props":9073,"children":9074},{"style":298},[9075],{"type":79,"value":3625},{"type":68,"tag":192,"props":9077,"children":9078},{"style":4434},[9079],{"type":79,"value":9080},"content",{"type":68,"tag":192,"props":9082,"children":9083},{"style":298},[9084],{"type":79,"value":1239},{"type":68,"tag":192,"props":9086,"children":9087},{"style":348},[9088],{"type":79,"value":3186},{"type":68,"tag":192,"props":9090,"children":9091},{"style":298},[9092],{"type":79,"value":9093}," void",{"type":68,"tag":192,"props":9095,"children":9096},{"style":369},[9097],{"type":79,"value":8896},{"type":68,"tag":192,"props":9099,"children":9100},{"style":388},[9101],{"type":79,"value":376},{"type":68,"tag":192,"props":9103,"children":9104},{"style":298},[9105],{"type":79,"value":1435},{"type":68,"tag":192,"props":9107,"children":9108},{"style":304},[9109],{"type":79,"value":6993},{"type":68,"tag":192,"props":9111,"children":9112},{"style":298},[9113],{"type":79,"value":312},{"type":68,"tag":192,"props":9115,"children":9116},{"style":388},[9117],{"type":79,"value":3648},{"type":68,"tag":192,"props":9119,"children":9120},{"style":298},[9121],{"type":79,"value":9122},"},\n",{"type":68,"tag":192,"props":9124,"children":9125},{"class":194,"line":2727},[9126],{"type":68,"tag":192,"props":9127,"children":9128},{"style":488},[9129],{"type":79,"value":9130},"    \u002F\u002F Opt in to link navigation — absent means links are dropped.\n",{"type":68,"tag":192,"props":9132,"children":9133},{"class":194,"line":2735},[9134,9139,9143,9147,9152,9156,9160,9165,9169,9174,9178,9182,9186,9190,9195,9199,9203,9207,9212,9216,9220],{"type":68,"tag":192,"props":9135,"children":9136},{"style":369},[9137],{"type":79,"value":9138},"    onLink",{"type":68,"tag":192,"props":9140,"children":9141},{"style":298},[9142],{"type":79,"value":396},{"type":68,"tag":192,"props":9144,"children":9145},{"style":298},[9146],{"type":79,"value":3625},{"type":68,"tag":192,"props":9148,"children":9149},{"style":4434},[9150],{"type":79,"value":9151},"url",{"type":68,"tag":192,"props":9153,"children":9154},{"style":298},[9155],{"type":79,"value":1239},{"type":68,"tag":192,"props":9157,"children":9158},{"style":348},[9159],{"type":79,"value":3186},{"type":68,"tag":192,"props":9161,"children":9162},{"style":304},[9163],{"type":79,"value":9164}," window",{"type":68,"tag":192,"props":9166,"children":9167},{"style":298},[9168],{"type":79,"value":230},{"type":68,"tag":192,"props":9170,"children":9171},{"style":369},[9172],{"type":79,"value":9173},"open",{"type":68,"tag":192,"props":9175,"children":9176},{"style":388},[9177],{"type":79,"value":376},{"type":68,"tag":192,"props":9179,"children":9180},{"style":304},[9181],{"type":79,"value":9151},{"type":68,"tag":192,"props":9183,"children":9184},{"style":298},[9185],{"type":79,"value":428},{"type":68,"tag":192,"props":9187,"children":9188},{"style":298},[9189],{"type":79,"value":322},{"type":68,"tag":192,"props":9191,"children":9192},{"style":205},[9193],{"type":79,"value":9194},"_blank",{"type":68,"tag":192,"props":9196,"children":9197},{"style":298},[9198],{"type":79,"value":423},{"type":68,"tag":192,"props":9200,"children":9201},{"style":298},[9202],{"type":79,"value":428},{"type":68,"tag":192,"props":9204,"children":9205},{"style":298},[9206],{"type":79,"value":322},{"type":68,"tag":192,"props":9208,"children":9209},{"style":205},[9210],{"type":79,"value":9211},"noopener",{"type":68,"tag":192,"props":9213,"children":9214},{"style":298},[9215],{"type":79,"value":423},{"type":68,"tag":192,"props":9217,"children":9218},{"style":388},[9219],{"type":79,"value":1239},{"type":68,"tag":192,"props":9221,"children":9222},{"style":298},[9223],{"type":79,"value":663},{"type":68,"tag":192,"props":9225,"children":9226},{"class":194,"line":2744},[9227,9231],{"type":68,"tag":192,"props":9228,"children":9229},{"style":298},[9230],{"type":79,"value":1234},{"type":68,"tag":192,"props":9232,"children":9233},{"style":388},[9234],{"type":79,"value":540},{"type":68,"tag":192,"props":9236,"children":9237},{"class":194,"line":3321},[9238],{"type":68,"tag":192,"props":9239,"children":9240},{"emptyLinePlaceholder":338},[9241],{"type":79,"value":341},{"type":68,"tag":192,"props":9243,"children":9244},{"class":194,"line":3339},[9245,9249],{"type":68,"tag":192,"props":9246,"children":9247},{"style":292},[9248],{"type":79,"value":6236},{"type":68,"tag":192,"props":9250,"children":9251},{"style":388},[9252],{"type":79,"value":9253}," (\n",{"type":68,"tag":192,"props":9255,"children":9256},{"class":194,"line":3347},[9257,9262,9267],{"type":68,"tag":192,"props":9258,"children":9259},{"style":298},[9260],{"type":79,"value":9261},"    \u003C",{"type":68,"tag":192,"props":9263,"children":9264},{"style":388},[9265],{"type":79,"value":9266},"div",{"type":68,"tag":192,"props":9268,"children":9269},{"style":298},[9270],{"type":79,"value":9271},">\n",{"type":68,"tag":192,"props":9273,"children":9274},{"class":194,"line":3356},[9275,9280,9284,9288,9292,9296,9300,9305,9309],{"type":68,"tag":192,"props":9276,"children":9277},{"style":298},[9278],{"type":79,"value":9279},"      {",{"type":68,"tag":192,"props":9281,"children":9282},{"style":304},[9283],{"type":79,"value":7403},{"type":68,"tag":192,"props":9285,"children":9286},{"style":298},[9287],{"type":79,"value":230},{"type":68,"tag":192,"props":9289,"children":9290},{"style":369},[9291],{"type":79,"value":6794},{"type":68,"tag":192,"props":9293,"children":9294},{"style":304},[9295],{"type":79,"value":376},{"type":68,"tag":192,"props":9297,"children":9298},{"style":298},[9299],{"type":79,"value":376},{"type":68,"tag":192,"props":9301,"children":9302},{"style":4434},[9303],{"type":79,"value":9304},"msg",{"type":68,"tag":192,"props":9306,"children":9307},{"style":298},[9308],{"type":79,"value":1239},{"type":68,"tag":192,"props":9310,"children":9311},{"style":348},[9312],{"type":79,"value":9313}," =>\n",{"type":68,"tag":192,"props":9315,"children":9316},{"class":194,"line":3388},[9317,9322,9326,9330,9334,9338,9342,9346,9351,9355,9360,9364,9368],{"type":68,"tag":192,"props":9318,"children":9319},{"style":304},[9320],{"type":79,"value":9321},"        msg",{"type":68,"tag":192,"props":9323,"children":9324},{"style":298},[9325],{"type":79,"value":230},{"type":68,"tag":192,"props":9327,"children":9328},{"style":304},[9329],{"type":79,"value":6952},{"type":68,"tag":192,"props":9331,"children":9332},{"style":298},[9333],{"type":79,"value":230},{"type":68,"tag":192,"props":9335,"children":9336},{"style":369},[9337],{"type":79,"value":6794},{"type":68,"tag":192,"props":9339,"children":9340},{"style":304},[9341],{"type":79,"value":376},{"type":68,"tag":192,"props":9343,"children":9344},{"style":298},[9345],{"type":79,"value":376},{"type":68,"tag":192,"props":9347,"children":9348},{"style":4434},[9349],{"type":79,"value":9350},"part",{"type":68,"tag":192,"props":9352,"children":9353},{"style":298},[9354],{"type":79,"value":428},{"type":68,"tag":192,"props":9356,"children":9357},{"style":4434},[9358],{"type":79,"value":9359}," i",{"type":68,"tag":192,"props":9361,"children":9362},{"style":298},[9363],{"type":79,"value":1239},{"type":68,"tag":192,"props":9365,"children":9366},{"style":348},[9367],{"type":79,"value":3186},{"type":68,"tag":192,"props":9369,"children":9370},{"style":298},[9371],{"type":79,"value":634},{"type":68,"tag":192,"props":9373,"children":9374},{"class":194,"line":3452},[9375,9380,9384,9388,9392,9397,9402,9406,9410,9414,9418,9422,9427,9431,9436,9441,9446,9451,9455,9459,9463,9468,9472],{"type":68,"tag":192,"props":9376,"children":9377},{"style":292},[9378],{"type":79,"value":9379},"          if",{"type":68,"tag":192,"props":9381,"children":9382},{"style":388},[9383],{"type":79,"value":3625},{"type":68,"tag":192,"props":9385,"children":9386},{"style":304},[9387],{"type":79,"value":9350},{"type":68,"tag":192,"props":9389,"children":9390},{"style":298},[9391],{"type":79,"value":230},{"type":68,"tag":192,"props":9393,"children":9394},{"style":304},[9395],{"type":79,"value":9396},"type",{"type":68,"tag":192,"props":9398,"children":9399},{"style":298},[9400],{"type":79,"value":9401}," ===",{"type":68,"tag":192,"props":9403,"children":9404},{"style":298},[9405],{"type":79,"value":322},{"type":68,"tag":192,"props":9407,"children":9408},{"style":205},[9409],{"type":79,"value":79},{"type":68,"tag":192,"props":9411,"children":9412},{"style":298},[9413],{"type":79,"value":423},{"type":68,"tag":192,"props":9415,"children":9416},{"style":388},[9417],{"type":79,"value":3648},{"type":68,"tag":192,"props":9419,"children":9420},{"style":292},[9421],{"type":79,"value":2867},{"type":68,"tag":192,"props":9423,"children":9424},{"style":298},[9425],{"type":79,"value":9426}," \u003C",{"type":68,"tag":192,"props":9428,"children":9429},{"style":388},[9430],{"type":79,"value":82},{"type":68,"tag":192,"props":9432,"children":9433},{"style":348},[9434],{"type":79,"value":9435}," key",{"type":68,"tag":192,"props":9437,"children":9438},{"style":298},[9439],{"type":79,"value":9440},"={",{"type":68,"tag":192,"props":9442,"children":9443},{"style":304},[9444],{"type":79,"value":9445},"i",{"type":68,"tag":192,"props":9447,"children":9448},{"style":298},[9449],{"type":79,"value":9450},"}>{",{"type":68,"tag":192,"props":9452,"children":9453},{"style":304},[9454],{"type":79,"value":9350},{"type":68,"tag":192,"props":9456,"children":9457},{"style":298},[9458],{"type":79,"value":230},{"type":68,"tag":192,"props":9460,"children":9461},{"style":304},[9462],{"type":79,"value":9080},{"type":68,"tag":192,"props":9464,"children":9465},{"style":298},[9466],{"type":79,"value":9467},"}\u003C\u002F",{"type":68,"tag":192,"props":9469,"children":9470},{"style":388},[9471],{"type":79,"value":82},{"type":68,"tag":192,"props":9473,"children":9474},{"style":298},[9475],{"type":79,"value":9271},{"type":68,"tag":192,"props":9477,"children":9478},{"class":194,"line":3464},[9479,9483,9487,9491,9495,9499,9503,9507,9512,9516,9520],{"type":68,"tag":192,"props":9480,"children":9481},{"style":292},[9482],{"type":79,"value":9379},{"type":68,"tag":192,"props":9484,"children":9485},{"style":388},[9486],{"type":79,"value":3625},{"type":68,"tag":192,"props":9488,"children":9489},{"style":304},[9490],{"type":79,"value":9350},{"type":68,"tag":192,"props":9492,"children":9493},{"style":298},[9494],{"type":79,"value":230},{"type":68,"tag":192,"props":9496,"children":9497},{"style":304},[9498],{"type":79,"value":9396},{"type":68,"tag":192,"props":9500,"children":9501},{"style":298},[9502],{"type":79,"value":9401},{"type":68,"tag":192,"props":9504,"children":9505},{"style":298},[9506],{"type":79,"value":322},{"type":68,"tag":192,"props":9508,"children":9509},{"style":205},[9510],{"type":79,"value":9511},"ui-resource",{"type":68,"tag":192,"props":9513,"children":9514},{"style":298},[9515],{"type":79,"value":423},{"type":68,"tag":192,"props":9517,"children":9518},{"style":388},[9519],{"type":79,"value":3648},{"type":68,"tag":192,"props":9521,"children":9522},{"style":298},[9523],{"type":79,"value":381},{"type":68,"tag":192,"props":9525,"children":9526},{"class":194,"line":3477},[9527,9532],{"type":68,"tag":192,"props":9528,"children":9529},{"style":292},[9530],{"type":79,"value":9531},"            return",{"type":68,"tag":192,"props":9533,"children":9534},{"style":388},[9535],{"type":79,"value":9253},{"type":68,"tag":192,"props":9537,"children":9538},{"class":194,"line":3507},[9539,9544],{"type":68,"tag":192,"props":9540,"children":9541},{"style":298},[9542],{"type":79,"value":9543},"              \u003C",{"type":68,"tag":192,"props":9545,"children":9546},{"style":199},[9547],{"type":79,"value":9548},"MCPAppResource\n",{"type":68,"tag":192,"props":9550,"children":9551},{"class":194,"line":3548},[9552,9557,9561,9565],{"type":68,"tag":192,"props":9553,"children":9554},{"style":348},[9555],{"type":79,"value":9556},"                key",{"type":68,"tag":192,"props":9558,"children":9559},{"style":298},[9560],{"type":79,"value":9440},{"type":68,"tag":192,"props":9562,"children":9563},{"style":304},[9564],{"type":79,"value":9445},{"type":68,"tag":192,"props":9566,"children":9567},{"style":298},[9568],{"type":79,"value":3721},{"type":68,"tag":192,"props":9570,"children":9571},{"class":194,"line":3561},[9572,9577,9581,9585],{"type":68,"tag":192,"props":9573,"children":9574},{"style":348},[9575],{"type":79,"value":9576},"                part",{"type":68,"tag":192,"props":9578,"children":9579},{"style":298},[9580],{"type":79,"value":9440},{"type":68,"tag":192,"props":9582,"children":9583},{"style":304},[9584],{"type":79,"value":9350},{"type":68,"tag":192,"props":9586,"children":9587},{"style":298},[9588],{"type":79,"value":3721},{"type":68,"tag":192,"props":9590,"children":9591},{"class":194,"line":3598},[9592,9597,9601,9605],{"type":68,"tag":192,"props":9593,"children":9594},{"style":348},[9595],{"type":79,"value":9596},"                bridge",{"type":68,"tag":192,"props":9598,"children":9599},{"style":298},[9600],{"type":79,"value":9440},{"type":68,"tag":192,"props":9602,"children":9603},{"style":304},[9604],{"type":79,"value":8687},{"type":68,"tag":192,"props":9606,"children":9607},{"style":298},[9608],{"type":79,"value":3721},{"type":68,"tag":192,"props":9610,"children":9611},{"class":194,"line":3610},[9612,9617,9622,9626,9630,9635,9640,9644,9648,9653,9657,9661],{"type":68,"tag":192,"props":9613,"children":9614},{"style":348},[9615],{"type":79,"value":9616},"                sandbox",{"type":68,"tag":192,"props":9618,"children":9619},{"style":298},[9620],{"type":79,"value":9621},"={{",{"type":68,"tag":192,"props":9623,"children":9624},{"style":388},[9625],{"type":79,"value":433},{"type":68,"tag":192,"props":9627,"children":9628},{"style":298},[9629],{"type":79,"value":396},{"type":68,"tag":192,"props":9631,"children":9632},{"style":298},[9633],{"type":79,"value":9634}," new",{"type":68,"tag":192,"props":9636,"children":9637},{"style":369},[9638],{"type":79,"value":9639}," URL",{"type":68,"tag":192,"props":9641,"children":9642},{"style":304},[9643],{"type":79,"value":376},{"type":68,"tag":192,"props":9645,"children":9646},{"style":298},[9647],{"type":79,"value":423},{"type":68,"tag":192,"props":9649,"children":9650},{"style":205},[9651],{"type":79,"value":9652},"https:\u002F\u002Fsandbox.example.com",{"type":68,"tag":192,"props":9654,"children":9655},{"style":298},[9656],{"type":79,"value":423},{"type":68,"tag":192,"props":9658,"children":9659},{"style":304},[9660],{"type":79,"value":3648},{"type":68,"tag":192,"props":9662,"children":9663},{"style":298},[9664],{"type":79,"value":9665},"}}\n",{"type":68,"tag":192,"props":9667,"children":9668},{"class":194,"line":3655},[9669],{"type":68,"tag":192,"props":9670,"children":9671},{"style":488},[9672],{"type":79,"value":9673},"                \u002F\u002F toolInput is optional; toolName comes from part.toolName.\n",{"type":68,"tag":192,"props":9675,"children":9676},{"class":194,"line":3664},[9677],{"type":68,"tag":192,"props":9678,"children":9679},{"style":298},[9680],{"type":79,"value":9681},"              \u002F>\n",{"type":68,"tag":192,"props":9683,"children":9684},{"class":194,"line":3673},[9685],{"type":68,"tag":192,"props":9686,"children":9687},{"style":388},[9688],{"type":79,"value":9689},"            )\n",{"type":68,"tag":192,"props":9691,"children":9692},{"class":194,"line":3690},[9693],{"type":68,"tag":192,"props":9694,"children":9695},{"style":298},[9696],{"type":79,"value":9697},"          }\n",{"type":68,"tag":192,"props":9699,"children":9700},{"class":194,"line":3715},[9701,9706],{"type":68,"tag":192,"props":9702,"children":9703},{"style":292},[9704],{"type":79,"value":9705},"          return",{"type":68,"tag":192,"props":9707,"children":9708},{"style":298},[9709],{"type":79,"value":9710}," null\n",{"type":68,"tag":192,"props":9712,"children":9713},{"class":194,"line":3724},[9714,9718,9722],{"type":68,"tag":192,"props":9715,"children":9716},{"style":298},[9717],{"type":79,"value":4607},{"type":68,"tag":192,"props":9719,"children":9720},{"style":304},[9721],{"type":79,"value":1239},{"type":68,"tag":192,"props":9723,"children":9724},{"style":298},[9725],{"type":79,"value":663},{"type":68,"tag":192,"props":9727,"children":9728},{"class":194,"line":3732},[9729,9734],{"type":68,"tag":192,"props":9730,"children":9731},{"style":304},[9732],{"type":79,"value":9733},"      )",{"type":68,"tag":192,"props":9735,"children":9736},{"style":298},[9737],{"type":79,"value":3721},{"type":68,"tag":192,"props":9739,"children":9740},{"class":194,"line":3741},[9741,9746,9750],{"type":68,"tag":192,"props":9742,"children":9743},{"style":298},[9744],{"type":79,"value":9745},"    \u003C\u002F",{"type":68,"tag":192,"props":9747,"children":9748},{"style":388},[9749],{"type":79,"value":9266},{"type":68,"tag":192,"props":9751,"children":9752},{"style":298},[9753],{"type":79,"value":9271},{"type":68,"tag":192,"props":9755,"children":9756},{"class":194,"line":3750},[9757],{"type":68,"tag":192,"props":9758,"children":9759},{"style":388},[9760],{"type":79,"value":9761},"  )\n",{"type":68,"tag":192,"props":9763,"children":9764},{"class":194,"line":3782},[9765],{"type":68,"tag":192,"props":9766,"children":9767},{"style":298},[9768],{"type":79,"value":3721},{"type":68,"tag":111,"props":9770,"children":9772},{"id":9771},"codegen-cli",[9773],{"type":79,"value":9774},"Codegen CLI",{"type":68,"tag":82,"props":9776,"children":9777},{},[9778],{"type":79,"value":9779},"Generate TypeScript types (typed tool names and pool keys) by introspecting live MCP servers.",{"type":68,"tag":82,"props":9781,"children":9782},{},[9783],{"type":68,"tag":1476,"props":9784,"children":9785},{},[9786,9788,9794],{"type":79,"value":9787},"1. Create ",{"type":68,"tag":74,"props":9789,"children":9791},{"className":9790},[],[9792],{"type":79,"value":9793},"mcp.config.ts",{"type":79,"value":9795}," at your project root:",{"type":68,"tag":181,"props":9797,"children":9799},{"className":281,"code":9798,"language":45,"meta":186,"style":186},"import { defineConfig } from '@tanstack\u002Fai-mcp'\n\nexport default defineConfig({\n  servers: {\n    github: {\n      transport: { type: 'http', url: 'https:\u002F\u002Fmcp.github.com\u002Fmcp' },\n      \u002F\u002F prefix must match the runtime createMCPClient({ prefix }) value\n    },\n  },\n  outFile: '.\u002Fsrc\u002Fmcp-types.generated.ts',\n})\n",[9800],{"type":68,"tag":74,"props":9801,"children":9802},{"__ignoreMap":186},[9803,9839,9846,9870,9886,9902,9966,9974,9981,9988,10017],{"type":68,"tag":192,"props":9804,"children":9805},{"class":194,"line":195},[9806,9810,9814,9819,9823,9827,9831,9835],{"type":68,"tag":192,"props":9807,"children":9808},{"style":292},[9809],{"type":79,"value":295},{"type":68,"tag":192,"props":9811,"children":9812},{"style":298},[9813],{"type":79,"value":301},{"type":68,"tag":192,"props":9815,"children":9816},{"style":304},[9817],{"type":79,"value":9818}," defineConfig",{"type":68,"tag":192,"props":9820,"children":9821},{"style":298},[9822],{"type":79,"value":312},{"type":68,"tag":192,"props":9824,"children":9825},{"style":292},[9826],{"type":79,"value":317},{"type":68,"tag":192,"props":9828,"children":9829},{"style":298},[9830],{"type":79,"value":322},{"type":68,"tag":192,"props":9832,"children":9833},{"style":205},[9834],{"type":79,"value":80},{"type":68,"tag":192,"props":9836,"children":9837},{"style":298},[9838],{"type":79,"value":331},{"type":68,"tag":192,"props":9840,"children":9841},{"class":194,"line":334},[9842],{"type":68,"tag":192,"props":9843,"children":9844},{"emptyLinePlaceholder":338},[9845],{"type":79,"value":341},{"type":68,"tag":192,"props":9847,"children":9848},{"class":194,"line":344},[9849,9853,9858,9862,9866],{"type":68,"tag":192,"props":9850,"children":9851},{"style":292},[9852],{"type":79,"value":4334},{"type":68,"tag":192,"props":9854,"children":9855},{"style":292},[9856],{"type":79,"value":9857}," default",{"type":68,"tag":192,"props":9859,"children":9860},{"style":369},[9861],{"type":79,"value":9818},{"type":68,"tag":192,"props":9863,"children":9864},{"style":304},[9865],{"type":79,"value":376},{"type":68,"tag":192,"props":9867,"children":9868},{"style":298},[9869],{"type":79,"value":381},{"type":68,"tag":192,"props":9871,"children":9872},{"class":194,"line":384},[9873,9878,9882],{"type":68,"tag":192,"props":9874,"children":9875},{"style":388},[9876],{"type":79,"value":9877},"  servers",{"type":68,"tag":192,"props":9879,"children":9880},{"style":298},[9881],{"type":79,"value":396},{"type":68,"tag":192,"props":9883,"children":9884},{"style":298},[9885],{"type":79,"value":634},{"type":68,"tag":192,"props":9887,"children":9888},{"class":194,"line":458},[9889,9894,9898],{"type":68,"tag":192,"props":9890,"children":9891},{"style":388},[9892],{"type":79,"value":9893},"    github",{"type":68,"tag":192,"props":9895,"children":9896},{"style":298},[9897],{"type":79,"value":396},{"type":68,"tag":192,"props":9899,"children":9900},{"style":298},[9901],{"type":79,"value":634},{"type":68,"tag":192,"props":9903,"children":9904},{"class":194,"line":494},[9905,9910,9914,9918,9922,9926,9930,9934,9938,9942,9946,9950,9954,9958,9962],{"type":68,"tag":192,"props":9906,"children":9907},{"style":388},[9908],{"type":79,"value":9909},"      transport",{"type":68,"tag":192,"props":9911,"children":9912},{"style":298},[9913],{"type":79,"value":396},{"type":68,"tag":192,"props":9915,"children":9916},{"style":298},[9917],{"type":79,"value":301},{"type":68,"tag":192,"props":9919,"children":9920},{"style":388},[9921],{"type":79,"value":405},{"type":68,"tag":192,"props":9923,"children":9924},{"style":298},[9925],{"type":79,"value":396},{"type":68,"tag":192,"props":9927,"children":9928},{"style":298},[9929],{"type":79,"value":322},{"type":68,"tag":192,"props":9931,"children":9932},{"style":205},[9933],{"type":79,"value":418},{"type":68,"tag":192,"props":9935,"children":9936},{"style":298},[9937],{"type":79,"value":423},{"type":68,"tag":192,"props":9939,"children":9940},{"style":298},[9941],{"type":79,"value":428},{"type":68,"tag":192,"props":9943,"children":9944},{"style":388},[9945],{"type":79,"value":433},{"type":68,"tag":192,"props":9947,"children":9948},{"style":298},[9949],{"type":79,"value":396},{"type":68,"tag":192,"props":9951,"children":9952},{"style":298},[9953],{"type":79,"value":322},{"type":68,"tag":192,"props":9955,"children":9956},{"style":205},[9957],{"type":79,"value":5095},{"type":68,"tag":192,"props":9959,"children":9960},{"style":298},[9961],{"type":79,"value":423},{"type":68,"tag":192,"props":9963,"children":9964},{"style":298},[9965],{"type":79,"value":455},{"type":68,"tag":192,"props":9967,"children":9968},{"class":194,"line":529},[9969],{"type":68,"tag":192,"props":9970,"children":9971},{"style":488},[9972],{"type":79,"value":9973},"      \u002F\u002F prefix must match the runtime createMCPClient({ prefix }) value\n",{"type":68,"tag":192,"props":9975,"children":9976},{"class":194,"line":1165},[9977],{"type":68,"tag":192,"props":9978,"children":9979},{"style":298},[9980],{"type":79,"value":3295},{"type":68,"tag":192,"props":9982,"children":9983},{"class":194,"line":1228},[9984],{"type":68,"tag":192,"props":9985,"children":9986},{"style":298},[9987],{"type":79,"value":741},{"type":68,"tag":192,"props":9989,"children":9990},{"class":194,"line":1246},[9991,9996,10000,10004,10009,10013],{"type":68,"tag":192,"props":9992,"children":9993},{"style":388},[9994],{"type":79,"value":9995},"  outFile",{"type":68,"tag":192,"props":9997,"children":9998},{"style":298},[9999],{"type":79,"value":396},{"type":68,"tag":192,"props":10001,"children":10002},{"style":298},[10003],{"type":79,"value":322},{"type":68,"tag":192,"props":10005,"children":10006},{"style":205},[10007],{"type":79,"value":10008},".\u002Fsrc\u002Fmcp-types.generated.ts",{"type":68,"tag":192,"props":10010,"children":10011},{"style":298},[10012],{"type":79,"value":423},{"type":68,"tag":192,"props":10014,"children":10015},{"style":298},[10016],{"type":79,"value":663},{"type":68,"tag":192,"props":10018,"children":10019},{"class":194,"line":1807},[10020,10024],{"type":68,"tag":192,"props":10021,"children":10022},{"style":298},[10023],{"type":79,"value":535},{"type":68,"tag":192,"props":10025,"children":10026},{"style":304},[10027],{"type":79,"value":540},{"type":68,"tag":82,"props":10029,"children":10030},{},[10031],{"type":68,"tag":1476,"props":10032,"children":10033},{},[10034],{"type":79,"value":10035},"2. Run the generator:",{"type":68,"tag":181,"props":10037,"children":10039},{"className":183,"code":10038,"language":185,"meta":186,"style":186},"npx @tanstack\u002Fai-mcp generate\n",[10040],{"type":68,"tag":74,"props":10041,"children":10042},{"__ignoreMap":186},[10043],{"type":68,"tag":192,"props":10044,"children":10045},{"class":194,"line":195},[10046,10050,10055],{"type":68,"tag":192,"props":10047,"children":10048},{"style":199},[10049],{"type":79,"value":1098},{"type":68,"tag":192,"props":10051,"children":10052},{"style":205},[10053],{"type":79,"value":10054}," @tanstack\u002Fai-mcp",{"type":68,"tag":192,"props":10056,"children":10057},{"style":205},[10058],{"type":79,"value":10059}," generate\n",{"type":68,"tag":82,"props":10061,"children":10062},{},[10063,10065,10071,10073,10079],{"type":79,"value":10064},"This connects to each server, lists its tools\u002Fresources\u002Fprompts, converts JSON\nSchemas to TypeScript, and writes one ",{"type":68,"tag":74,"props":10066,"children":10068},{"className":10067},[],[10069],{"type":79,"value":10070},"interface \u003CName>Server extends ServerDescriptor",{"type":79,"value":10072},"\nper server plus a combined ",{"type":68,"tag":74,"props":10074,"children":10076},{"className":10075},[],[10077],{"type":79,"value":10078},"interface MCPServers",{"type":79,"value":10080}," for pool typing.",{"type":68,"tag":82,"props":10082,"children":10083},{},[10084],{"type":68,"tag":1476,"props":10085,"children":10086},{},[10087],{"type":79,"value":10088},"3. Use the generated types:",{"type":68,"tag":181,"props":10090,"children":10092},{"className":281,"code":10091,"language":45,"meta":186,"style":186},"\u002F\u002F Single server — narrows tools() return to descriptor-keyed tool names.\nimport type { GithubServer } from '.\u002Fsrc\u002Fmcp-types.generated'\nimport { createMCPClient } from '@tanstack\u002Fai-mcp'\n\nconst client = await createMCPClient\u003CGithubServer>({\n  transport: { type: 'http', url: 'https:\u002F\u002Fmcp.github.com\u002Fmcp' },\n})\nconst tools = await client.tools() \u002F\u002F typed to GithubServer's tool names\n\n\u002F\u002F Multiple servers via the generated MCPServers map.\nimport type { MCPServers } from '.\u002Fsrc\u002Fmcp-types.generated'\n\nconst pool = await createMCPClients\u003CMCPServers>({\n  github: { transport: { type: 'http', url: 'https:\u002F\u002Fmcp.github.com\u002Fmcp' } },\n})\n\u002F\u002F pool.clients.github is MCPClient\u003CGithubServer>\n\u002F\u002F missing\u002Fextra keys are a compile error\n",[10093],{"type":68,"tag":74,"props":10094,"children":10095},{"__ignoreMap":186},[10096,10104,10145,10180,10187,10233,10296,10307,10347,10354,10362,10402,10409,10453,10532,10543,10551],{"type":68,"tag":192,"props":10097,"children":10098},{"class":194,"line":195},[10099],{"type":68,"tag":192,"props":10100,"children":10101},{"style":488},[10102],{"type":79,"value":10103},"\u002F\u002F Single server — narrows tools() return to descriptor-keyed tool names.\n",{"type":68,"tag":192,"props":10105,"children":10106},{"class":194,"line":334},[10107,10111,10115,10119,10124,10128,10132,10136,10141],{"type":68,"tag":192,"props":10108,"children":10109},{"style":292},[10110],{"type":79,"value":295},{"type":68,"tag":192,"props":10112,"children":10113},{"style":292},[10114],{"type":79,"value":405},{"type":68,"tag":192,"props":10116,"children":10117},{"style":298},[10118],{"type":79,"value":301},{"type":68,"tag":192,"props":10120,"children":10121},{"style":304},[10122],{"type":79,"value":10123}," GithubServer",{"type":68,"tag":192,"props":10125,"children":10126},{"style":298},[10127],{"type":79,"value":312},{"type":68,"tag":192,"props":10129,"children":10130},{"style":292},[10131],{"type":79,"value":317},{"type":68,"tag":192,"props":10133,"children":10134},{"style":298},[10135],{"type":79,"value":322},{"type":68,"tag":192,"props":10137,"children":10138},{"style":205},[10139],{"type":79,"value":10140},".\u002Fsrc\u002Fmcp-types.generated",{"type":68,"tag":192,"props":10142,"children":10143},{"style":298},[10144],{"type":79,"value":331},{"type":68,"tag":192,"props":10146,"children":10147},{"class":194,"line":344},[10148,10152,10156,10160,10164,10168,10172,10176],{"type":68,"tag":192,"props":10149,"children":10150},{"style":292},[10151],{"type":79,"value":295},{"type":68,"tag":192,"props":10153,"children":10154},{"style":298},[10155],{"type":79,"value":301},{"type":68,"tag":192,"props":10157,"children":10158},{"style":304},[10159],{"type":79,"value":307},{"type":68,"tag":192,"props":10161,"children":10162},{"style":298},[10163],{"type":79,"value":312},{"type":68,"tag":192,"props":10165,"children":10166},{"style":292},[10167],{"type":79,"value":317},{"type":68,"tag":192,"props":10169,"children":10170},{"style":298},[10171],{"type":79,"value":322},{"type":68,"tag":192,"props":10173,"children":10174},{"style":205},[10175],{"type":79,"value":80},{"type":68,"tag":192,"props":10177,"children":10178},{"style":298},[10179],{"type":79,"value":331},{"type":68,"tag":192,"props":10181,"children":10182},{"class":194,"line":384},[10183],{"type":68,"tag":192,"props":10184,"children":10185},{"emptyLinePlaceholder":338},[10186],{"type":79,"value":341},{"type":68,"tag":192,"props":10188,"children":10189},{"class":194,"line":458},[10190,10194,10198,10202,10206,10210,10215,10220,10225,10229],{"type":68,"tag":192,"props":10191,"children":10192},{"style":348},[10193],{"type":79,"value":351},{"type":68,"tag":192,"props":10195,"children":10196},{"style":304},[10197],{"type":79,"value":356},{"type":68,"tag":192,"props":10199,"children":10200},{"style":298},[10201],{"type":79,"value":361},{"type":68,"tag":192,"props":10203,"children":10204},{"style":292},[10205],{"type":79,"value":366},{"type":68,"tag":192,"props":10207,"children":10208},{"style":369},[10209],{"type":79,"value":307},{"type":68,"tag":192,"props":10211,"children":10212},{"style":298},[10213],{"type":79,"value":10214},"\u003C",{"type":68,"tag":192,"props":10216,"children":10217},{"style":199},[10218],{"type":79,"value":10219},"GithubServer",{"type":68,"tag":192,"props":10221,"children":10222},{"style":298},[10223],{"type":79,"value":10224},">",{"type":68,"tag":192,"props":10226,"children":10227},{"style":304},[10228],{"type":79,"value":376},{"type":68,"tag":192,"props":10230,"children":10231},{"style":298},[10232],{"type":79,"value":381},{"type":68,"tag":192,"props":10234,"children":10235},{"class":194,"line":494},[10236,10240,10244,10248,10252,10256,10260,10264,10268,10272,10276,10280,10284,10288,10292],{"type":68,"tag":192,"props":10237,"children":10238},{"style":388},[10239],{"type":79,"value":391},{"type":68,"tag":192,"props":10241,"children":10242},{"style":298},[10243],{"type":79,"value":396},{"type":68,"tag":192,"props":10245,"children":10246},{"style":298},[10247],{"type":79,"value":301},{"type":68,"tag":192,"props":10249,"children":10250},{"style":388},[10251],{"type":79,"value":405},{"type":68,"tag":192,"props":10253,"children":10254},{"style":298},[10255],{"type":79,"value":396},{"type":68,"tag":192,"props":10257,"children":10258},{"style":298},[10259],{"type":79,"value":322},{"type":68,"tag":192,"props":10261,"children":10262},{"style":205},[10263],{"type":79,"value":418},{"type":68,"tag":192,"props":10265,"children":10266},{"style":298},[10267],{"type":79,"value":423},{"type":68,"tag":192,"props":10269,"children":10270},{"style":298},[10271],{"type":79,"value":428},{"type":68,"tag":192,"props":10273,"children":10274},{"style":388},[10275],{"type":79,"value":433},{"type":68,"tag":192,"props":10277,"children":10278},{"style":298},[10279],{"type":79,"value":396},{"type":68,"tag":192,"props":10281,"children":10282},{"style":298},[10283],{"type":79,"value":322},{"type":68,"tag":192,"props":10285,"children":10286},{"style":205},[10287],{"type":79,"value":5095},{"type":68,"tag":192,"props":10289,"children":10290},{"style":298},[10291],{"type":79,"value":423},{"type":68,"tag":192,"props":10293,"children":10294},{"style":298},[10295],{"type":79,"value":455},{"type":68,"tag":192,"props":10297,"children":10298},{"class":194,"line":529},[10299,10303],{"type":68,"tag":192,"props":10300,"children":10301},{"style":298},[10302],{"type":79,"value":535},{"type":68,"tag":192,"props":10304,"children":10305},{"style":304},[10306],{"type":79,"value":540},{"type":68,"tag":192,"props":10308,"children":10309},{"class":194,"line":1165},[10310,10314,10318,10322,10326,10330,10334,10338,10342],{"type":68,"tag":192,"props":10311,"children":10312},{"style":348},[10313],{"type":79,"value":351},{"type":68,"tag":192,"props":10315,"children":10316},{"style":304},[10317],{"type":79,"value":1917},{"type":68,"tag":192,"props":10319,"children":10320},{"style":298},[10321],{"type":79,"value":361},{"type":68,"tag":192,"props":10323,"children":10324},{"style":292},[10325],{"type":79,"value":366},{"type":68,"tag":192,"props":10327,"children":10328},{"style":304},[10329],{"type":79,"value":1930},{"type":68,"tag":192,"props":10331,"children":10332},{"style":298},[10333],{"type":79,"value":230},{"type":68,"tag":192,"props":10335,"children":10336},{"style":369},[10337],{"type":79,"value":1939},{"type":68,"tag":192,"props":10339,"children":10340},{"style":304},[10341],{"type":79,"value":2487},{"type":68,"tag":192,"props":10343,"children":10344},{"style":488},[10345],{"type":79,"value":10346},"\u002F\u002F typed to GithubServer's tool names\n",{"type":68,"tag":192,"props":10348,"children":10349},{"class":194,"line":1228},[10350],{"type":68,"tag":192,"props":10351,"children":10352},{"emptyLinePlaceholder":338},[10353],{"type":79,"value":341},{"type":68,"tag":192,"props":10355,"children":10356},{"class":194,"line":1246},[10357],{"type":68,"tag":192,"props":10358,"children":10359},{"style":488},[10360],{"type":79,"value":10361},"\u002F\u002F Multiple servers via the generated MCPServers map.\n",{"type":68,"tag":192,"props":10363,"children":10364},{"class":194,"line":1807},[10365,10369,10373,10377,10382,10386,10390,10394,10398],{"type":68,"tag":192,"props":10366,"children":10367},{"style":292},[10368],{"type":79,"value":295},{"type":68,"tag":192,"props":10370,"children":10371},{"style":292},[10372],{"type":79,"value":405},{"type":68,"tag":192,"props":10374,"children":10375},{"style":298},[10376],{"type":79,"value":301},{"type":68,"tag":192,"props":10378,"children":10379},{"style":304},[10380],{"type":79,"value":10381}," MCPServers",{"type":68,"tag":192,"props":10383,"children":10384},{"style":298},[10385],{"type":79,"value":312},{"type":68,"tag":192,"props":10387,"children":10388},{"style":292},[10389],{"type":79,"value":317},{"type":68,"tag":192,"props":10391,"children":10392},{"style":298},[10393],{"type":79,"value":322},{"type":68,"tag":192,"props":10395,"children":10396},{"style":205},[10397],{"type":79,"value":10140},{"type":68,"tag":192,"props":10399,"children":10400},{"style":298},[10401],{"type":79,"value":331},{"type":68,"tag":192,"props":10403,"children":10404},{"class":194,"line":1815},[10405],{"type":68,"tag":192,"props":10406,"children":10407},{"emptyLinePlaceholder":338},[10408],{"type":79,"value":341},{"type":68,"tag":192,"props":10410,"children":10411},{"class":194,"line":2651},[10412,10416,10420,10424,10428,10432,10436,10441,10445,10449],{"type":68,"tag":192,"props":10413,"children":10414},{"style":348},[10415],{"type":79,"value":351},{"type":68,"tag":192,"props":10417,"children":10418},{"style":304},[10419],{"type":79,"value":5005},{"type":68,"tag":192,"props":10421,"children":10422},{"style":298},[10423],{"type":79,"value":361},{"type":68,"tag":192,"props":10425,"children":10426},{"style":292},[10427],{"type":79,"value":366},{"type":68,"tag":192,"props":10429,"children":10430},{"style":369},[10431],{"type":79,"value":5018},{"type":68,"tag":192,"props":10433,"children":10434},{"style":298},[10435],{"type":79,"value":10214},{"type":68,"tag":192,"props":10437,"children":10438},{"style":199},[10439],{"type":79,"value":10440},"MCPServers",{"type":68,"tag":192,"props":10442,"children":10443},{"style":298},[10444],{"type":79,"value":10224},{"type":68,"tag":192,"props":10446,"children":10447},{"style":304},[10448],{"type":79,"value":376},{"type":68,"tag":192,"props":10450,"children":10451},{"style":298},[10452],{"type":79,"value":381},{"type":68,"tag":192,"props":10454,"children":10455},{"class":194,"line":2715},[10456,10460,10464,10468,10472,10476,10480,10484,10488,10492,10496,10500,10504,10508,10512,10516,10520,10524,10528],{"type":68,"tag":192,"props":10457,"children":10458},{"style":388},[10459],{"type":79,"value":5034},{"type":68,"tag":192,"props":10461,"children":10462},{"style":298},[10463],{"type":79,"value":396},{"type":68,"tag":192,"props":10465,"children":10466},{"style":298},[10467],{"type":79,"value":301},{"type":68,"tag":192,"props":10469,"children":10470},{"style":388},[10471],{"type":79,"value":1440},{"type":68,"tag":192,"props":10473,"children":10474},{"style":298},[10475],{"type":79,"value":396},{"type":68,"tag":192,"props":10477,"children":10478},{"style":298},[10479],{"type":79,"value":301},{"type":68,"tag":192,"props":10481,"children":10482},{"style":388},[10483],{"type":79,"value":405},{"type":68,"tag":192,"props":10485,"children":10486},{"style":298},[10487],{"type":79,"value":396},{"type":68,"tag":192,"props":10489,"children":10490},{"style":298},[10491],{"type":79,"value":322},{"type":68,"tag":192,"props":10493,"children":10494},{"style":205},[10495],{"type":79,"value":418},{"type":68,"tag":192,"props":10497,"children":10498},{"style":298},[10499],{"type":79,"value":423},{"type":68,"tag":192,"props":10501,"children":10502},{"style":298},[10503],{"type":79,"value":428},{"type":68,"tag":192,"props":10505,"children":10506},{"style":388},[10507],{"type":79,"value":433},{"type":68,"tag":192,"props":10509,"children":10510},{"style":298},[10511],{"type":79,"value":396},{"type":68,"tag":192,"props":10513,"children":10514},{"style":298},[10515],{"type":79,"value":322},{"type":68,"tag":192,"props":10517,"children":10518},{"style":205},[10519],{"type":79,"value":5095},{"type":68,"tag":192,"props":10521,"children":10522},{"style":298},[10523],{"type":79,"value":423},{"type":68,"tag":192,"props":10525,"children":10526},{"style":298},[10527],{"type":79,"value":312},{"type":68,"tag":192,"props":10529,"children":10530},{"style":298},[10531],{"type":79,"value":455},{"type":68,"tag":192,"props":10533,"children":10534},{"class":194,"line":2727},[10535,10539],{"type":68,"tag":192,"props":10536,"children":10537},{"style":298},[10538],{"type":79,"value":535},{"type":68,"tag":192,"props":10540,"children":10541},{"style":304},[10542],{"type":79,"value":540},{"type":68,"tag":192,"props":10544,"children":10545},{"class":194,"line":2735},[10546],{"type":68,"tag":192,"props":10547,"children":10548},{"style":488},[10549],{"type":79,"value":10550},"\u002F\u002F pool.clients.github is MCPClient\u003CGithubServer>\n",{"type":68,"tag":192,"props":10552,"children":10553},{"class":194,"line":2744},[10554],{"type":68,"tag":192,"props":10555,"children":10556},{"style":488},[10557],{"type":79,"value":10558},"\u002F\u002F missing\u002Fextra keys are a compile error\n",{"type":68,"tag":82,"props":10560,"children":10561},{},[10562,10564,10570,10571,10577],{"type":79,"value":10563},"Codegen deps (",{"type":68,"tag":74,"props":10565,"children":10567},{"className":10566},[],[10568],{"type":79,"value":10569},"json-schema-to-typescript",{"type":79,"value":240},{"type":68,"tag":74,"props":10572,"children":10574},{"className":10573},[],[10575],{"type":79,"value":10576},"jiti",{"type":79,"value":10578},") are bundled into the CLI bin\nand do NOT appear in the library's runtime dependency graph.",{"type":68,"tag":111,"props":10580,"children":10582},{"id":10581},"error-classes",[10583],{"type":79,"value":10584},"Error classes",{"type":68,"tag":130,"props":10586,"children":10587},{},[10588,10605,10630,10678,10702],{"type":68,"tag":134,"props":10589,"children":10590},{},[10591,10596,10598,10604],{"type":68,"tag":74,"props":10592,"children":10594},{"className":10593},[],[10595],{"type":79,"value":564},{"type":79,"value":10597}," — thrown when a server connection fails or when calling\nmethods after ",{"type":68,"tag":74,"props":10599,"children":10601},{"className":10600},[],[10602],{"type":79,"value":10603},"close()",{"type":79,"value":230},{"type":68,"tag":134,"props":10606,"children":10607},{},[10608,10613,10615,10621,10623,10628],{"type":68,"tag":74,"props":10609,"children":10611},{"className":10610},[],[10612],{"type":79,"value":2217},{"type":79,"value":10614}," — thrown from ",{"type":68,"tag":74,"props":10616,"children":10618},{"className":10617},[],[10619],{"type":79,"value":10620},"client.tools([defs])",{"type":79,"value":10622}," when a definition's\n",{"type":68,"tag":74,"props":10624,"children":10626},{"className":10625},[],[10627],{"type":79,"value":2209},{"type":79,"value":10629}," is not exposed by the server.",{"type":68,"tag":134,"props":10631,"children":10632},{},[10633,10639,10640,10645,10647,10653,10655,10661,10663,10668,10670,10676],{"type":68,"tag":74,"props":10634,"children":10636},{"className":10635},[],[10637],{"type":79,"value":10638},"MCPTaskRequiredToolError",{"type":79,"value":10614},{"type":68,"tag":74,"props":10641,"children":10643},{"className":10642},[],[10644],{"type":79,"value":10620},{"type":79,"value":10646}," when the named\ntool declares ",{"type":68,"tag":74,"props":10648,"children":10650},{"className":10649},[],[10651],{"type":79,"value":10652},"execution.taskSupport: 'required'",{"type":79,"value":10654}," (experimental MCP tasks).\nSuch tools only run via the SDK's ",{"type":68,"tag":74,"props":10656,"children":10658},{"className":10657},[],[10659],{"type":79,"value":10660},"tasks\u002FcallToolStream",{"type":79,"value":10662}," flow, which\n",{"type":68,"tag":74,"props":10664,"children":10666},{"className":10665},[],[10667],{"type":79,"value":80},{"type":79,"value":10669}," does not support yet; they are silently excluded from\n",{"type":68,"tag":74,"props":10671,"children":10673},{"className":10672},[],[10674],{"type":79,"value":10675},"tools()",{"type":79,"value":10677}," auto-discovery for the same reason.",{"type":68,"tag":134,"props":10679,"children":10680},{},[10681,10687,10689,10694,10696,10701],{"type":68,"tag":74,"props":10682,"children":10684},{"className":10683},[],[10685],{"type":79,"value":10686},"DuplicateToolNameError",{"type":79,"value":10688}," — thrown by a single pool's own ",{"type":68,"tag":74,"props":10690,"children":10692},{"className":10691},[],[10693],{"type":79,"value":10675},{"type":79,"value":10695}," when two\ntools within that pool share the same name (same server or pool clients with no\nprefix). Exported from ",{"type":68,"tag":74,"props":10697,"children":10699},{"className":10698},[],[10700],{"type":79,"value":80},{"type":79,"value":230},{"type":68,"tag":134,"props":10703,"children":10704},{},[10705,10711,10713,10718,10720,10726,10728,10733,10735,10740,10742,10748,10750,10755],{"type":68,"tag":74,"props":10706,"children":10708},{"className":10707},[],[10709],{"type":79,"value":10710},"MCPDuplicateToolNameError",{"type":79,"value":10712}," — thrown by ",{"type":68,"tag":74,"props":10714,"children":10716},{"className":10715},[],[10717],{"type":79,"value":107},{"type":79,"value":10719}," when tools from separate\n",{"type":68,"tag":74,"props":10721,"children":10723},{"className":10722},[],[10724],{"type":79,"value":10725},"mcp.clients",{"type":79,"value":10727}," entries collide after merging. Exported from ",{"type":68,"tag":74,"props":10729,"children":10731},{"className":10730},[],[10732],{"type":79,"value":2259},{"type":79,"value":10734},"\n(not ",{"type":68,"tag":74,"props":10736,"children":10738},{"className":10737},[],[10739],{"type":79,"value":80},{"type":79,"value":10741},"), so users can ",{"type":68,"tag":74,"props":10743,"children":10745},{"className":10744},[],[10746],{"type":79,"value":10747},"instanceof",{"type":79,"value":10749}," it at the ",{"type":68,"tag":74,"props":10751,"children":10753},{"className":10752},[],[10754],{"type":79,"value":107},{"type":79,"value":10756}," call site.",{"type":68,"tag":181,"props":10758,"children":10760},{"className":281,"code":10759,"language":45,"meta":186,"style":186},"import {\n  MCPConnectionError,\n  MCPToolNotFoundError,\n  MCPTaskRequiredToolError,\n  DuplicateToolNameError,\n} from '@tanstack\u002Fai-mcp'\n\nimport { MCPDuplicateToolNameError } from '@tanstack\u002Fai'\n",[10761],{"type":68,"tag":74,"props":10762,"children":10763},{"__ignoreMap":186},[10764,10775,10787,10799,10811,10823,10846,10853],{"type":68,"tag":192,"props":10765,"children":10766},{"class":194,"line":195},[10767,10771],{"type":68,"tag":192,"props":10768,"children":10769},{"style":292},[10770],{"type":79,"value":295},{"type":68,"tag":192,"props":10772,"children":10773},{"style":298},[10774],{"type":79,"value":634},{"type":68,"tag":192,"props":10776,"children":10777},{"class":194,"line":334},[10778,10783],{"type":68,"tag":192,"props":10779,"children":10780},{"style":304},[10781],{"type":79,"value":10782},"  MCPConnectionError",{"type":68,"tag":192,"props":10784,"children":10785},{"style":298},[10786],{"type":79,"value":663},{"type":68,"tag":192,"props":10788,"children":10789},{"class":194,"line":344},[10790,10795],{"type":68,"tag":192,"props":10791,"children":10792},{"style":304},[10793],{"type":79,"value":10794},"  MCPToolNotFoundError",{"type":68,"tag":192,"props":10796,"children":10797},{"style":298},[10798],{"type":79,"value":663},{"type":68,"tag":192,"props":10800,"children":10801},{"class":194,"line":384},[10802,10807],{"type":68,"tag":192,"props":10803,"children":10804},{"style":304},[10805],{"type":79,"value":10806},"  MCPTaskRequiredToolError",{"type":68,"tag":192,"props":10808,"children":10809},{"style":298},[10810],{"type":79,"value":663},{"type":68,"tag":192,"props":10812,"children":10813},{"class":194,"line":458},[10814,10819],{"type":68,"tag":192,"props":10815,"children":10816},{"style":304},[10817],{"type":79,"value":10818},"  DuplicateToolNameError",{"type":68,"tag":192,"props":10820,"children":10821},{"style":298},[10822],{"type":79,"value":663},{"type":68,"tag":192,"props":10824,"children":10825},{"class":194,"line":494},[10826,10830,10834,10838,10842],{"type":68,"tag":192,"props":10827,"children":10828},{"style":298},[10829],{"type":79,"value":535},{"type":68,"tag":192,"props":10831,"children":10832},{"style":292},[10833],{"type":79,"value":317},{"type":68,"tag":192,"props":10835,"children":10836},{"style":298},[10837],{"type":79,"value":322},{"type":68,"tag":192,"props":10839,"children":10840},{"style":205},[10841],{"type":79,"value":80},{"type":68,"tag":192,"props":10843,"children":10844},{"style":298},[10845],{"type":79,"value":331},{"type":68,"tag":192,"props":10847,"children":10848},{"class":194,"line":529},[10849],{"type":68,"tag":192,"props":10850,"children":10851},{"emptyLinePlaceholder":338},[10852],{"type":79,"value":341},{"type":68,"tag":192,"props":10854,"children":10855},{"class":194,"line":1165},[10856,10860,10864,10869,10873,10877,10881,10885],{"type":68,"tag":192,"props":10857,"children":10858},{"style":292},[10859],{"type":79,"value":295},{"type":68,"tag":192,"props":10861,"children":10862},{"style":298},[10863],{"type":79,"value":301},{"type":68,"tag":192,"props":10865,"children":10866},{"style":304},[10867],{"type":79,"value":10868}," MCPDuplicateToolNameError",{"type":68,"tag":192,"props":10870,"children":10871},{"style":298},[10872],{"type":79,"value":312},{"type":68,"tag":192,"props":10874,"children":10875},{"style":292},[10876],{"type":79,"value":317},{"type":68,"tag":192,"props":10878,"children":10879},{"style":298},[10880],{"type":79,"value":322},{"type":68,"tag":192,"props":10882,"children":10883},{"style":205},[10884],{"type":79,"value":2259},{"type":68,"tag":192,"props":10886,"children":10887},{"style":298},[10888],{"type":79,"value":331},{"type":68,"tag":111,"props":10890,"children":10892},{"id":10891},"complete-server-route-example",[10893],{"type":79,"value":10894},"Complete server-route example",{"type":68,"tag":181,"props":10896,"children":10898},{"className":281,"code":10897,"language":45,"meta":186,"style":186},"\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 { createMCPClients } 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 pool = await createMCPClients({\n          github: {\n            transport: { type: 'http', url: 'https:\u002F\u002Fmcp.github.com\u002Fmcp' },\n          },\n          linear: {\n            transport: {\n              type: 'http',\n              url: 'https:\u002F\u002Fmcp.linear.app\u002Fmcp',\n              headers: {\n                Authorization: `Bearer ${process.env.LINEAR_KEY ?? ''}`,\n              },\n            },\n          },\n        })\n\n        const stream = chat({\n          adapter: openaiText('gpt-5.5'),\n          messages,\n          tools: await pool.tools(),\n          \u002F\u002F Close after the run ends — tools execute while the response streams,\n          \u002F\u002F so `await using` \u002F try-finally would close the pool too early here.\n          middleware: [\n            {\n              name: 'mcp-close',\n              onFinish: () => pool.close(),\n              onAbort: () => pool.close(),\n              onError: () => pool.close(),\n            },\n          ],\n        })\n\n        return toServerSentEventsResponse(stream)\n      },\n    },\n  },\n})\n",[10899],{"type":68,"tag":74,"props":10900,"children":10901},{"__ignoreMap":186},[10902,10910,10945,10988,11023,11058,11065,11112,11127,11142,11177,11220,11227,11258,11274,11338,11345,11361,11376,11404,11432,11448,11510,11518,11525,11532,11543,11550,11577,11616,11627,11663,11671,11679,11695,11703,11731,11771,11811,11851,11858,11870,11881,11889,11913,11921,11929,11937],{"type":68,"tag":192,"props":10903,"children":10904},{"class":194,"line":195},[10905],{"type":68,"tag":192,"props":10906,"children":10907},{"style":488},[10908],{"type":79,"value":10909},"\u002F\u002F src\u002Froutes\u002Fapi.chat.ts\n",{"type":68,"tag":192,"props":10911,"children":10912},{"class":194,"line":334},[10913,10917,10921,10925,10929,10933,10937,10941],{"type":68,"tag":192,"props":10914,"children":10915},{"style":292},[10916],{"type":79,"value":295},{"type":68,"tag":192,"props":10918,"children":10919},{"style":298},[10920],{"type":79,"value":301},{"type":68,"tag":192,"props":10922,"children":10923},{"style":304},[10924],{"type":79,"value":4184},{"type":68,"tag":192,"props":10926,"children":10927},{"style":298},[10928],{"type":79,"value":312},{"type":68,"tag":192,"props":10930,"children":10931},{"style":292},[10932],{"type":79,"value":317},{"type":68,"tag":192,"props":10934,"children":10935},{"style":298},[10936],{"type":79,"value":322},{"type":68,"tag":192,"props":10938,"children":10939},{"style":205},[10940],{"type":79,"value":4201},{"type":68,"tag":192,"props":10942,"children":10943},{"style":298},[10944],{"type":79,"value":331},{"type":68,"tag":192,"props":10946,"children":10947},{"class":194,"line":344},[10948,10952,10956,10960,10964,10968,10972,10976,10980,10984],{"type":68,"tag":192,"props":10949,"children":10950},{"style":292},[10951],{"type":79,"value":295},{"type":68,"tag":192,"props":10953,"children":10954},{"style":298},[10955],{"type":79,"value":301},{"type":68,"tag":192,"props":10957,"children":10958},{"style":304},[10959],{"type":79,"value":1979},{"type":68,"tag":192,"props":10961,"children":10962},{"style":298},[10963],{"type":79,"value":428},{"type":68,"tag":192,"props":10965,"children":10966},{"style":304},[10967],{"type":79,"value":3331},{"type":68,"tag":192,"props":10969,"children":10970},{"style":298},[10971],{"type":79,"value":312},{"type":68,"tag":192,"props":10973,"children":10974},{"style":292},[10975],{"type":79,"value":317},{"type":68,"tag":192,"props":10977,"children":10978},{"style":298},[10979],{"type":79,"value":322},{"type":68,"tag":192,"props":10981,"children":10982},{"style":205},[10983],{"type":79,"value":2259},{"type":68,"tag":192,"props":10985,"children":10986},{"style":298},[10987],{"type":79,"value":331},{"type":68,"tag":192,"props":10989,"children":10990},{"class":194,"line":384},[10991,10995,10999,11003,11007,11011,11015,11019],{"type":68,"tag":192,"props":10992,"children":10993},{"style":292},[10994],{"type":79,"value":295},{"type":68,"tag":192,"props":10996,"children":10997},{"style":298},[10998],{"type":79,"value":301},{"type":68,"tag":192,"props":11000,"children":11001},{"style":304},[11002],{"type":79,"value":2004},{"type":68,"tag":192,"props":11004,"children":11005},{"style":298},[11006],{"type":79,"value":312},{"type":68,"tag":192,"props":11008,"children":11009},{"style":292},[11010],{"type":79,"value":317},{"type":68,"tag":192,"props":11012,"children":11013},{"style":298},[11014],{"type":79,"value":322},{"type":68,"tag":192,"props":11016,"children":11017},{"style":205},[11018],{"type":79,"value":4280},{"type":68,"tag":192,"props":11020,"children":11021},{"style":298},[11022],{"type":79,"value":331},{"type":68,"tag":192,"props":11024,"children":11025},{"class":194,"line":458},[11026,11030,11034,11038,11042,11046,11050,11054],{"type":68,"tag":192,"props":11027,"children":11028},{"style":292},[11029],{"type":79,"value":295},{"type":68,"tag":192,"props":11031,"children":11032},{"style":298},[11033],{"type":79,"value":301},{"type":68,"tag":192,"props":11035,"children":11036},{"style":304},[11037],{"type":79,"value":5018},{"type":68,"tag":192,"props":11039,"children":11040},{"style":298},[11041],{"type":79,"value":312},{"type":68,"tag":192,"props":11043,"children":11044},{"style":292},[11045],{"type":79,"value":317},{"type":68,"tag":192,"props":11047,"children":11048},{"style":298},[11049],{"type":79,"value":322},{"type":68,"tag":192,"props":11051,"children":11052},{"style":205},[11053],{"type":79,"value":80},{"type":68,"tag":192,"props":11055,"children":11056},{"style":298},[11057],{"type":79,"value":331},{"type":68,"tag":192,"props":11059,"children":11060},{"class":194,"line":494},[11061],{"type":68,"tag":192,"props":11062,"children":11063},{"emptyLinePlaceholder":338},[11064],{"type":79,"value":341},{"type":68,"tag":192,"props":11066,"children":11067},{"class":194,"line":529},[11068,11072,11076,11080,11084,11088,11092,11096,11100,11104,11108],{"type":68,"tag":192,"props":11069,"children":11070},{"style":292},[11071],{"type":79,"value":4334},{"type":68,"tag":192,"props":11073,"children":11074},{"style":348},[11075],{"type":79,"value":1659},{"type":68,"tag":192,"props":11077,"children":11078},{"style":304},[11079],{"type":79,"value":4343},{"type":68,"tag":192,"props":11081,"children":11082},{"style":298},[11083],{"type":79,"value":361},{"type":68,"tag":192,"props":11085,"children":11086},{"style":369},[11087],{"type":79,"value":4184},{"type":68,"tag":192,"props":11089,"children":11090},{"style":304},[11091],{"type":79,"value":376},{"type":68,"tag":192,"props":11093,"children":11094},{"style":298},[11095],{"type":79,"value":423},{"type":68,"tag":192,"props":11097,"children":11098},{"style":205},[11099],{"type":79,"value":4364},{"type":68,"tag":192,"props":11101,"children":11102},{"style":298},[11103],{"type":79,"value":423},{"type":68,"tag":192,"props":11105,"children":11106},{"style":304},[11107],{"type":79,"value":4373},{"type":68,"tag":192,"props":11109,"children":11110},{"style":298},[11111],{"type":79,"value":381},{"type":68,"tag":192,"props":11113,"children":11114},{"class":194,"line":1165},[11115,11119,11123],{"type":68,"tag":192,"props":11116,"children":11117},{"style":388},[11118],{"type":79,"value":4385},{"type":68,"tag":192,"props":11120,"children":11121},{"style":298},[11122],{"type":79,"value":396},{"type":68,"tag":192,"props":11124,"children":11125},{"style":298},[11126],{"type":79,"value":634},{"type":68,"tag":192,"props":11128,"children":11129},{"class":194,"line":1228},[11130,11134,11138],{"type":68,"tag":192,"props":11131,"children":11132},{"style":388},[11133],{"type":79,"value":4401},{"type":68,"tag":192,"props":11135,"children":11136},{"style":298},[11137],{"type":79,"value":396},{"type":68,"tag":192,"props":11139,"children":11140},{"style":298},[11141],{"type":79,"value":634},{"type":68,"tag":192,"props":11143,"children":11144},{"class":194,"line":1246},[11145,11149,11153,11157,11161,11165,11169,11173],{"type":68,"tag":192,"props":11146,"children":11147},{"style":369},[11148],{"type":79,"value":4417},{"type":68,"tag":192,"props":11150,"children":11151},{"style":298},[11152],{"type":79,"value":396},{"type":68,"tag":192,"props":11154,"children":11155},{"style":348},[11156],{"type":79,"value":4426},{"type":68,"tag":192,"props":11158,"children":11159},{"style":298},[11160],{"type":79,"value":4431},{"type":68,"tag":192,"props":11162,"children":11163},{"style":4434},[11164],{"type":79,"value":4437},{"type":68,"tag":192,"props":11166,"children":11167},{"style":298},[11168],{"type":79,"value":4442},{"type":68,"tag":192,"props":11170,"children":11171},{"style":348},[11172],{"type":79,"value":3186},{"type":68,"tag":192,"props":11174,"children":11175},{"style":298},[11176],{"type":79,"value":634},{"type":68,"tag":192,"props":11178,"children":11179},{"class":194,"line":1807},[11180,11184,11188,11192,11196,11200,11204,11208,11212,11216],{"type":68,"tag":192,"props":11181,"children":11182},{"style":348},[11183],{"type":79,"value":4458},{"type":68,"tag":192,"props":11185,"children":11186},{"style":298},[11187],{"type":79,"value":301},{"type":68,"tag":192,"props":11189,"children":11190},{"style":304},[11191],{"type":79,"value":4467},{"type":68,"tag":192,"props":11193,"children":11194},{"style":298},[11195],{"type":79,"value":312},{"type":68,"tag":192,"props":11197,"children":11198},{"style":298},[11199],{"type":79,"value":1385},{"type":68,"tag":192,"props":11201,"children":11202},{"style":292},[11203],{"type":79,"value":366},{"type":68,"tag":192,"props":11205,"children":11206},{"style":304},[11207],{"type":79,"value":4437},{"type":68,"tag":192,"props":11209,"children":11210},{"style":298},[11211],{"type":79,"value":230},{"type":68,"tag":192,"props":11213,"children":11214},{"style":369},[11215],{"type":79,"value":4492},{"type":68,"tag":192,"props":11217,"children":11218},{"style":388},[11219],{"type":79,"value":1403},{"type":68,"tag":192,"props":11221,"children":11222},{"class":194,"line":1815},[11223],{"type":68,"tag":192,"props":11224,"children":11225},{"emptyLinePlaceholder":338},[11226],{"type":79,"value":341},{"type":68,"tag":192,"props":11228,"children":11229},{"class":194,"line":2651},[11230,11234,11238,11242,11246,11250,11254],{"type":68,"tag":192,"props":11231,"children":11232},{"style":348},[11233],{"type":79,"value":4458},{"type":68,"tag":192,"props":11235,"children":11236},{"style":304},[11237],{"type":79,"value":5657},{"type":68,"tag":192,"props":11239,"children":11240},{"style":298},[11241],{"type":79,"value":1385},{"type":68,"tag":192,"props":11243,"children":11244},{"style":292},[11245],{"type":79,"value":366},{"type":68,"tag":192,"props":11247,"children":11248},{"style":369},[11249],{"type":79,"value":5018},{"type":68,"tag":192,"props":11251,"children":11252},{"style":388},[11253],{"type":79,"value":376},{"type":68,"tag":192,"props":11255,"children":11256},{"style":298},[11257],{"type":79,"value":381},{"type":68,"tag":192,"props":11259,"children":11260},{"class":194,"line":2715},[11261,11266,11270],{"type":68,"tag":192,"props":11262,"children":11263},{"style":388},[11264],{"type":79,"value":11265},"          github",{"type":68,"tag":192,"props":11267,"children":11268},{"style":298},[11269],{"type":79,"value":396},{"type":68,"tag":192,"props":11271,"children":11272},{"style":298},[11273],{"type":79,"value":634},{"type":68,"tag":192,"props":11275,"children":11276},{"class":194,"line":2727},[11277,11282,11286,11290,11294,11298,11302,11306,11310,11314,11318,11322,11326,11330,11334],{"type":68,"tag":192,"props":11278,"children":11279},{"style":388},[11280],{"type":79,"value":11281},"            transport",{"type":68,"tag":192,"props":11283,"children":11284},{"style":298},[11285],{"type":79,"value":396},{"type":68,"tag":192,"props":11287,"children":11288},{"style":298},[11289],{"type":79,"value":301},{"type":68,"tag":192,"props":11291,"children":11292},{"style":388},[11293],{"type":79,"value":405},{"type":68,"tag":192,"props":11295,"children":11296},{"style":298},[11297],{"type":79,"value":396},{"type":68,"tag":192,"props":11299,"children":11300},{"style":298},[11301],{"type":79,"value":322},{"type":68,"tag":192,"props":11303,"children":11304},{"style":205},[11305],{"type":79,"value":418},{"type":68,"tag":192,"props":11307,"children":11308},{"style":298},[11309],{"type":79,"value":423},{"type":68,"tag":192,"props":11311,"children":11312},{"style":298},[11313],{"type":79,"value":428},{"type":68,"tag":192,"props":11315,"children":11316},{"style":388},[11317],{"type":79,"value":433},{"type":68,"tag":192,"props":11319,"children":11320},{"style":298},[11321],{"type":79,"value":396},{"type":68,"tag":192,"props":11323,"children":11324},{"style":298},[11325],{"type":79,"value":322},{"type":68,"tag":192,"props":11327,"children":11328},{"style":205},[11329],{"type":79,"value":5095},{"type":68,"tag":192,"props":11331,"children":11332},{"style":298},[11333],{"type":79,"value":423},{"type":68,"tag":192,"props":11335,"children":11336},{"style":298},[11337],{"type":79,"value":455},{"type":68,"tag":192,"props":11339,"children":11340},{"class":194,"line":2735},[11341],{"type":68,"tag":192,"props":11342,"children":11343},{"style":298},[11344],{"type":79,"value":4889},{"type":68,"tag":192,"props":11346,"children":11347},{"class":194,"line":2744},[11348,11353,11357],{"type":68,"tag":192,"props":11349,"children":11350},{"style":388},[11351],{"type":79,"value":11352},"          linear",{"type":68,"tag":192,"props":11354,"children":11355},{"style":298},[11356],{"type":79,"value":396},{"type":68,"tag":192,"props":11358,"children":11359},{"style":298},[11360],{"type":79,"value":634},{"type":68,"tag":192,"props":11362,"children":11363},{"class":194,"line":3321},[11364,11368,11372],{"type":68,"tag":192,"props":11365,"children":11366},{"style":388},[11367],{"type":79,"value":11281},{"type":68,"tag":192,"props":11369,"children":11370},{"style":298},[11371],{"type":79,"value":396},{"type":68,"tag":192,"props":11373,"children":11374},{"style":298},[11375],{"type":79,"value":634},{"type":68,"tag":192,"props":11377,"children":11378},{"class":194,"line":3339},[11379,11384,11388,11392,11396,11400],{"type":68,"tag":192,"props":11380,"children":11381},{"style":388},[11382],{"type":79,"value":11383},"              type",{"type":68,"tag":192,"props":11385,"children":11386},{"style":298},[11387],{"type":79,"value":396},{"type":68,"tag":192,"props":11389,"children":11390},{"style":298},[11391],{"type":79,"value":322},{"type":68,"tag":192,"props":11393,"children":11394},{"style":205},[11395],{"type":79,"value":418},{"type":68,"tag":192,"props":11397,"children":11398},{"style":298},[11399],{"type":79,"value":423},{"type":68,"tag":192,"props":11401,"children":11402},{"style":298},[11403],{"type":79,"value":663},{"type":68,"tag":192,"props":11405,"children":11406},{"class":194,"line":3347},[11407,11412,11416,11420,11424,11428],{"type":68,"tag":192,"props":11408,"children":11409},{"style":388},[11410],{"type":79,"value":11411},"              url",{"type":68,"tag":192,"props":11413,"children":11414},{"style":298},[11415],{"type":79,"value":396},{"type":68,"tag":192,"props":11417,"children":11418},{"style":298},[11419],{"type":79,"value":322},{"type":68,"tag":192,"props":11421,"children":11422},{"style":205},[11423],{"type":79,"value":5176},{"type":68,"tag":192,"props":11425,"children":11426},{"style":298},[11427],{"type":79,"value":423},{"type":68,"tag":192,"props":11429,"children":11430},{"style":298},[11431],{"type":79,"value":663},{"type":68,"tag":192,"props":11433,"children":11434},{"class":194,"line":3356},[11435,11440,11444],{"type":68,"tag":192,"props":11436,"children":11437},{"style":388},[11438],{"type":79,"value":11439},"              headers",{"type":68,"tag":192,"props":11441,"children":11442},{"style":298},[11443],{"type":79,"value":396},{"type":68,"tag":192,"props":11445,"children":11446},{"style":298},[11447],{"type":79,"value":634},{"type":68,"tag":192,"props":11449,"children":11450},{"class":194,"line":3388},[11451,11456,11460,11465,11470,11475,11480,11484,11488,11492,11497,11501,11506],{"type":68,"tag":192,"props":11452,"children":11453},{"style":388},[11454],{"type":79,"value":11455},"                Authorization",{"type":68,"tag":192,"props":11457,"children":11458},{"style":298},[11459],{"type":79,"value":396},{"type":68,"tag":192,"props":11461,"children":11462},{"style":298},[11463],{"type":79,"value":11464}," `",{"type":68,"tag":192,"props":11466,"children":11467},{"style":205},[11468],{"type":79,"value":11469},"Bearer ",{"type":68,"tag":192,"props":11471,"children":11472},{"style":298},[11473],{"type":79,"value":11474},"${",{"type":68,"tag":192,"props":11476,"children":11477},{"style":304},[11478],{"type":79,"value":11479},"process",{"type":68,"tag":192,"props":11481,"children":11482},{"style":298},[11483],{"type":79,"value":230},{"type":68,"tag":192,"props":11485,"children":11486},{"style":304},[11487],{"type":79,"value":1202},{"type":68,"tag":192,"props":11489,"children":11490},{"style":298},[11491],{"type":79,"value":230},{"type":68,"tag":192,"props":11493,"children":11494},{"style":304},[11495],{"type":79,"value":11496},"LINEAR_KEY ",{"type":68,"tag":192,"props":11498,"children":11499},{"style":298},[11500],{"type":79,"value":1216},{"type":68,"tag":192,"props":11502,"children":11503},{"style":298},[11504],{"type":79,"value":11505}," ''}`",{"type":68,"tag":192,"props":11507,"children":11508},{"style":298},[11509],{"type":79,"value":663},{"type":68,"tag":192,"props":11511,"children":11512},{"class":194,"line":3452},[11513],{"type":68,"tag":192,"props":11514,"children":11515},{"style":298},[11516],{"type":79,"value":11517},"              },\n",{"type":68,"tag":192,"props":11519,"children":11520},{"class":194,"line":3464},[11521],{"type":68,"tag":192,"props":11522,"children":11523},{"style":298},[11524],{"type":79,"value":4881},{"type":68,"tag":192,"props":11526,"children":11527},{"class":194,"line":3477},[11528],{"type":68,"tag":192,"props":11529,"children":11530},{"style":298},[11531],{"type":79,"value":4889},{"type":68,"tag":192,"props":11533,"children":11534},{"class":194,"line":3507},[11535,11539],{"type":68,"tag":192,"props":11536,"children":11537},{"style":298},[11538],{"type":79,"value":4607},{"type":68,"tag":192,"props":11540,"children":11541},{"style":388},[11542],{"type":79,"value":540},{"type":68,"tag":192,"props":11544,"children":11545},{"class":194,"line":3548},[11546],{"type":68,"tag":192,"props":11547,"children":11548},{"emptyLinePlaceholder":338},[11549],{"type":79,"value":341},{"type":68,"tag":192,"props":11551,"children":11552},{"class":194,"line":3561},[11553,11557,11561,11565,11569,11573],{"type":68,"tag":192,"props":11554,"children":11555},{"style":348},[11556],{"type":79,"value":4458},{"type":68,"tag":192,"props":11558,"children":11559},{"style":304},[11560],{"type":79,"value":3488},{"type":68,"tag":192,"props":11562,"children":11563},{"style":298},[11564],{"type":79,"value":1385},{"type":68,"tag":192,"props":11566,"children":11567},{"style":369},[11568],{"type":79,"value":1979},{"type":68,"tag":192,"props":11570,"children":11571},{"style":388},[11572],{"type":79,"value":376},{"type":68,"tag":192,"props":11574,"children":11575},{"style":298},[11576],{"type":79,"value":381},{"type":68,"tag":192,"props":11578,"children":11579},{"class":194,"line":3598},[11580,11584,11588,11592,11596,11600,11604,11608,11612],{"type":68,"tag":192,"props":11581,"children":11582},{"style":388},[11583],{"type":79,"value":4653},{"type":68,"tag":192,"props":11585,"children":11586},{"style":298},[11587],{"type":79,"value":396},{"type":68,"tag":192,"props":11589,"children":11590},{"style":369},[11591],{"type":79,"value":2004},{"type":68,"tag":192,"props":11593,"children":11594},{"style":388},[11595],{"type":79,"value":376},{"type":68,"tag":192,"props":11597,"children":11598},{"style":298},[11599],{"type":79,"value":423},{"type":68,"tag":192,"props":11601,"children":11602},{"style":205},[11603],{"type":79,"value":2017},{"type":68,"tag":192,"props":11605,"children":11606},{"style":298},[11607],{"type":79,"value":423},{"type":68,"tag":192,"props":11609,"children":11610},{"style":388},[11611],{"type":79,"value":1239},{"type":68,"tag":192,"props":11613,"children":11614},{"style":298},[11615],{"type":79,"value":663},{"type":68,"tag":192,"props":11617,"children":11618},{"class":194,"line":3610},[11619,11623],{"type":68,"tag":192,"props":11620,"children":11621},{"style":304},[11622],{"type":79,"value":4693},{"type":68,"tag":192,"props":11624,"children":11625},{"style":298},[11626],{"type":79,"value":663},{"type":68,"tag":192,"props":11628,"children":11629},{"class":194,"line":3655},[11630,11635,11639,11643,11647,11651,11655,11659],{"type":68,"tag":192,"props":11631,"children":11632},{"style":388},[11633],{"type":79,"value":11634},"          tools",{"type":68,"tag":192,"props":11636,"children":11637},{"style":298},[11638],{"type":79,"value":396},{"type":68,"tag":192,"props":11640,"children":11641},{"style":292},[11642],{"type":79,"value":366},{"type":68,"tag":192,"props":11644,"children":11645},{"style":304},[11646],{"type":79,"value":5657},{"type":68,"tag":192,"props":11648,"children":11649},{"style":298},[11650],{"type":79,"value":230},{"type":68,"tag":192,"props":11652,"children":11653},{"style":369},[11654],{"type":79,"value":1939},{"type":68,"tag":192,"props":11656,"children":11657},{"style":388},[11658],{"type":79,"value":2558},{"type":68,"tag":192,"props":11660,"children":11661},{"style":298},[11662],{"type":79,"value":663},{"type":68,"tag":192,"props":11664,"children":11665},{"class":194,"line":3664},[11666],{"type":68,"tag":192,"props":11667,"children":11668},{"style":488},[11669],{"type":79,"value":11670},"          \u002F\u002F Close after the run ends — tools execute while the response streams,\n",{"type":68,"tag":192,"props":11672,"children":11673},{"class":194,"line":3673},[11674],{"type":68,"tag":192,"props":11675,"children":11676},{"style":488},[11677],{"type":79,"value":11678},"          \u002F\u002F so `await using` \u002F try-finally would close the pool too early here.\n",{"type":68,"tag":192,"props":11680,"children":11681},{"class":194,"line":3690},[11682,11687,11691],{"type":68,"tag":192,"props":11683,"children":11684},{"style":388},[11685],{"type":79,"value":11686},"          middleware",{"type":68,"tag":192,"props":11688,"children":11689},{"style":298},[11690],{"type":79,"value":396},{"type":68,"tag":192,"props":11692,"children":11693},{"style":388},[11694],{"type":79,"value":3127},{"type":68,"tag":192,"props":11696,"children":11697},{"class":194,"line":3715},[11698],{"type":68,"tag":192,"props":11699,"children":11700},{"style":298},[11701],{"type":79,"value":11702},"            {\n",{"type":68,"tag":192,"props":11704,"children":11705},{"class":194,"line":3724},[11706,11711,11715,11719,11723,11727],{"type":68,"tag":192,"props":11707,"children":11708},{"style":388},[11709],{"type":79,"value":11710},"              name",{"type":68,"tag":192,"props":11712,"children":11713},{"style":298},[11714],{"type":79,"value":396},{"type":68,"tag":192,"props":11716,"children":11717},{"style":298},[11718],{"type":79,"value":322},{"type":68,"tag":192,"props":11720,"children":11721},{"style":205},[11722],{"type":79,"value":3156},{"type":68,"tag":192,"props":11724,"children":11725},{"style":298},[11726],{"type":79,"value":423},{"type":68,"tag":192,"props":11728,"children":11729},{"style":298},[11730],{"type":79,"value":663},{"type":68,"tag":192,"props":11732,"children":11733},{"class":194,"line":3732},[11734,11739,11743,11747,11751,11755,11759,11763,11767],{"type":68,"tag":192,"props":11735,"children":11736},{"style":369},[11737],{"type":79,"value":11738},"              onFinish",{"type":68,"tag":192,"props":11740,"children":11741},{"style":298},[11742],{"type":79,"value":396},{"type":68,"tag":192,"props":11744,"children":11745},{"style":298},[11746],{"type":79,"value":3181},{"type":68,"tag":192,"props":11748,"children":11749},{"style":348},[11750],{"type":79,"value":3186},{"type":68,"tag":192,"props":11752,"children":11753},{"style":304},[11754],{"type":79,"value":5657},{"type":68,"tag":192,"props":11756,"children":11757},{"style":298},[11758],{"type":79,"value":230},{"type":68,"tag":192,"props":11760,"children":11761},{"style":369},[11762],{"type":79,"value":3199},{"type":68,"tag":192,"props":11764,"children":11765},{"style":388},[11766],{"type":79,"value":2558},{"type":68,"tag":192,"props":11768,"children":11769},{"style":298},[11770],{"type":79,"value":663},{"type":68,"tag":192,"props":11772,"children":11773},{"class":194,"line":3741},[11774,11779,11783,11787,11791,11795,11799,11803,11807],{"type":68,"tag":192,"props":11775,"children":11776},{"style":369},[11777],{"type":79,"value":11778},"              onAbort",{"type":68,"tag":192,"props":11780,"children":11781},{"style":298},[11782],{"type":79,"value":396},{"type":68,"tag":192,"props":11784,"children":11785},{"style":298},[11786],{"type":79,"value":3181},{"type":68,"tag":192,"props":11788,"children":11789},{"style":348},[11790],{"type":79,"value":3186},{"type":68,"tag":192,"props":11792,"children":11793},{"style":304},[11794],{"type":79,"value":5657},{"type":68,"tag":192,"props":11796,"children":11797},{"style":298},[11798],{"type":79,"value":230},{"type":68,"tag":192,"props":11800,"children":11801},{"style":369},[11802],{"type":79,"value":3199},{"type":68,"tag":192,"props":11804,"children":11805},{"style":388},[11806],{"type":79,"value":2558},{"type":68,"tag":192,"props":11808,"children":11809},{"style":298},[11810],{"type":79,"value":663},{"type":68,"tag":192,"props":11812,"children":11813},{"class":194,"line":3750},[11814,11819,11823,11827,11831,11835,11839,11843,11847],{"type":68,"tag":192,"props":11815,"children":11816},{"style":369},[11817],{"type":79,"value":11818},"              onError",{"type":68,"tag":192,"props":11820,"children":11821},{"style":298},[11822],{"type":79,"value":396},{"type":68,"tag":192,"props":11824,"children":11825},{"style":298},[11826],{"type":79,"value":3181},{"type":68,"tag":192,"props":11828,"children":11829},{"style":348},[11830],{"type":79,"value":3186},{"type":68,"tag":192,"props":11832,"children":11833},{"style":304},[11834],{"type":79,"value":5657},{"type":68,"tag":192,"props":11836,"children":11837},{"style":298},[11838],{"type":79,"value":230},{"type":68,"tag":192,"props":11840,"children":11841},{"style":369},[11842],{"type":79,"value":3199},{"type":68,"tag":192,"props":11844,"children":11845},{"style":388},[11846],{"type":79,"value":2558},{"type":68,"tag":192,"props":11848,"children":11849},{"style":298},[11850],{"type":79,"value":663},{"type":68,"tag":192,"props":11852,"children":11853},{"class":194,"line":3782},[11854],{"type":68,"tag":192,"props":11855,"children":11856},{"style":298},[11857],{"type":79,"value":4881},{"type":68,"tag":192,"props":11859,"children":11860},{"class":194,"line":3846},[11861,11866],{"type":68,"tag":192,"props":11862,"children":11863},{"style":388},[11864],{"type":79,"value":11865},"          ]",{"type":68,"tag":192,"props":11867,"children":11868},{"style":298},[11869],{"type":79,"value":663},{"type":68,"tag":192,"props":11871,"children":11872},{"class":194,"line":3858},[11873,11877],{"type":68,"tag":192,"props":11874,"children":11875},{"style":298},[11876],{"type":79,"value":4607},{"type":68,"tag":192,"props":11878,"children":11879},{"style":388},[11880],{"type":79,"value":540},{"type":68,"tag":192,"props":11882,"children":11884},{"class":194,"line":11883},43,[11885],{"type":68,"tag":192,"props":11886,"children":11887},{"emptyLinePlaceholder":338},[11888],{"type":79,"value":341},{"type":68,"tag":192,"props":11890,"children":11892},{"class":194,"line":11891},44,[11893,11897,11901,11905,11909],{"type":68,"tag":192,"props":11894,"children":11895},{"style":292},[11896],{"type":79,"value":4915},{"type":68,"tag":192,"props":11898,"children":11899},{"style":369},[11900],{"type":79,"value":3331},{"type":68,"tag":192,"props":11902,"children":11903},{"style":388},[11904],{"type":79,"value":376},{"type":68,"tag":192,"props":11906,"children":11907},{"style":304},[11908],{"type":79,"value":4928},{"type":68,"tag":192,"props":11910,"children":11911},{"style":388},[11912],{"type":79,"value":540},{"type":68,"tag":192,"props":11914,"children":11916},{"class":194,"line":11915},45,[11917],{"type":68,"tag":192,"props":11918,"children":11919},{"style":298},[11920],{"type":79,"value":4948},{"type":68,"tag":192,"props":11922,"children":11924},{"class":194,"line":11923},46,[11925],{"type":68,"tag":192,"props":11926,"children":11927},{"style":298},[11928],{"type":79,"value":3295},{"type":68,"tag":192,"props":11930,"children":11932},{"class":194,"line":11931},47,[11933],{"type":68,"tag":192,"props":11934,"children":11935},{"style":298},[11936],{"type":79,"value":741},{"type":68,"tag":192,"props":11938,"children":11940},{"class":194,"line":11939},48,[11941,11945],{"type":68,"tag":192,"props":11942,"children":11943},{"style":298},[11944],{"type":79,"value":535},{"type":68,"tag":192,"props":11946,"children":11947},{"style":304},[11948],{"type":79,"value":540},{"type":68,"tag":111,"props":11950,"children":11952},{"id":11951},"common-mistakes",[11953],{"type":79,"value":11954},"Common Mistakes",{"type":68,"tag":568,"props":11956,"children":11958},{"id":11957},"a-high-closing-the-client-before-the-stream-finishes",[11959],{"type":79,"value":11960},"a. HIGH: closing the client before the stream finishes",{"type":68,"tag":82,"props":11962,"children":11963},{},[11964,11969],{"type":68,"tag":74,"props":11965,"children":11967},{"className":11966},[],[11968],{"type":79,"value":107},{"type":79,"value":11970}," executes tools lazily as the model calls them during streaming.\nIf you close the MCP client before the response stream is fully consumed,\nin-flight tool calls will fail.",{"type":68,"tag":82,"props":11972,"children":11973},{},[11974],{"type":79,"value":11975},"Wrong:",{"type":68,"tag":181,"props":11977,"children":11979},{"className":281,"code":11978,"language":45,"meta":186,"style":186},"const tools = await client.tools()\nconst stream = chat({ adapter, messages, tools })\nawait client.close() \u002F\u002F closes before the stream runs tools\nreturn toServerSentEventsResponse(stream)\n",[11980],{"type":68,"tag":74,"props":11981,"children":11982},{"__ignoreMap":186},[11983,12018,12074,12103],{"type":68,"tag":192,"props":11984,"children":11985},{"class":194,"line":195},[11986,11990,11994,11998,12002,12006,12010,12014],{"type":68,"tag":192,"props":11987,"children":11988},{"style":348},[11989],{"type":79,"value":351},{"type":68,"tag":192,"props":11991,"children":11992},{"style":304},[11993],{"type":79,"value":1917},{"type":68,"tag":192,"props":11995,"children":11996},{"style":298},[11997],{"type":79,"value":361},{"type":68,"tag":192,"props":11999,"children":12000},{"style":292},[12001],{"type":79,"value":366},{"type":68,"tag":192,"props":12003,"children":12004},{"style":304},[12005],{"type":79,"value":1930},{"type":68,"tag":192,"props":12007,"children":12008},{"style":298},[12009],{"type":79,"value":230},{"type":68,"tag":192,"props":12011,"children":12012},{"style":369},[12013],{"type":79,"value":1939},{"type":68,"tag":192,"props":12015,"children":12016},{"style":304},[12017],{"type":79,"value":1403},{"type":68,"tag":192,"props":12019,"children":12020},{"class":194,"line":334},[12021,12025,12029,12033,12037,12041,12045,12050,12054,12058,12062,12066,12070],{"type":68,"tag":192,"props":12022,"children":12023},{"style":348},[12024],{"type":79,"value":351},{"type":68,"tag":192,"props":12026,"children":12027},{"style":304},[12028],{"type":79,"value":1970},{"type":68,"tag":192,"props":12030,"children":12031},{"style":298},[12032],{"type":79,"value":361},{"type":68,"tag":192,"props":12034,"children":12035},{"style":369},[12036],{"type":79,"value":1979},{"type":68,"tag":192,"props":12038,"children":12039},{"style":304},[12040],{"type":79,"value":376},{"type":68,"tag":192,"props":12042,"children":12043},{"style":298},[12044],{"type":79,"value":1435},{"type":68,"tag":192,"props":12046,"children":12047},{"style":304},[12048],{"type":79,"value":12049}," adapter",{"type":68,"tag":192,"props":12051,"children":12052},{"style":298},[12053],{"type":79,"value":428},{"type":68,"tag":192,"props":12055,"children":12056},{"style":304},[12057],{"type":79,"value":4467},{"type":68,"tag":192,"props":12059,"children":12060},{"style":298},[12061],{"type":79,"value":428},{"type":68,"tag":192,"props":12063,"children":12064},{"style":304},[12065],{"type":79,"value":1917},{"type":68,"tag":192,"props":12067,"children":12068},{"style":298},[12069],{"type":79,"value":535},{"type":68,"tag":192,"props":12071,"children":12072},{"style":304},[12073],{"type":79,"value":540},{"type":68,"tag":192,"props":12075,"children":12076},{"class":194,"line":344},[12077,12082,12086,12090,12094,12098],{"type":68,"tag":192,"props":12078,"children":12079},{"style":292},[12080],{"type":79,"value":12081},"await",{"type":68,"tag":192,"props":12083,"children":12084},{"style":304},[12085],{"type":79,"value":1930},{"type":68,"tag":192,"props":12087,"children":12088},{"style":298},[12089],{"type":79,"value":230},{"type":68,"tag":192,"props":12091,"children":12092},{"style":369},[12093],{"type":79,"value":3199},{"type":68,"tag":192,"props":12095,"children":12096},{"style":304},[12097],{"type":79,"value":2487},{"type":68,"tag":192,"props":12099,"children":12100},{"style":488},[12101],{"type":79,"value":12102},"\u002F\u002F closes before the stream runs tools\n",{"type":68,"tag":192,"props":12104,"children":12105},{"class":194,"line":384},[12106,12110,12114],{"type":68,"tag":192,"props":12107,"children":12108},{"style":292},[12109],{"type":79,"value":2867},{"type":68,"tag":192,"props":12111,"children":12112},{"style":369},[12113],{"type":79,"value":3331},{"type":68,"tag":192,"props":12115,"children":12116},{"style":304},[12117],{"type":79,"value":3336},{"type":68,"tag":82,"props":12119,"children":12120},{},[12121,12123,12128,12130,12135,12137,12142,12144,12150],{"type":79,"value":12122},"This includes ",{"type":68,"tag":74,"props":12124,"children":12126},{"className":12125},[],[12127],{"type":79,"value":2859},{"type":79,"value":12129}," around the ",{"type":68,"tag":74,"props":12131,"children":12133},{"className":12132},[],[12134],{"type":79,"value":2867},{"type":79,"value":12136},", and ",{"type":68,"tag":74,"props":12138,"children":12140},{"className":12139},[],[12141],{"type":79,"value":2875},{"type":79,"value":12143}," at function\nscope — both close before the returned ",{"type":68,"tag":74,"props":12145,"children":12147},{"className":12146},[],[12148],{"type":79,"value":12149},"Response",{"type":79,"value":12151}," body streams.",{"type":68,"tag":82,"props":12153,"children":12154},{},[12155,12157,12163,12164,12170,12171,12177],{"type":79,"value":12156},"Correct — close in middleware terminal hooks (exactly one of\n",{"type":68,"tag":74,"props":12158,"children":12160},{"className":12159},[],[12161],{"type":79,"value":12162},"onFinish",{"type":79,"value":1497},{"type":68,"tag":74,"props":12165,"children":12167},{"className":12166},[],[12168],{"type":79,"value":12169},"onAbort",{"type":79,"value":1497},{"type":68,"tag":74,"props":12172,"children":12174},{"className":12173},[],[12175],{"type":79,"value":12176},"onError",{"type":79,"value":12178}," fires per run), or consume the stream in scope\nbefore closing:",{"type":68,"tag":181,"props":12180,"children":12182},{"className":281,"code":12181,"language":45,"meta":186,"style":186},"import { chat, toServerSentEventsResponse } from '@tanstack\u002Fai'\nimport { createMCPClient } from '@tanstack\u002Fai-mcp'\n\nconst client = await createMCPClient({\n  transport: { type: 'http', url: '...' },\n})\n\nconst stream = chat({\n  adapter: openaiText('gpt-5.5'),\n  messages,\n  tools: await client.tools(),\n  middleware: [\n    {\n      name: 'mcp-close',\n      onFinish: () => client.close(),\n      onAbort: () => client.close(),\n      onError: () => client.close(),\n    },\n  ],\n})\nreturn toServerSentEventsResponse(stream)\n",[12183],{"type":68,"tag":74,"props":12184,"children":12185},{"__ignoreMap":186},[12186,12229,12264,12271,12302,12365,12376,12383,12410,12449,12460,12495,12510,12517,12544,12583,12622,12661,12668,12679,12690],{"type":68,"tag":192,"props":12187,"children":12188},{"class":194,"line":195},[12189,12193,12197,12201,12205,12209,12213,12217,12221,12225],{"type":68,"tag":192,"props":12190,"children":12191},{"style":292},[12192],{"type":79,"value":295},{"type":68,"tag":192,"props":12194,"children":12195},{"style":298},[12196],{"type":79,"value":301},{"type":68,"tag":192,"props":12198,"children":12199},{"style":304},[12200],{"type":79,"value":1979},{"type":68,"tag":192,"props":12202,"children":12203},{"style":298},[12204],{"type":79,"value":428},{"type":68,"tag":192,"props":12206,"children":12207},{"style":304},[12208],{"type":79,"value":3331},{"type":68,"tag":192,"props":12210,"children":12211},{"style":298},[12212],{"type":79,"value":312},{"type":68,"tag":192,"props":12214,"children":12215},{"style":292},[12216],{"type":79,"value":317},{"type":68,"tag":192,"props":12218,"children":12219},{"style":298},[12220],{"type":79,"value":322},{"type":68,"tag":192,"props":12222,"children":12223},{"style":205},[12224],{"type":79,"value":2259},{"type":68,"tag":192,"props":12226,"children":12227},{"style":298},[12228],{"type":79,"value":331},{"type":68,"tag":192,"props":12230,"children":12231},{"class":194,"line":334},[12232,12236,12240,12244,12248,12252,12256,12260],{"type":68,"tag":192,"props":12233,"children":12234},{"style":292},[12235],{"type":79,"value":295},{"type":68,"tag":192,"props":12237,"children":12238},{"style":298},[12239],{"type":79,"value":301},{"type":68,"tag":192,"props":12241,"children":12242},{"style":304},[12243],{"type":79,"value":307},{"type":68,"tag":192,"props":12245,"children":12246},{"style":298},[12247],{"type":79,"value":312},{"type":68,"tag":192,"props":12249,"children":12250},{"style":292},[12251],{"type":79,"value":317},{"type":68,"tag":192,"props":12253,"children":12254},{"style":298},[12255],{"type":79,"value":322},{"type":68,"tag":192,"props":12257,"children":12258},{"style":205},[12259],{"type":79,"value":80},{"type":68,"tag":192,"props":12261,"children":12262},{"style":298},[12263],{"type":79,"value":331},{"type":68,"tag":192,"props":12265,"children":12266},{"class":194,"line":344},[12267],{"type":68,"tag":192,"props":12268,"children":12269},{"emptyLinePlaceholder":338},[12270],{"type":79,"value":341},{"type":68,"tag":192,"props":12272,"children":12273},{"class":194,"line":384},[12274,12278,12282,12286,12290,12294,12298],{"type":68,"tag":192,"props":12275,"children":12276},{"style":348},[12277],{"type":79,"value":351},{"type":68,"tag":192,"props":12279,"children":12280},{"style":304},[12281],{"type":79,"value":356},{"type":68,"tag":192,"props":12283,"children":12284},{"style":298},[12285],{"type":79,"value":361},{"type":68,"tag":192,"props":12287,"children":12288},{"style":292},[12289],{"type":79,"value":366},{"type":68,"tag":192,"props":12291,"children":12292},{"style":369},[12293],{"type":79,"value":307},{"type":68,"tag":192,"props":12295,"children":12296},{"style":304},[12297],{"type":79,"value":376},{"type":68,"tag":192,"props":12299,"children":12300},{"style":298},[12301],{"type":79,"value":381},{"type":68,"tag":192,"props":12303,"children":12304},{"class":194,"line":458},[12305,12309,12313,12317,12321,12325,12329,12333,12337,12341,12345,12349,12353,12357,12361],{"type":68,"tag":192,"props":12306,"children":12307},{"style":388},[12308],{"type":79,"value":391},{"type":68,"tag":192,"props":12310,"children":12311},{"style":298},[12312],{"type":79,"value":396},{"type":68,"tag":192,"props":12314,"children":12315},{"style":298},[12316],{"type":79,"value":301},{"type":68,"tag":192,"props":12318,"children":12319},{"style":388},[12320],{"type":79,"value":405},{"type":68,"tag":192,"props":12322,"children":12323},{"style":298},[12324],{"type":79,"value":396},{"type":68,"tag":192,"props":12326,"children":12327},{"style":298},[12328],{"type":79,"value":322},{"type":68,"tag":192,"props":12330,"children":12331},{"style":205},[12332],{"type":79,"value":418},{"type":68,"tag":192,"props":12334,"children":12335},{"style":298},[12336],{"type":79,"value":423},{"type":68,"tag":192,"props":12338,"children":12339},{"style":298},[12340],{"type":79,"value":428},{"type":68,"tag":192,"props":12342,"children":12343},{"style":388},[12344],{"type":79,"value":433},{"type":68,"tag":192,"props":12346,"children":12347},{"style":298},[12348],{"type":79,"value":396},{"type":68,"tag":192,"props":12350,"children":12351},{"style":298},[12352],{"type":79,"value":322},{"type":68,"tag":192,"props":12354,"children":12355},{"style":205},[12356],{"type":79,"value":2979},{"type":68,"tag":192,"props":12358,"children":12359},{"style":298},[12360],{"type":79,"value":423},{"type":68,"tag":192,"props":12362,"children":12363},{"style":298},[12364],{"type":79,"value":455},{"type":68,"tag":192,"props":12366,"children":12367},{"class":194,"line":494},[12368,12372],{"type":68,"tag":192,"props":12369,"children":12370},{"style":298},[12371],{"type":79,"value":535},{"type":68,"tag":192,"props":12373,"children":12374},{"style":304},[12375],{"type":79,"value":540},{"type":68,"tag":192,"props":12377,"children":12378},{"class":194,"line":529},[12379],{"type":68,"tag":192,"props":12380,"children":12381},{"emptyLinePlaceholder":338},[12382],{"type":79,"value":341},{"type":68,"tag":192,"props":12384,"children":12385},{"class":194,"line":1165},[12386,12390,12394,12398,12402,12406],{"type":68,"tag":192,"props":12387,"children":12388},{"style":348},[12389],{"type":79,"value":351},{"type":68,"tag":192,"props":12391,"children":12392},{"style":304},[12393],{"type":79,"value":1970},{"type":68,"tag":192,"props":12395,"children":12396},{"style":298},[12397],{"type":79,"value":361},{"type":68,"tag":192,"props":12399,"children":12400},{"style":369},[12401],{"type":79,"value":1979},{"type":68,"tag":192,"props":12403,"children":12404},{"style":304},[12405],{"type":79,"value":376},{"type":68,"tag":192,"props":12407,"children":12408},{"style":298},[12409],{"type":79,"value":381},{"type":68,"tag":192,"props":12411,"children":12412},{"class":194,"line":1228},[12413,12417,12421,12425,12429,12433,12437,12441,12445],{"type":68,"tag":192,"props":12414,"children":12415},{"style":388},[12416],{"type":79,"value":1995},{"type":68,"tag":192,"props":12418,"children":12419},{"style":298},[12420],{"type":79,"value":396},{"type":68,"tag":192,"props":12422,"children":12423},{"style":369},[12424],{"type":79,"value":2004},{"type":68,"tag":192,"props":12426,"children":12427},{"style":304},[12428],{"type":79,"value":376},{"type":68,"tag":192,"props":12430,"children":12431},{"style":298},[12432],{"type":79,"value":423},{"type":68,"tag":192,"props":12434,"children":12435},{"style":205},[12436],{"type":79,"value":2017},{"type":68,"tag":192,"props":12438,"children":12439},{"style":298},[12440],{"type":79,"value":423},{"type":68,"tag":192,"props":12442,"children":12443},{"style":304},[12444],{"type":79,"value":1239},{"type":68,"tag":192,"props":12446,"children":12447},{"style":298},[12448],{"type":79,"value":663},{"type":68,"tag":192,"props":12450,"children":12451},{"class":194,"line":1246},[12452,12456],{"type":68,"tag":192,"props":12453,"children":12454},{"style":304},[12455],{"type":79,"value":2037},{"type":68,"tag":192,"props":12457,"children":12458},{"style":298},[12459],{"type":79,"value":663},{"type":68,"tag":192,"props":12461,"children":12462},{"class":194,"line":1807},[12463,12467,12471,12475,12479,12483,12487,12491],{"type":68,"tag":192,"props":12464,"children":12465},{"style":388},[12466],{"type":79,"value":2049},{"type":68,"tag":192,"props":12468,"children":12469},{"style":298},[12470],{"type":79,"value":396},{"type":68,"tag":192,"props":12472,"children":12473},{"style":292},[12474],{"type":79,"value":366},{"type":68,"tag":192,"props":12476,"children":12477},{"style":304},[12478],{"type":79,"value":1930},{"type":68,"tag":192,"props":12480,"children":12481},{"style":298},[12482],{"type":79,"value":230},{"type":68,"tag":192,"props":12484,"children":12485},{"style":369},[12486],{"type":79,"value":1939},{"type":68,"tag":192,"props":12488,"children":12489},{"style":304},[12490],{"type":79,"value":2558},{"type":68,"tag":192,"props":12492,"children":12493},{"style":298},[12494],{"type":79,"value":663},{"type":68,"tag":192,"props":12496,"children":12497},{"class":194,"line":1815},[12498,12502,12506],{"type":68,"tag":192,"props":12499,"children":12500},{"style":388},[12501],{"type":79,"value":3118},{"type":68,"tag":192,"props":12503,"children":12504},{"style":298},[12505],{"type":79,"value":396},{"type":68,"tag":192,"props":12507,"children":12508},{"style":304},[12509],{"type":79,"value":3127},{"type":68,"tag":192,"props":12511,"children":12512},{"class":194,"line":2651},[12513],{"type":68,"tag":192,"props":12514,"children":12515},{"style":298},[12516],{"type":79,"value":3135},{"type":68,"tag":192,"props":12518,"children":12519},{"class":194,"line":2715},[12520,12524,12528,12532,12536,12540],{"type":68,"tag":192,"props":12521,"children":12522},{"style":388},[12523],{"type":79,"value":3143},{"type":68,"tag":192,"props":12525,"children":12526},{"style":298},[12527],{"type":79,"value":396},{"type":68,"tag":192,"props":12529,"children":12530},{"style":298},[12531],{"type":79,"value":322},{"type":68,"tag":192,"props":12533,"children":12534},{"style":205},[12535],{"type":79,"value":3156},{"type":68,"tag":192,"props":12537,"children":12538},{"style":298},[12539],{"type":79,"value":423},{"type":68,"tag":192,"props":12541,"children":12542},{"style":298},[12543],{"type":79,"value":663},{"type":68,"tag":192,"props":12545,"children":12546},{"class":194,"line":2727},[12547,12551,12555,12559,12563,12567,12571,12575,12579],{"type":68,"tag":192,"props":12548,"children":12549},{"style":369},[12550],{"type":79,"value":3172},{"type":68,"tag":192,"props":12552,"children":12553},{"style":298},[12554],{"type":79,"value":396},{"type":68,"tag":192,"props":12556,"children":12557},{"style":298},[12558],{"type":79,"value":3181},{"type":68,"tag":192,"props":12560,"children":12561},{"style":348},[12562],{"type":79,"value":3186},{"type":68,"tag":192,"props":12564,"children":12565},{"style":304},[12566],{"type":79,"value":1930},{"type":68,"tag":192,"props":12568,"children":12569},{"style":298},[12570],{"type":79,"value":230},{"type":68,"tag":192,"props":12572,"children":12573},{"style":369},[12574],{"type":79,"value":3199},{"type":68,"tag":192,"props":12576,"children":12577},{"style":304},[12578],{"type":79,"value":2558},{"type":68,"tag":192,"props":12580,"children":12581},{"style":298},[12582],{"type":79,"value":663},{"type":68,"tag":192,"props":12584,"children":12585},{"class":194,"line":2735},[12586,12590,12594,12598,12602,12606,12610,12614,12618],{"type":68,"tag":192,"props":12587,"children":12588},{"style":369},[12589],{"type":79,"value":3215},{"type":68,"tag":192,"props":12591,"children":12592},{"style":298},[12593],{"type":79,"value":396},{"type":68,"tag":192,"props":12595,"children":12596},{"style":298},[12597],{"type":79,"value":3181},{"type":68,"tag":192,"props":12599,"children":12600},{"style":348},[12601],{"type":79,"value":3186},{"type":68,"tag":192,"props":12603,"children":12604},{"style":304},[12605],{"type":79,"value":1930},{"type":68,"tag":192,"props":12607,"children":12608},{"style":298},[12609],{"type":79,"value":230},{"type":68,"tag":192,"props":12611,"children":12612},{"style":369},[12613],{"type":79,"value":3199},{"type":68,"tag":192,"props":12615,"children":12616},{"style":304},[12617],{"type":79,"value":2558},{"type":68,"tag":192,"props":12619,"children":12620},{"style":298},[12621],{"type":79,"value":663},{"type":68,"tag":192,"props":12623,"children":12624},{"class":194,"line":2744},[12625,12629,12633,12637,12641,12645,12649,12653,12657],{"type":68,"tag":192,"props":12626,"children":12627},{"style":369},[12628],{"type":79,"value":3255},{"type":68,"tag":192,"props":12630,"children":12631},{"style":298},[12632],{"type":79,"value":396},{"type":68,"tag":192,"props":12634,"children":12635},{"style":298},[12636],{"type":79,"value":3181},{"type":68,"tag":192,"props":12638,"children":12639},{"style":348},[12640],{"type":79,"value":3186},{"type":68,"tag":192,"props":12642,"children":12643},{"style":304},[12644],{"type":79,"value":1930},{"type":68,"tag":192,"props":12646,"children":12647},{"style":298},[12648],{"type":79,"value":230},{"type":68,"tag":192,"props":12650,"children":12651},{"style":369},[12652],{"type":79,"value":3199},{"type":68,"tag":192,"props":12654,"children":12655},{"style":304},[12656],{"type":79,"value":2558},{"type":68,"tag":192,"props":12658,"children":12659},{"style":298},[12660],{"type":79,"value":663},{"type":68,"tag":192,"props":12662,"children":12663},{"class":194,"line":3321},[12664],{"type":68,"tag":192,"props":12665,"children":12666},{"style":298},[12667],{"type":79,"value":3295},{"type":68,"tag":192,"props":12669,"children":12670},{"class":194,"line":3339},[12671,12675],{"type":68,"tag":192,"props":12672,"children":12673},{"style":304},[12674],{"type":79,"value":3303},{"type":68,"tag":192,"props":12676,"children":12677},{"style":298},[12678],{"type":79,"value":663},{"type":68,"tag":192,"props":12680,"children":12681},{"class":194,"line":3347},[12682,12686],{"type":68,"tag":192,"props":12683,"children":12684},{"style":298},[12685],{"type":79,"value":535},{"type":68,"tag":192,"props":12687,"children":12688},{"style":304},[12689],{"type":79,"value":540},{"type":68,"tag":192,"props":12691,"children":12692},{"class":194,"line":3356},[12693,12697,12701],{"type":68,"tag":192,"props":12694,"children":12695},{"style":292},[12696],{"type":79,"value":2867},{"type":68,"tag":192,"props":12698,"children":12699},{"style":369},[12700],{"type":79,"value":3331},{"type":68,"tag":192,"props":12702,"children":12703},{"style":304},[12704],{"type":79,"value":3336},{"type":68,"tag":568,"props":12706,"children":12708},{"id":12707},"b-high-importing-stdiotransport-from-the-main-entry-point",[12709,12711,12716],{"type":79,"value":12710},"b. HIGH: importing ",{"type":68,"tag":74,"props":12712,"children":12714},{"className":12713},[],[12715],{"type":79,"value":265},{"type":79,"value":12717}," from the main entry point",{"type":68,"tag":82,"props":12719,"children":12720},{},[12721,12726,12728,12733,12735,12740],{"type":68,"tag":74,"props":12722,"children":12724},{"className":12723},[],[12725],{"type":79,"value":265},{"type":79,"value":12727}," is only available from ",{"type":68,"tag":74,"props":12729,"children":12731},{"className":12730},[],[12732],{"type":79,"value":1012},{"type":79,"value":12734},". Importing it\nfrom ",{"type":68,"tag":74,"props":12736,"children":12738},{"className":12737},[],[12739],{"type":79,"value":80},{"type":79,"value":12741}," will fail with a module-not-found error and would\nbundle Node.js child-process code into edge bundles.",{"type":68,"tag":82,"props":12743,"children":12744},{},[12745],{"type":79,"value":11975},{"type":68,"tag":181,"props":12747,"children":12749},{"className":281,"code":12748,"language":45,"meta":186,"style":186},"import { stdioTransport } from '@tanstack\u002Fai-mcp' \u002F\u002F does not exist here\n",[12750],{"type":68,"tag":74,"props":12751,"children":12752},{"__ignoreMap":186},[12753],{"type":68,"tag":192,"props":12754,"children":12755},{"class":194,"line":195},[12756,12760,12764,12768,12772,12776,12780,12784,12788],{"type":68,"tag":192,"props":12757,"children":12758},{"style":292},[12759],{"type":79,"value":295},{"type":68,"tag":192,"props":12761,"children":12762},{"style":298},[12763],{"type":79,"value":301},{"type":68,"tag":192,"props":12765,"children":12766},{"style":304},[12767],{"type":79,"value":995},{"type":68,"tag":192,"props":12769,"children":12770},{"style":298},[12771],{"type":79,"value":312},{"type":68,"tag":192,"props":12773,"children":12774},{"style":292},[12775],{"type":79,"value":317},{"type":68,"tag":192,"props":12777,"children":12778},{"style":298},[12779],{"type":79,"value":322},{"type":68,"tag":192,"props":12781,"children":12782},{"style":205},[12783],{"type":79,"value":80},{"type":68,"tag":192,"props":12785,"children":12786},{"style":298},[12787],{"type":79,"value":423},{"type":68,"tag":192,"props":12789,"children":12790},{"style":488},[12791],{"type":79,"value":12792}," \u002F\u002F does not exist here\n",{"type":68,"tag":82,"props":12794,"children":12795},{},[12796],{"type":79,"value":12797},"Correct:",{"type":68,"tag":181,"props":12799,"children":12801},{"className":281,"code":12800,"language":45,"meta":186,"style":186},"import { stdioTransport } from '@tanstack\u002Fai-mcp\u002Fstdio'\n",[12802],{"type":68,"tag":74,"props":12803,"children":12804},{"__ignoreMap":186},[12805],{"type":68,"tag":192,"props":12806,"children":12807},{"class":194,"line":195},[12808,12812,12816,12820,12824,12828,12832,12836],{"type":68,"tag":192,"props":12809,"children":12810},{"style":292},[12811],{"type":79,"value":295},{"type":68,"tag":192,"props":12813,"children":12814},{"style":298},[12815],{"type":79,"value":301},{"type":68,"tag":192,"props":12817,"children":12818},{"style":304},[12819],{"type":79,"value":995},{"type":68,"tag":192,"props":12821,"children":12822},{"style":298},[12823],{"type":79,"value":312},{"type":68,"tag":192,"props":12825,"children":12826},{"style":292},[12827],{"type":79,"value":317},{"type":68,"tag":192,"props":12829,"children":12830},{"style":298},[12831],{"type":79,"value":322},{"type":68,"tag":192,"props":12833,"children":12834},{"style":205},[12835],{"type":79,"value":1012},{"type":68,"tag":192,"props":12837,"children":12838},{"style":298},[12839],{"type":79,"value":331},{"type":68,"tag":568,"props":12841,"children":12843},{"id":12842},"c-medium-using-clienttoolsdefs-without-matching-names",[12844,12846,12851],{"type":79,"value":12845},"c. MEDIUM: using ",{"type":68,"tag":74,"props":12847,"children":12849},{"className":12848},[],[12850],{"type":79,"value":10620},{"type":79,"value":12852}," without matching names",{"type":68,"tag":82,"props":12854,"children":12855},{},[12856,12858,12863,12865,12870],{"type":79,"value":12857},"The name field on each ",{"type":68,"tag":74,"props":12859,"children":12861},{"className":12860},[],[12862],{"type":79,"value":2164},{"type":79,"value":12864}," must exactly match the tool name the MCP\nserver exposes. Mismatches throw ",{"type":68,"tag":74,"props":12866,"children":12868},{"className":12867},[],[12869],{"type":79,"value":2217},{"type":79,"value":12871}," at call time, not at\ntype-check time (unless generated types are in use).",{"type":68,"tag":568,"props":12873,"children":12875},{"id":12874},"d-medium-not-setting-a-prefix-when-multiple-servers-share-tool-names",[12876],{"type":79,"value":12877},"d. MEDIUM: not setting a prefix when multiple servers share tool names",{"type":68,"tag":82,"props":12879,"children":12880},{},[12881],{"type":79,"value":12882},"Two different errors can arise depending on where the collision is detected:",{"type":68,"tag":130,"props":12884,"children":12885},{},[12886,12924],{"type":68,"tag":134,"props":12887,"children":12888},{},[12889,12900,12902,12908,12910,12915,12917,12922],{"type":68,"tag":1476,"props":12890,"children":12891},{},[12892,12894,12899],{"type":79,"value":12893},"Within a single ",{"type":68,"tag":74,"props":12895,"children":12897},{"className":12896},[],[12898],{"type":79,"value":246},{"type":79,"value":5657},{"type":79,"value":12901}," — calling ",{"type":68,"tag":74,"props":12903,"children":12905},{"className":12904},[],[12906],{"type":79,"value":12907},"pool.tools()",{"type":79,"value":12909}," throws\n",{"type":68,"tag":74,"props":12911,"children":12913},{"className":12912},[],[12914],{"type":79,"value":10686},{"type":79,"value":12916}," (from ",{"type":68,"tag":74,"props":12918,"children":12920},{"className":12919},[],[12921],{"type":79,"value":80},{"type":79,"value":12923},") when two servers in that\npool expose the same name with no prefix to separate them.",{"type":68,"tag":134,"props":12925,"children":12926},{},[12927,12944,12946,12951,12952,12957,12958,12963,12965,12970],{"type":68,"tag":1476,"props":12928,"children":12929},{},[12930,12932,12937,12939],{"type":79,"value":12931},"Across separate ",{"type":68,"tag":74,"props":12933,"children":12935},{"className":12934},[],[12936],{"type":79,"value":10725},{"type":79,"value":12938}," entries in ",{"type":68,"tag":74,"props":12940,"children":12942},{"className":12941},[],[12943],{"type":79,"value":107},{"type":79,"value":12945}," — ",{"type":68,"tag":74,"props":12947,"children":12949},{"className":12948},[],[12950],{"type":79,"value":107},{"type":79,"value":12909},{"type":68,"tag":74,"props":12953,"children":12955},{"className":12954},[],[12956],{"type":79,"value":10710},{"type":79,"value":12916},{"type":68,"tag":74,"props":12959,"children":12961},{"className":12960},[],[12962],{"type":79,"value":2259},{"type":79,"value":12964},") after merging discovered\ntools from all ",{"type":68,"tag":74,"props":12966,"children":12968},{"className":12967},[],[12969],{"type":79,"value":10725},{"type":79,"value":12971}," entries.",{"type":68,"tag":82,"props":12973,"children":12974},{},[12975,12977,12982,12984,12989,12991,12996],{"type":79,"value":12976},"In both cases, the fix is the same: use ",{"type":68,"tag":74,"props":12978,"children":12980},{"className":12979},[],[12981],{"type":79,"value":246},{"type":79,"value":12983}," (which auto-prefixes\nby config key) or set an explicit ",{"type":68,"tag":74,"props":12985,"children":12987},{"className":12986},[],[12988],{"type":79,"value":7792},{"type":79,"value":12990}," on each ",{"type":68,"tag":74,"props":12992,"children":12994},{"className":12993},[],[12995],{"type":79,"value":238},{"type":79,"value":12997}," call.",{"type":68,"tag":111,"props":12999,"children":13001},{"id":13000},"cross-references",[13002],{"type":79,"value":13003},"Cross-References",{"type":68,"tag":130,"props":13005,"children":13006},{},[13007,13012],{"type":68,"tag":134,"props":13008,"children":13009},{},[13010],{"type":79,"value":13011},"See also: ai-core\u002Ftool-calling\u002FSKILL.md — MCP tools are ServerTools; all tool\npatterns (approval, lazy, client-side) apply.",{"type":68,"tag":134,"props":13013,"children":13014},{},[13015,13017,13022],{"type":79,"value":13016},"See also: ai-core\u002Fchat-experience\u002FSKILL.md — wiring tools into ",{"type":68,"tag":74,"props":13018,"children":13020},{"className":13019},[],[13021],{"type":79,"value":107},{"type":79,"value":230},{"type":68,"tag":13024,"props":13025,"children":13026},"style",{},[13027],{"type":79,"value":13028},"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":13030,"total":3548},[13031,13048,13061,13076,13089,13103,13117],{"slug":13032,"name":13032,"fn":13033,"description":13034,"org":13035,"tags":13036,"stars":23,"repoUrl":24,"updatedAt":13047},"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":8,"name":9,"logoUrl":10,"githubOrg":9},[13037,13039,13042,13045,13046],{"name":13038,"slug":31,"type":15},"AI SDK",{"name":13040,"slug":13041,"type":15},"Code Execution","code-execution",{"name":13043,"slug":13044,"type":15},"Sandboxing","sandboxing",{"name":9,"slug":8,"type":15},{"name":7203,"slug":45,"type":15},"2026-07-16T06:04:13.597905",{"slug":13049,"name":13049,"fn":13050,"description":13051,"org":13052,"tags":13053,"stars":23,"repoUrl":24,"updatedAt":13060},"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":8,"name":9,"logoUrl":10,"githubOrg":9},[13054,13055,13057],{"name":17,"slug":18,"type":15},{"name":13056,"slug":29,"type":15},"AI",{"name":13058,"slug":13059,"type":15},"Middleware","middleware","2026-07-30T05:26:10.404565",{"slug":13062,"name":13063,"fn":13064,"description":13065,"org":13066,"tags":13067,"stars":23,"repoUrl":24,"updatedAt":13075},"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":8,"name":9,"logoUrl":10,"githubOrg":9},[13068,13069,13072,13074],{"name":13038,"slug":31,"type":15},{"name":13070,"slug":13071,"type":15},"Configuration","configuration",{"name":13073,"slug":37,"type":15},"LLM",{"name":9,"slug":8,"type":15},"2026-07-16T06:04:17.82075",{"slug":13077,"name":13078,"fn":13079,"description":13080,"org":13081,"tags":13082,"stars":23,"repoUrl":24,"updatedAt":13088},"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":8,"name":9,"logoUrl":10,"githubOrg":9},[13083,13086,13087],{"name":13084,"slug":13085,"type":15},"API Development","api-development",{"name":13073,"slug":37,"type":15},{"name":9,"slug":8,"type":15},"2026-07-16T06:04:10.093367",{"slug":13090,"name":13091,"fn":13092,"description":13093,"org":13094,"tags":13095,"stars":23,"repoUrl":24,"updatedAt":13102},"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":8,"name":9,"logoUrl":10,"githubOrg":9},[13096,13097,13100,13101],{"name":13084,"slug":13085,"type":15},{"name":13098,"slug":13099,"type":15},"Frontend","frontend",{"name":13073,"slug":37,"type":15},{"name":9,"slug":8,"type":15},"2026-07-30T05:26:11.505241",{"slug":13104,"name":13105,"fn":13106,"description":13107,"org":13108,"tags":13109,"stars":23,"repoUrl":24,"updatedAt":13116},"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":8,"name":9,"logoUrl":10,"githubOrg":9},[13110,13111,13112,13115],{"name":13056,"slug":29,"type":15},{"name":13098,"slug":13099,"type":15},{"name":13113,"slug":13114,"type":15},"Persistence","persistence",{"name":9,"slug":8,"type":15},"2026-07-30T05:53:35.503176",{"slug":13118,"name":13119,"fn":13120,"description":13121,"org":13122,"tags":13123,"stars":23,"repoUrl":24,"updatedAt":13130},"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":8,"name":9,"logoUrl":10,"githubOrg":9},[13124,13125,13126,13129],{"name":13056,"slug":29,"type":15},{"name":13084,"slug":13085,"type":15},{"name":13127,"slug":13128,"type":15},"Backend","backend",{"name":9,"slug":8,"type":15},"2026-07-17T06:06:39.855351",{"items":13132,"total":13272},[13133,13147,13159,13171,13186,13198,13208,13218,13231,13241,13252,13262],{"slug":13134,"name":13134,"fn":13135,"description":13136,"org":13137,"tags":13138,"stars":13144,"repoUrl":13145,"updatedAt":13146},"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":8,"name":9,"logoUrl":10,"githubOrg":9},[13139,13142,13143],{"name":13140,"slug":13141,"type":15},"Data Analysis","data-analysis",{"name":13098,"slug":13099,"type":15},{"name":9,"slug":8,"type":15},28175,"https:\u002F\u002Fgithub.com\u002FTanStack\u002Ftable","2026-07-30T05:25:59.429787",{"slug":13148,"name":13148,"fn":13149,"description":13150,"org":13151,"tags":13152,"stars":13144,"repoUrl":13145,"updatedAt":13158},"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":8,"name":9,"logoUrl":10,"githubOrg":9},[13153,13156,13157],{"name":13154,"slug":13155,"type":15},"Debugging","debugging",{"name":13098,"slug":13099,"type":15},{"name":9,"slug":8,"type":15},"2026-07-30T05:26:05.418735",{"slug":13160,"name":13160,"fn":13161,"description":13162,"org":13163,"tags":13164,"stars":13144,"repoUrl":13145,"updatedAt":13170},"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":8,"name":9,"logoUrl":10,"githubOrg":9},[13165,13166,13167],{"name":13140,"slug":13141,"type":15},{"name":9,"slug":8,"type":15},{"name":13168,"slug":13169,"type":15},"UI Components","ui-components","2026-07-30T05:25:38.403427",{"slug":13172,"name":13172,"fn":13173,"description":13174,"org":13175,"tags":13176,"stars":13144,"repoUrl":13145,"updatedAt":13185},"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":8,"name":9,"logoUrl":10,"githubOrg":9},[13177,13180,13181,13184],{"name":13178,"slug":13179,"type":15},"Data Pipeline","data-pipeline",{"name":13098,"slug":13099,"type":15},{"name":13182,"slug":13183,"type":15},"Performance","performance",{"name":9,"slug":8,"type":15},"2026-07-30T05:25:45.400104",{"slug":13187,"name":13187,"fn":13188,"description":13189,"org":13190,"tags":13191,"stars":13144,"repoUrl":13145,"updatedAt":13197},"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":8,"name":9,"logoUrl":10,"githubOrg":9},[13192,13195,13196],{"name":13193,"slug":13194,"type":15},"Data Visualization","data-visualization",{"name":13098,"slug":13099,"type":15},{"name":9,"slug":8,"type":15},"2026-07-30T05:25:41.397257",{"slug":13199,"name":13199,"fn":13200,"description":13201,"org":13202,"tags":13203,"stars":13144,"repoUrl":13145,"updatedAt":13207},"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":8,"name":9,"logoUrl":10,"githubOrg":9},[13204,13205,13206],{"name":13140,"slug":13141,"type":15},{"name":13098,"slug":13099,"type":15},{"name":9,"slug":8,"type":15},"2026-07-30T05:25:53.391632",{"slug":13209,"name":13209,"fn":13210,"description":13211,"org":13212,"tags":13213,"stars":13144,"repoUrl":13145,"updatedAt":13217},"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":8,"name":9,"logoUrl":10,"githubOrg":9},[13214,13215,13216],{"name":13098,"slug":13099,"type":15},{"name":9,"slug":8,"type":15},{"name":13168,"slug":13169,"type":15},"2026-07-30T05:26:03.37801",{"slug":13219,"name":13219,"fn":13220,"description":13221,"org":13222,"tags":13223,"stars":13144,"repoUrl":13145,"updatedAt":13230},"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":8,"name":9,"logoUrl":10,"githubOrg":9},[13224,13227,13228,13229],{"name":13225,"slug":13226,"type":15},"CSS","css",{"name":13098,"slug":13099,"type":15},{"name":9,"slug":8,"type":15},{"name":13168,"slug":13169,"type":15},"2026-07-30T05:25:55.377366",{"slug":13232,"name":13232,"fn":13233,"description":13234,"org":13235,"tags":13236,"stars":13144,"repoUrl":13145,"updatedAt":13240},"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":8,"name":9,"logoUrl":10,"githubOrg":9},[13237,13238,13239],{"name":13098,"slug":13099,"type":15},{"name":9,"slug":8,"type":15},{"name":13168,"slug":13169,"type":15},"2026-07-30T05:25:51.400011",{"slug":13242,"name":13242,"fn":13243,"description":13244,"org":13245,"tags":13246,"stars":13144,"repoUrl":13145,"updatedAt":13251},"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":8,"name":9,"logoUrl":10,"githubOrg":9},[13247,13248,13249,13250],{"name":13225,"slug":13226,"type":15},{"name":13098,"slug":13099,"type":15},{"name":9,"slug":8,"type":15},{"name":13168,"slug":13169,"type":15},"2026-07-30T05:25:48.703799",{"slug":13253,"name":13253,"fn":13254,"description":13255,"org":13256,"tags":13257,"stars":13144,"repoUrl":13145,"updatedAt":13261},"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":8,"name":9,"logoUrl":10,"githubOrg":9},[13258,13259,13260],{"name":13098,"slug":13099,"type":15},{"name":9,"slug":8,"type":15},{"name":13168,"slug":13169,"type":15},"2026-07-30T05:25:47.367943",{"slug":13263,"name":13263,"fn":13264,"description":13265,"org":13266,"tags":13267,"stars":13144,"repoUrl":13145,"updatedAt":13271},"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":8,"name":9,"logoUrl":10,"githubOrg":9},[13268,13269,13270],{"name":13140,"slug":13141,"type":15},{"name":13098,"slug":13099,"type":15},{"name":13168,"slug":13169,"type":15},"2026-07-30T05:25:52.366295",125]