# MessagePartPrimitive
URL: /docs/api-reference/primitives/message-part
Primitives for text, images, tool calls, and other message content.
***
title: MessagePartPrimitive
description: Primitives for text, images, tool calls, and other message content.
--------------------------------------------------------------------------------
import { ParametersTable } from "@/components/docs/tables/ParametersTable";
import {
MessagePartRuntime,
TextMessagePartState,
AudioMessagePartState,
ToolCallMessagePartState,
} from "@/generated/typeDocs";
Each message can have any number of message parts.\
Message parts are usually one of text, reasoning, audio or tool-call.
## Message part Types
### Text
Standard text content, used for both user and assistant messages.
### Reasoning
Exposes the assistant's reasoning process, showing how it arrived at its responses. This is typically used only in assistant messages.
### Audio
Audio content that can be played back.
### Tool Call
Interactive elements that represent tool operations.
## Anatomy
```tsx
import { MessagePartPrimitive } from "@assistant-ui/react";
const TextMessagePart = () => {
return ;
};
```
## Primitives
### Plain Text
```tsx
import { MessagePartPrimitive } from "@assistant/react";
;
```
### Markdown Text
Renders the message's text as Markdown.
```tsx
import { MarkdownTextPrimitive } from "@assistant-ui/react-markdown";
;
```
### Audio
Coming soon.
### InProgress
Renders children only if the message part is in progress.
```tsx
import { MessagePartPrimitive } from "@assistant/react";
;
```
### Tool UI
You can map tool calls to UI components. We provide a few utility functions to make this easier, such as `makeAssistantToolUI`.
```tsx
const MyWeatherToolUI = makeAssistantToolUI({
toolName: "get_weather",
render: function MyWeatherToolUI({ args, result }) {
return (
get_weather({JSON.stringify(args)})
{"result" in result && (
{JSON.stringify(result.result)}
)}
);
},
});
```
## Context Provider
Message part context is provided by `MessagePrimitive.Parts` or `TextMessagePartProvider`
### MessagePrimitive.Parts
```tsx
import { MessagePrimitive } from "@assistant/react";
;
```
### TextMessagePartProvider
This is a helper context provider to allow you to reuse the message part components outside a message message part.
```tsx
import { TextMessagePartProvider } from "@assistant-ui/react";
;
```
## Runtime API
### `useMessagePartRuntime`
```tsx
import { useMessagePartRuntime } from "@assistant-ui/react";
const MessagePartRuntime = useMessagePartRuntime();
```
### `useMessagePart`
```tsx
import { useMessagePart } from "@assistant-ui/react";
const MessagePart = useMessagePart();
```
### `useMessagePartText`
```tsx
import { useMessagePartText } from "@assistant-ui/react";
const MessagePartText = useMessagePartText();
```