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

UIResourceEvent.md

134 lines1.9 KB

1---
2id: UIResourceEvent
3title: UIResourceEvent
4---
5​
6Defined in: [packages/ai/src/types.ts:1872](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L1872)
7​
8Emitted when an MCP tool returns a ui:// resource (MCP Apps). Reconciled into
9 a UIResourcePart on the assistant UIMessage. Never enters model input.
10​
11## Extends
12​
13- [`CustomEvent`](CustomEvent.md)
14​
15## Properties
16​
17### metadata?
18​
19```ts
20optional metadata?: Record<string, any>;
21```
22​
23Defined in: [packages/ai/src/types.ts:1789](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L1789)
24​
25Extra information attached to this event.
26​
27#### Inherited from
28​
29[`CustomEvent`](CustomEvent.md).[`metadata`](CustomEvent.md#metadata)
30​
31***
32​
33### name
34​
35```ts
36name: "ui-resource";
37```
38​
39Defined in: [packages/ai/src/types.ts:1873](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L1873)
40​
41What this custom event is. Required: without it a consumer cannot route
42the value.
43​
44#### Overrides
45​
46```ts
47CustomEvent.name
48```
49​
50***
51​
52### type
53​
54```ts
55type: "CUSTOM";
56```
57​
58Defined in: [packages/ai/src/types.ts:1788](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L1788)
59​
60#### Inherited from
61​
62[`CustomEvent`](CustomEvent.md).[`type`](CustomEvent.md#type)
63​
64***
65​
66### value
67​
68```ts
69value: object;
70```
71​
72Defined in: [packages/ai/src/types.ts:1874](https://github.com/TanStack/ai/blob/main/packages/ai/src/types.ts#L1874)
73​
74The payload. Any JSON value, and required.
75​
76#### meta?
77​
78```ts
79optional meta?: Record<string, unknown>;
80```
81​
82#### resource
83​
84```ts
85resource: object;
86```
87​
88##### resource.blob?
89​
90```ts
91optional blob?: string;
92```
93​
94##### resource.mimeType
95​
96```ts
97mimeType: string;
98```
99​
100##### resource.text?
101​
102```ts
103optional text?: string;
104```
105​
106##### resource.uri
107​
108```ts
109uri: string;
110```
111​
112#### serverId?
113​
114```ts
115optional serverId?: string;
116```
117​
118#### toolCallId
119​
120```ts
121toolCallId: string;
122```
123​
124#### toolName
125​
126```ts
127toolName: string;
128```
129​
130#### Overrides
131​
132```ts
133CustomEvent.value
134```