@assistant-ui/mcp-docs-server 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/.docs/organized/code-examples/local-ollama.md +7 -7
  2. package/.docs/organized/code-examples/search-agent-for-e-commerce.md +9 -9
  3. package/.docs/organized/code-examples/with-ai-sdk.md +7 -7
  4. package/.docs/organized/code-examples/with-cloud.md +7 -7
  5. package/.docs/organized/code-examples/with-external-store.md +6 -6
  6. package/.docs/organized/code-examples/with-ffmpeg.md +10 -10
  7. package/.docs/organized/code-examples/with-langgraph.md +10 -10
  8. package/.docs/organized/code-examples/with-openai-assistants.md +7 -7
  9. package/.docs/organized/code-examples/with-react-hook-form.md +10 -10
  10. package/.docs/organized/code-examples/with-vercel-ai-rsc.md +7 -7
  11. package/.docs/raw/docs/api-reference/context-providers/{TextContentPartProvider.mdx → TextMessagePartProvider.mdx} +3 -3
  12. package/.docs/raw/docs/api-reference/integrations/react-hook-form.mdx +2 -2
  13. package/.docs/raw/docs/api-reference/overview.mdx +23 -23
  14. package/.docs/raw/docs/api-reference/primitives/Error.mdx +5 -3
  15. package/.docs/raw/docs/api-reference/primitives/Message.mdx +32 -0
  16. package/.docs/raw/docs/api-reference/primitives/{ContentPart.mdx → MessagePart.mdx} +41 -41
  17. package/.docs/raw/docs/api-reference/runtimes/MessagePartRuntime.mdx +22 -0
  18. package/.docs/raw/docs/api-reference/runtimes/ThreadListRuntime.mdx +1 -0
  19. package/.docs/raw/docs/api-reference/runtimes/ThreadRuntime.mdx +1 -0
  20. package/.docs/raw/docs/concepts/runtime-layer.mdx +7 -7
  21. package/.docs/raw/docs/copilots/make-assistant-tool-ui.mdx +79 -16
  22. package/.docs/raw/docs/copilots/make-assistant-tool.mdx +111 -7
  23. package/.docs/raw/docs/copilots/model-context.mdx +4 -1
  24. package/.docs/raw/docs/copilots/motivation.mdx +4 -1
  25. package/.docs/raw/docs/getting-started.mdx +11 -10
  26. package/.docs/raw/docs/guides/Attachments.mdx +24 -21
  27. package/.docs/raw/docs/guides/ToolUI.mdx +48 -8
  28. package/.docs/raw/docs/guides/Tools.mdx +24 -6
  29. package/.docs/raw/docs/mcp-docs-server.mdx +1 -3
  30. package/.docs/raw/docs/migrations/v0-11.mdx +169 -0
  31. package/.docs/raw/docs/migrations/v0-7.mdx +8 -8
  32. package/.docs/raw/docs/migrations/v0-8.mdx +14 -14
  33. package/.docs/raw/docs/migrations/v0-9.mdx +3 -3
  34. package/.docs/raw/docs/runtimes/ai-sdk/rsc.mdx +2 -2
  35. package/.docs/raw/docs/runtimes/ai-sdk/use-assistant-hook.mdx +1 -1
  36. package/.docs/raw/docs/runtimes/ai-sdk/use-chat-hook.mdx +2 -2
  37. package/.docs/raw/docs/runtimes/ai-sdk/use-chat.mdx +2 -2
  38. package/.docs/raw/docs/runtimes/custom/external-store.mdx +5 -5
  39. package/.docs/raw/docs/runtimes/custom/local.mdx +3 -3
  40. package/.docs/raw/docs/runtimes/langgraph/tutorial/part-2.mdx +2 -2
  41. package/.docs/raw/docs/ui/Attachment.mdx +5 -2
  42. package/.docs/raw/docs/ui/Markdown.mdx +2 -3
  43. package/.docs/raw/docs/ui/ToolFallback.mdx +2 -2
  44. package/dist/{chunk-CZCDQ3YH.js → chunk-JS4PWCVA.js} +1 -1
  45. package/dist/{chunk-C7O7EFKU.js → chunk-M2RKUM66.js} +1 -1
  46. package/dist/index.js +1 -1
  47. package/dist/prepare-docs/prepare.js +1 -1
  48. package/dist/stdio.js +1 -1
  49. package/package.json +5 -5
  50. package/.docs/raw/docs/api-reference/runtimes/ContentPartRuntime.mdx +0 -22
