Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

brandProviderTool.md

33 lines712 Bytes

1---
2id: brandProviderTool
3title: brandProviderTool
4---
5​
6```ts
7function brandProviderTool<T>(tool): T;
8```
9​
10Defined in: packages/ai/src/tools/provider-tool.ts:35
11​
12Attach the `ProviderTool` phantom brand to a plain `Tool`-shaped object.
13​
14The brand fields (`'~provider'`, `'~toolKind'`) exist only in the type
15system and are never assigned at runtime, so this is a single audited
16type-only assertion. Use it inside adapter `xxxTool()` factories instead
17of `as unknown as` — the cast collapses to one named site.
18​
19## Type Parameters
20​
21### T
22​
23`T` *extends* [`ProviderTool`](../interfaces/ProviderTool.md)\<`string`, `string`\>
24​
25## Parameters
26​
27### tool
28​
29`Omit`\<`T`, `"~provider"` \| `"~toolKind"`\>
30​
31## Returns
32​
33`T`