> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ag2.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# autogen.agentchat.contrib.capabilities.transforms_util.count_text_tokens

<code class="doc-symbol doc-symbol-heading doc-symbol-function" />

#### count\_text\_tokens

```python theme={null}
count_text_tokens(content: str | list[dict[str, Any] | str] | None) -> int
```

Calculates the number of text tokens in the given message content.<br />

<b>Parameters:</b>

| Name      | Description                                                                                                                              |
| --------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `content` | The message content to calculate the number of text tokens for.<br /><br />**Type:** str \| list\[dict\[str, typing.Any] \| str] \| None |

<br />
