# ToolGroup
URL: /docs/ui/tool-group
Wrapper for consecutive tool calls with collapsible and styled options.
***
title: ToolGroup
description: Wrapper for consecutive tool calls with collapsible and styled options.
------------------------------------------------------------------------------------
import { ParametersTable } from "@/components/docs/tables/ParametersTable";
import { ToolGroupSample } from "@/components/docs/samples/tool-group-sample";
A wrapper component that groups consecutive tool calls together, allowing you to display them in a collapsible or styled container.
## Getting Started
The ToolGroup component is defined inline in your thread component. Here's how to add it:
### Use it in your application
Pass the `ToolGroup` component to the `MessagePrimitive.Parts` component
```tsx twoslash title="/components/assistant-ui/thread.tsx"
import { FC, PropsWithChildren } from "react";
import { MessagePrimitive } from "@assistant-ui/react";
const AssistantActionBar: FC = () => null;
const BranchPicker: FC<{ className?: string }> = () => null;
// ---cut---
const ToolGroup: FC<
PropsWithChildren<{ startIndex: number; endIndex: number }>
> = ({ startIndex, endIndex, children }) => {
const toolCount = endIndex - startIndex + 1;
return (
{toolCount} tool {toolCount === 1 ? "call" : "calls"}
{children}
);
};
const AssistantMessage: FC = () => {
return (
);
};
```
## API Reference
### ToolGroup
## Examples
### Collapsible Tool Group
```tsx
const ToolGroup: FC<
PropsWithChildren<{ startIndex: number; endIndex: number }>
> = ({ startIndex, endIndex, children }) => {
const toolCount = endIndex - startIndex + 1;
return (
{toolCount} tool {toolCount === 1 ? "call" : "calls"}
{children}
);
};
```
### Styled Tool Group with Header
```tsx
const ToolGroup: FC<
PropsWithChildren<{ startIndex: number; endIndex: number }>
> = ({ startIndex, endIndex, children }) => {
return (
Tool execution #{startIndex + 1}-{endIndex + 1}
{children}
);
};
```
## Related Components
* [ToolFallback](/docs/ui/tool-fallback) - Default UI for tools without custom renderers
* [PartGrouping](/docs/ui/part-grouping) - Advanced message part grouping (experimental)