@@ -30,7 +30,8 @@ Contains all parts of the error display. Renders a `<div>` element with `role="a
30
30
  {
31
31
  name: "asChild",
32
32
  type: "boolean",
33
- description: "Change the component to the HTML tag or custom component of the only child.",
33
+ description:
34
+ "Change the component to the HTML tag or custom component of the only child.",
34
35
  },
35
36
  ]}
36
37
  />
@@ -45,7 +46,8 @@ Displays the error message. By default, it shows the error from the message cont
45
46
  {
46
47
  name: "children",
47
48
  type: "ReactNode",
48
- description: "Optional custom content to display instead of the default error message.",
49
+ description:
50
+ "Optional custom content to display instead of the default error message.",
49
51
  },
50
52
  ]}
51
53
  />
@@ -59,7 +61,7 @@ import { MessagePrimitive, ErrorPrimitive } from "@assistant-ui/react";
59
61
 
60
62
  const MessageWithError = () => (
61
63
  <MessagePrimitive.Root>
62
- <MessagePrimitive.Content />
64
+ <MessagePrimitive.Parts />
63
65
  <MessagePrimitive.Error>
64
66
  <ErrorPrimitive.Root>
65
67
  <ErrorPrimitive.Message />
@@ -115,6 +115,38 @@ The content of the message. This renders a separate component for each content p
115
115
  },
116
116
  ],
117
117
  },
118
+ {
119
+ name: "ToolGroup",
120
+ type: "ComponentType<PropsWithChildren<{ startIndex: number; endIndex: number }>>",
121
+ description:
122
+ "Component for rendering grouped consecutive tool calls. When provided, consecutive tool-call content parts will be automatically grouped and wrapped with this component.",
123
+ children: [
124
+ {
125
+ type: "ToolGroupProps",
126
+ parameters: [
127
+ {
128
+ name: "startIndex",
129
+ type: "number",
130
+ description: "Index of the first tool call in the group.",
131
+ required: true,
132
+ },
133
+ {
134
+ name: "endIndex",
135
+ type: "number",
136
+ description: "Index of the last tool call in the group.",
137
+ required: true,
138
+ },
139
+ {
140
+ name: "children",
141
+ type: "ReactNode",
142
+ description:
143
+ "The rendered tool call components within the group.",
144
+ required: true,
145
+ },
146
+ ],
147
+ },
148
+ ],
149
+ },
118
150
  ],
119
151
  },
120
152
  ],
@@ -1,20 +1,20 @@
1
1
  ---
2
- title: ContentPartPrimitive
3
- description: A part of a message's content. Content parts may be text, image, tool call or UI elements.
2
+ title: MessagePartPrimitive
3
+ description: A part of a message's content. Message parts may be text, image, tool call or UI elements.
4
4
  ---
5
5
 
6
6
  import { ParametersTable } from "@/components/docs";
7
7
  import {
8
- ContentPartRuntime,
9
- TextContentPartState,
10
- AudioContentPartState,
11
- ToolCallContentPartState,
8
+ MessagePartRuntime,
9
+ TextMessagePartState,
10
+ AudioMessagePartState,
11
+ ToolCallMessagePartState,
12
12
  } from "@/generated/typeDocs";
13
13
 
14
- Each message can have any number of content parts.
15
- Content parts are usually one of text, reasoning, audio or tool-call.
14
+ Each message can have any number of message parts.
15
+ Message parts are usually one of text, reasoning, audio or tool-call.
16
16
 
17
- ## Content Part Types
17
+ ## Message part Types
18
18
 
19
19
  ### Text
20
20
 
@@ -35,10 +35,10 @@ Interactive elements that represent tool operations.
35
35
  ## Anatomy
36
36
 
37
37
  ```tsx
38
- import { ContentPartPrimitive } from "@assistant-ui/react";
38
+ import { MessagePartPrimitive } from "@assistant-ui/react";
39
39
 
40
- const TextContentPart = () => {
41
- return <ContentPartPrimitive.Text />;
40
+ const TextMessagePart = () => {
41
+ return <MessagePartPrimitive.Text />;
42
42
  };
43
43
  ```
44
44
 
@@ -47,9 +47,9 @@ const TextContentPart = () => {
47
47
  ### Plain Text
48
48
 
49
49
  ```tsx
50
- import { ContentPartPrimitive } from "@assistant/react";
50
+ import { MessagePartPrimitive } from "@assistant/react";
51
51
 
52
- <ContentPartPrimitive.Text />;
52
+ <MessagePartPrimitive.Text />;
53
53
  ```
54
54
 
55
55
  ### Markdown Text
@@ -68,14 +68,14 @@ Coming soon.
68
68
 
69
69
  ### InProgress
70
70
 
71
- Renders children only if the content part is in progress.
71
+ Renders children only if the message part is in progress.
72
72
 
73
73
  ```tsx
74
- import { ContentPartPrimitive } from "@assistant/react";
74
+ import { MessagePartPrimitive } from "@assistant/react";
75
75
 
76
- <ContentPartPrimitive.InProgress>
76
+ <MessagePartPrimitive.InProgress>
77
77
  <LoadingIndicator />
78
- </ContentPartPrimitive.InProgress>;
78
+ </MessagePartPrimitive.InProgress>;
79
79
  ```
80
80
 
81
81
  ### Tool UI
@@ -104,14 +104,14 @@ const MyWeatherToolUI = makeAssistantToolUI({
104
104
 
105
105
  ## Context Provider
106
106
 
107
- Content part context is provided by `MessagePrimitive.Content` or `TextContentPartProvider`
107
+ Message part context is provided by `MessagePrimitive.Parts` or `TextMessagePartProvider`
108
108
 
109
- ### MessagePrimitive.Content
109
+ ### MessagePrimitive.Parts
110
110
 
111
111
  ```tsx
112
112
  import { MessagePrimitive } from "@assistant/react";
113
113
 
114
- <MessagePrimitive.Content
114
+ <MessagePrimitive.Parts
115
115
  components={{
116
116
  Text: MyText,
117
117
  Reasoning: MyReasoning,
@@ -126,48 +126,48 @@ import { MessagePrimitive } from "@assistant/react";
126
126
  />;
127
127
  ```
128
128
 
129
- ### TextContentPartProvider
129
+ ### TextMessagePartProvider
130
130
 
131
- This is a helper context provider to allow you to reuse the content part components outside a message content part.
131
+ This is a helper context provider to allow you to reuse the message part components outside a message message part.
132
132
 
133
133
  ```tsx
134
- import { TextContentPartProvider } from "@assistant-ui/react";
134
+ import { TextMessagePartProvider } from "@assistant-ui/react";
135
135
 
136
- <TextContentPartProvider text="Hello world" isRunning={false}>
137
- <ContentPart.Text />
138
- </TextContentPartProvider>;
136
+ <TextMessagePartProvider text="Hello world" isRunning={false}>
137
+ <MessagePart.Text />
138
+ </TextMessagePartProvider>;
139
139
  ```
140
140
 
141
141
  ## Runtime API
142
142
 
143
- ### `useContentPartRuntime`
143
+ ### `useMessagePartRuntime`
144
144
 
145
145
  ```tsx
146
- import { useContentPartRuntime } from "@assistant-ui/react";
146
+ import { useMessagePartRuntime } from "@assistant-ui/react";
147
147
 
148
- const contentPartRuntime = useContentPartRuntime();
148
+ const MessagePartRuntime = useMessagePartRuntime();
149
149
  ```
150
150
 
151
- <ParametersTable {...ContentPartRuntime} />
151
+ <ParametersTable {...MessagePartRuntime} />
152
152
 
153
- ### `useContentPart`
153
+ ### `useMessagePart`
154
154
 
155
155
  ```tsx
156
- import { useContentPart } from "@assistant-ui/react";
156
+ import { useMessagePart } from "@assistant-ui/react";
157
157
 
158
- const contentPart = useContentPart();
158
+ const MessagePart = useMessagePart();
159
159
  ```
160
160
 
161
- <ParametersTable {...TextContentPartState} />
162
- <ParametersTable {...AudioContentPartState} />
163
- <ParametersTable {...ToolCallContentPartState} />
161
+ <ParametersTable {...TextMessagePartState} />
162
+ <ParametersTable {...AudioMessagePartState} />
163
+ <ParametersTable {...ToolCallMessagePartState} />
164
164
 
165
- ### `useContentPartText`
165
+ ### `useMessagePartText`
166
166
 
167
167
  ```tsx
168
- import { useContentPartText } from "@assistant-ui/react";
168
+ import { useMessagePartText } from "@assistant-ui/react";
169
169
 
170
- const contentPartText = useContentPartText();
170
+ const MessagePartText = useMessagePartText();
171
171
  ```
172
172
 
173
- <ParametersTable {...TextContentPartState} />
173
+ <ParametersTable {...TextMessagePartState} />
@@ -0,0 +1,22 @@
1
+ ---
2
+ title: MessagePartRuntime
3
+ ---
4
+
5
+ import { ParametersTable } from "@/components/docs";
6
+ import { MessagePartState } from "@/components/docs/parameters/context";
7
+
8
+ ### `useMessagePart`
9
+
10
+ Access the message part state:
11
+
12
+ ```tsx
13
+ import { useMessagePart } from "@assistant-ui/react";
14
+
15
+ const part = useMessagePart();
16
+ const partState = useMessagePart.getState();
17
+
18
+ const status = useMessagePart((m) => m.status);
19
+ const statusAgain = useMessagePart.getState().status;
20
+ ```
21
+
22
+ <ParametersTable {...MessagePartState} />
@@ -26,6 +26,7 @@ import { useThreadList } from "@assistant-ui/react";
26
26
 
27
27
  const threadList = useThreadList();
28
28
  const threads = useThreadList((m) => m.threads);
29
+ const isLoading = useThreadList((m) => m.isLoading);
29
30
  ```
30
31
 
31
32
  <ParametersTable {...ThreadListState} />
@@ -30,6 +30,7 @@ import { useThread } from "@assistant-ui/react";
30
30
 
31
31
  const thread = useThread();
32
32
  const isRunning = useThread((m) => m.isRunning);
33
+ const isLoading = useThread((m) => m.isLoading);
33
34
  ```
34
35
 
35
36
  <ParametersTable {...ThreadState} />
@@ -66,7 +66,7 @@ import { File, Folder, Files } from "fumadocs-ui/components/files";
66
66
  <Folder name="ThreadRuntime" defaultOpen>
67
67
  <Folder name="MessageRuntime" defaultOpen>
68
68
  <Folder
69
- name="ContentPartRuntime (Text / Reasoning / Image / Audio / Tool-Call / UI)"
69
+ name="MessagePartRuntime (Text / Reasoning / Image / Audio / Tool-Call / UI)"
70
70
  defaultOpen
71
71
  ></Folder>
72
72
  <Folder name="MessageAttachmentRuntime" defaultOpen></Folder>
@@ -95,8 +95,8 @@ The following components provide the runtime APIs:
95
95
  // renders every message, provides MessageRuntime, ComposerRuntime (EditComposer)
96
96
  <ThreadPrimitive.Messages components={{ Message, ... }} />
97
97
 
98
- // renders every content part, provides ContentPartRuntime
99
- <MessagePrimitive.Content components={{ Text, Reasoning, Image, Audio, UI, tools }} />
98
+ // renders every message part, provides MessagePartRuntime
99
+ <MessagePrimitive.Parts components={{ Text, Reasoning, Image, Audio, UI, tools }} />
100
100
 
101
101
  // renders every attachment, provides AttachmentRuntime (Thread or EditComposer)
102
102
  <ComposerPrimitive.Attachments components={{ Attachment, ... }} />
@@ -104,8 +104,8 @@ The following components provide the runtime APIs:
104
104
  // renders every attachment, provides AtatchmentRuntime (Message)
105
105
  <MessagePrimitive.Attachments components={{ Attachment, ... }} />
106
106
 
107
- // provides a custom TextContentPartRuntime
108
- <TextContentPartProvider text="Hello!" />
107
+ // provides a custom TextMessagePartRuntime
108
+ <TextMessagePartProvider text="Hello!" />
109
109
  ```
110
110
 
111
111
  ### Accessing runtime APIs
@@ -116,7 +116,7 @@ You can access the runtime APIs with react hooks:
116
116
  const runtime = useAssistantRuntime();
117
117
  const threadRuntime = useThreadRuntime();
118
118
  const messageRuntime = useMessageRuntime();
119
- const contentPartRuntime = useContentPartRuntime();
119
+ const MessagePartRuntime = useMessagePartRuntime();
120
120
 
121
121
  // thread manager has no separate hook (1:1 relationship with assistant runtime)
122
122
  const ThreadListRuntime = useAssistantRuntime().threads;
@@ -145,7 +145,7 @@ Most runtimes also expose a state through two methods `getState` and `subscribe`
145
145
  useThreadList(); // get thread manager state
146
146
  useThread(); // get thread state
147
147
  useMessage(); // get message state
148
- useContentPart(); // get content part state
148
+ useMessagePart(); // get message part state
149
149
  useComposer(); // get composer state
150
150
  useThreadComposer(); // get thread composer state
151
151
  useEditComposer(); // get edit composer state
@@ -4,14 +4,12 @@ title: makeAssistantToolUI
4
4
 
5
5
  import { ParametersTable } from "@/components/docs";
6
6
 
7
- # `makeAssistantToolUI`
8
-
9
7
  The `makeAssistantToolUI` utility is used to register a tool UI component with the Assistant.
10
8
 
11
9
  ## Usage
12
10
 
13
11
  ```tsx
14
- import { makeAssistantToolUI } from "assistant-ui/react";
12
+ import { makeAssistantToolUI } from "@assistant-ui/react";
15
13
 
16
14
  const MyToolUI = makeAssistantToolUI({
17
15
  toolName: "myTool",
@@ -23,9 +21,7 @@ const MyToolUI = makeAssistantToolUI({
23
21
 
24
22
  ## API
25
23
 
26
- ### `makeAssistantToolUI(tool)`
27
-
28
- #### Parameters
24
+ ### Parameters
29
25
 
30
26
  <ParametersTable
31
27
  type="AssistantToolUIProps<TArgs, TResult>"
@@ -33,33 +29,99 @@ const MyToolUI = makeAssistantToolUI({
33
29
  {
34
30
  name: "toolName",
35
31
  type: "string",
36
- description: "The name of the tool. This must match the name of the tool defined in the assistant.",
32
+ description:
33
+ "The name of the tool. This must match the name of the tool defined in the assistant.",
37
34
  },
38
35
  {
39
36
  name: "render",
40
- type: "function",
41
- description: "A function that renders the tool UI. It receives an object with the following properties: `args` (any): The arguments passed to the tool. `result` (any): The result of the tool execution. `status` (\"requires_action\" | \"in_progress\" | \"complete\" | \"error\"): The status of the tool execution.",
37
+ type: "ComponentType<ToolCallMessagePartProps<TArgs, TResult>>",
38
+ description:
39
+ "A React component that renders the tool UI. Receives the following props:",
40
+ required: true,
41
+ children: [
42
+ {
43
+ type: "ToolCallMessagePartProps<TArgs, TResult>",
44
+ parameters: [
45
+ {
46
+ name: "type",
47
+ type: '"tool-call"',
48
+ description: "The message part type",
49
+ },
50
+ {
51
+ name: "toolCallId",
52
+ type: "string",
53
+ description: "Unique identifier for this tool call",
54
+ },
55
+ {
56
+ name: "toolName",
57
+ type: "string",
58
+ description: "The name of the tool being called",
59
+ },
60
+ {
61
+ name: "args",
62
+ type: "TArgs",
63
+ description: "The arguments passed to the tool",
64
+ },
65
+ {
66
+ name: "argsText",
67
+ type: "string",
68
+ description: "String representation of the arguments",
69
+ },
70
+ {
71
+ name: "result",
72
+ type: "TResult | undefined",
73
+ description: "The result of the tool execution (if complete)",
74
+ },
75
+ {
76
+ name: "isError",
77
+ type: "boolean | undefined",
78
+ description: "Whether the result is an error",
79
+ },
80
+ {
81
+ name: "status",
82
+ type: "ToolCallMessagePartStatus",
83
+ description:
84
+ 'The execution status object with a type property: "running", "complete", "incomplete", or "requires_action"',
85
+ },
86
+ {
87
+ name: "addResult",
88
+ type: "(result: TResult | ToolResponse<TResult>) => void",
89
+ description:
90
+ "Function to add a result (useful for human-in-the-loop tools)",
91
+ },
92
+ {
93
+ name: "artifact",
94
+ type: "unknown",
95
+ description:
96
+ "Optional artifact data associated with the tool call",
97
+ },
98
+ ],
99
+ },
100
+ ],
42
101
  },
43
102
  ]}
44
103
  />
45
104
 
46
- #### Returns
105
+ ### Returns
47
106
 
48
107
  A React functional component that should be included in your component tree. This component doesn't render anything itself, but it registers the tool UI with the Assistant.
49
108
 
50
109
  ## Example
51
110
 
52
111
  ```tsx
53
- import { makeAssistantToolUI } from "assistant-ui/react";
54
- import { AssistantRuntimeProvider } from "assistant-ui/react";
112
+ import { makeAssistantToolUI } from "@assistant-ui/react";
113
+ import { AssistantRuntimeProvider } from "@assistant-ui/react";
55
114
 
56
115
  const GetWeatherUI = makeAssistantToolUI({
57
116
  toolName: "get_weather",
58
117
  render: ({ args, result, status }) => {
59
- if (status === "requires_action") return <p>Getting weather for {args.location}...</p>;
60
- if (status === "in_progress") return <p>Loading...</p>;
61
- if (status === "error") return <p>Error getting weather.</p>;
62
- if (status === "complete") return <p>The weather is {result.weather}.</p>;
118
+ if (status.type === "requires_action")
119
+ return <p>Getting weather for {args.location}...</p>;
120
+ if (status.type === "running") return <p>Loading...</p>;
121
+ if (status.type === "incomplete" && status.reason === "error")
122
+ return <p>Error getting weather.</p>;
123
+ if (status.type === "complete")
124
+ return <p>The weather is {result.weather}.</p>;
63
125
  return null;
64
126
  },
65
127
  });
@@ -73,4 +135,5 @@ function App() {
73
135
  );
74
136
  }
75
137
  ```
138
+
76
139
  This example shows how to create a simple UI for a `get_weather` tool. The UI will display different messages depending on the status of the tool execution.
@@ -2,6 +2,8 @@
2
2
  title: makeAssistantTool
3
3
  ---
4
4
 
5
+ import { ParametersTable } from "@/components/docs";
6
+
5
7
  `makeAssistantTool` creates a React component that provides a tool to the assistant. This is useful for defining reusable tools that can be composed into your application.
6
8
 
7
9
  ## Usage
@@ -23,7 +25,10 @@ const submitForm = tool({
23
25
  });
24
26
 
25
27
  // Create a tool component
26
- const SubmitFormTool = makeAssistantTool(submitForm);
28
+ const SubmitFormTool = makeAssistantTool({
29
+ ...submitForm,
30
+ toolName: "submitForm",
31
+ });
27
32
 
28
33
  // Use in your component
29
34
  function Form() {
@@ -40,9 +45,102 @@ function Form() {
40
45
 
41
46
  ### Parameters
42
47
 
43
- - `tool`: A tool definition created using the `tool()` helper function
44
- - `parameters`: Zod schema defining the tool's parameters
45
- - `execute`: Function that implements the tool's behavior
48
+ <ParametersTable
49
+ type="AssistantToolProps<TArgs, TResult>"
50
+ parameters={[
51
+ {
52
+ name: "toolName",
53
+ type: "string",
54
+ description: "The unique identifier for the tool",
55
+ required: true,
56
+ },
57
+ {
58
+ name: "parameters",
59
+ type: "StandardSchemaV1<TArgs> | JSONSchema7",
60
+ description:
61
+ "Schema defining the tool's parameters (typically a Zod schema)",
62
+ required: true,
63
+ },
64
+ {
65
+ name: "execute",
66
+ type: "(args: TArgs, context: ToolExecutionContext) => TResult | Promise<TResult>",
67
+ description:
68
+ "Function that implements the tool's behavior (required for frontend tools)",
69
+ required: true,
70
+ },
71
+ {
72
+ name: "description",
73
+ type: "string",
74
+ description: "Optional description of the tool's purpose",
75
+ },
76
+ {
77
+ name: "render",
78
+ type: "ComponentType<ToolCallMessagePartProps<TArgs, TResult>>",
79
+ description:
80
+ "Optional custom UI component for rendering the tool execution. Receives the following props:",
81
+ children: [
82
+ {
83
+ type: "ToolCallMessagePartProps<TArgs, TResult>",
84
+ parameters: [
85
+ {
86
+ name: "type",
87
+ type: '"tool-call"',
88
+ description: "The message part type",
89
+ },
90
+ {
91
+ name: "toolCallId",
92
+ type: "string",
93
+ description: "Unique identifier for this tool call",
94
+ },
95
+ {
96
+ name: "toolName",
97
+ type: "string",
98
+ description: "The name of the tool being called",
99
+ },
100
+ {
101
+ name: "args",
102
+ type: "TArgs",
103
+ description: "The arguments passed to the tool",
104
+ },
105
+ {
106
+ name: "argsText",
107
+ type: "string",
108
+ description: "String representation of the arguments",
109
+ },
110
+ {
111
+ name: "result",
112
+ type: "TResult | undefined",
113
+ description: "The result of the tool execution (if complete)",
114
+ },
115
+ {
116
+ name: "isError",
117
+ type: "boolean | undefined",
118
+ description: "Whether the result is an error",
119
+ },
120
+ {
121
+ name: "status",
122
+ type: "ToolCallMessagePartStatus",
123
+ description:
124
+ 'The execution status object with a type property: "running", "complete", "incomplete", or "requires_action"',
125
+ },
126
+ {
127
+ name: "addResult",
128
+ type: "(result: TResult | ToolResponse<TResult>) => void",
129
+ description:
130
+ "Function to add a result (useful for human-in-the-loop tools)",
131
+ },
132
+ {
133
+ name: "artifact",
134
+ type: "unknown",
135
+ description:
136
+ "Optional artifact data associated with the tool call",
137
+ },
138
+ ],
139
+ },
140
+ ],
141
+ },
142
+ ]}
143
+ />
46
144
 
47
145
  ### Returns
48
146
 
@@ -76,14 +174,20 @@ const sendEmail = tool({
76
174
  body: z.string(),
77
175
  }),
78
176
  execute: async (params) => {
79
- // Implementation
177
+ // Tool logic
80
178
  return { sent: true };
81
179
  },
82
180
  });
83
181
 
84
182
  // Create tool components
85
- const EmailValidator = makeAssistantTool(validateEmail);
86
- const EmailSender = makeAssistantTool(sendEmail);
183
+ const EmailValidator = makeAssistantTool({
184
+ ...validateEmail,
185
+ toolName: "validateEmail",
186
+ });
187
+ const EmailSender = makeAssistantTool({
188
+ ...sendEmail,
189
+ toolName: "sendEmail",
190
+ });
87
191
 
88
192
  // Use together
89
193
  function EmailForm() {
@@ -54,7 +54,10 @@ const submitForm = tool({
54
54
  },
55
55
  });
56
56
 
57
- const SubmitFormTool = makeAssistantTool(submitForm);
57
+ const SubmitFormTool = makeAssistantTool({
58
+ ...submitForm,
59
+ toolName: "submitForm"
60
+ });
58
61
 
59
62
  // Use in your component
60
63
  function Form() {
@@ -122,7 +122,10 @@ const analyzeTransaction = tool({
122
122
  });
123
123
 
124
124
  // Create a tool component
125
- const TransactionAnalyzer = makeAssistantTool(analyzeTransaction);
125
+ const TransactionAnalyzer = makeAssistantTool({
126
+ ...analyzeTransaction,
127
+ toolName: "analyzeTransaction",
128
+ });
126
129
 
127
130
  function SmartTransactionHistory() {
128
131
  // Previous instructions...