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

# Create comment

> MCP tool to add a new comment to any entity in the Thena platform.

import Admonition from '@theme/Admonition';

### MCP tool: `create_comment`

Add a new comment to any entity in the Thena platform. This tool allows you to create comments with various content types, visibility settings, and threading capabilities.

<Admonition type="note">
  You must provide the entity type and entity ID to create a comment.
</Admonition>

### Example prompt

```prompt theme={null}
Create a comment on ticket 71XNF90K10YBR86G1AN06KZJJFX40 with content "Customer reported an issue"
```

<Admonition type="info">
  When you use this prompt in a chat with the model (with the MCP tool registered), the model will automatically call the <code>create\_comment</code> tool with the correct arguments.
</Admonition>

### Input parameters

| Name                   | Type      | Required | Description                                                                          |
| ---------------------- | --------- | -------- | ------------------------------------------------------------------------------------ |
| entityType             | string    | Yes      | The type of entity to comment on (e.g., "ticket", "accountActivity", "note", "task") |
| entityId               | string    | Yes      | The ID of the entity to comment on                                                   |
| content                | string    | No       | The plain text content of the comment                                                |
| contentHtml            | string    | No       | The HTML content of the comment                                                      |
| contentJson            | string    | No       | The JSON content of the comment (for rich text editors, etc.)                        |
| parentCommentId        | string    | No       | The ID of the parent comment (for threaded comments)                                 |
| commentVisibility      | enum      | No       | "public" or "private" (default: "public")                                            |
| commentType            | string    | No       | "note", "reply", "comment", etc. (default: "comment")                                |
| threadName             | string    | No       | The name of the comment thread (for grouping)                                        |
| metadata               | object    | No       | Any additional metadata (e.g., mentions, tags)                                       |
| attachmentIds          | string\[] | No       | Array of attachment IDs to associate with the comment                                |
| customerEmail          | string    | No       | The email of the customer (if commenting as a customer)                              |
| impersonatedUserEmail  | string    | No       | If impersonating a user, their email                                                 |
| impersonatedUserName   | string    | No       | If impersonating a user, their name                                                  |
| impersonatedUserAvatar | string    | No       | If impersonating a user, their avatar URL                                            |

## Content types

You can provide comment content in multiple formats:

### Plain text

```json theme={null}
{
  "entityType": "ticket",
  "entityId": "ticket_123",
  "content": "This is a simple text comment"
}
```

### HTML content

```json theme={null}
{
  "entityType": "ticket",
  "entityId": "ticket_123",
  "contentHtml": "<p>This is an <strong>HTML formatted</strong> comment</p>"
}
```

### JSON content (Rich text)

```json theme={null}
{
  "entityType": "ticket",
  "entityId": "ticket_123",
  "contentJson": "{\"blocks\":[{\"text\":\"Rich text content\",\"type\":\"paragraph\"}]}"
}
```

## Visibility settings

### Public comment (Default)

```json theme={null}
{
  "entityType": "ticket",
  "entityId": "ticket_123",
  "content": "This comment is visible to customers",
  "commentVisibility": "public"
}
```

### Private comment

```json theme={null}
{
  "entityType": "ticket",
  "entityId": "ticket_123",
  "content": "This is an internal note only visible to team members",
  "commentVisibility": "private"
}
```

## Threaded comments

Create a reply to an existing comment:

```json theme={null}
{
  "entityType": "ticket",
  "entityId": "ticket_123",
  "content": "This is a reply to the parent comment",
  "parentCommentId": "comment_456"
}
```

## Comment types

Different comment types serve different purposes:

* `comment` - General comment (default)
* `note` - Internal note
* `reply` - Reply to another comment
* `status_update` - Status change notification
* `assignment` - Assignment notification

## Examples

### Basic ticket comment

```json theme={null}
{
  "entityType": "ticket",
  "entityId": "ticket_123",
  "content": "Customer reported the issue. Investigating now.",
  "commentType": "note",
  "commentVisibility": "private"
}
```

### Public customer response

```json theme={null}
{
  "entityType": "ticket",
  "entityId": "ticket_123",
  "content": "Thank you for reporting this issue. We're working on a fix.",
  "commentVisibility": "public"
}
```

### Comment with attachments

```json theme={null}
{
  "entityType": "ticket",
  "entityId": "ticket_123",
  "content": "Screenshot of the error attached",
  "attachmentIds": ["att_789", "att_790"]
}
```

### Impersonated user comment

```json theme={null}
{
  "entityType": "ticket",
  "entityId": "ticket_123",
  "content": "Comment from support team",
  "impersonatedUserEmail": "support@company.com",
  "impersonatedUserName": "Support Team",
  "impersonatedUserAvatar": "https://example.com/avatar.png"
}
```

### Response fields

Below are the fields you may see in the response:

<table>
  <thead>
    <tr>
      <th>Field</th>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>

  <tbody>
    <tr><td>id</td><td>string</td><td>Comment unique ID</td></tr>
    <tr><td>content</td><td>string</td><td>Plain text content of the comment</td></tr>
    <tr><td>contentHtml</td><td>string</td><td>HTML formatted content</td></tr>
    <tr><td>contentMarkdown</td><td>string</td><td>Markdown formatted content</td></tr>
    <tr><td>contentJson</td><td>string</td><td>JSON formatted content for rich text</td></tr>
    <tr><td>isEdited</td><td>boolean</td><td>Whether the comment has been edited</td></tr>
    <tr><td>threadName</td><td>string</td><td>Name of the comment thread</td></tr>
    <tr><td>commentVisibility</td><td>string</td><td>Visibility setting (public or private)</td></tr>
    <tr><td>commentType</td><td>string</td><td>Type of comment (note, reply, comment, etc.)</td></tr>
    <tr><td>isPinned</td><td>boolean</td><td>Whether the comment is pinned</td></tr>
    <tr><td>sourceEmailId</td><td>string</td><td>Email ID if comment came from email</td></tr>
    <tr><td>metadata</td><td>object</td><td>Additional metadata including mentions</td></tr>
    <tr><td>createdAt</td><td>string (ISO8601)</td><td>Creation timestamp</td></tr>
    <tr><td>updatedAt</td><td>string (ISO8601)</td><td>Last update timestamp</td></tr>
    <tr><td>author</td><td>string</td><td>Author display name</td></tr>
    <tr><td>authorAvatarUrl</td><td>string</td><td>Author's avatar URL</td></tr>
    <tr><td>attachments</td><td>array</td><td>Array of attachment IDs</td></tr>
    <tr><td>authorId</td><td>string</td><td>Author's user ID</td></tr>
    <tr><td>authorUserType</td><td>string</td><td>Author's user type (e.g., ORG\_ADMIN)</td></tr>
    <tr><td>impersonatedUserEmail</td><td>string</td><td>Email of impersonated user</td></tr>
    <tr><td>impersonatedUserName</td><td>string</td><td>Name of impersonated user</td></tr>
    <tr><td>impersonatedUserAvatar</td><td>string</td><td>Avatar of impersonated user</td></tr>
    <tr><td>deletedAt</td><td>string</td><td>Deletion timestamp (null if not deleted)</td></tr>
  </tbody>
</table>

### Sample response

```json theme={null}
{
  "data": {
    "id": "S5Q6R01K1052NAMN8YGYHYGKZG082",
    "content": "hey, this is a test comment",
    "contentHtml": "",
    "contentMarkdown": "hey, this is a test comment",
    "contentJson": "{\"type\":\"doc\",\"content\":[{\"type\":\"paragraph\",\"attrs\":{\"textAlign\":\"left\"}}]}",
    "isEdited": false,
    "threadName": null,
    "commentVisibility": "private",
    "commentType": "comment",
    "isPinned": false,
    "sourceEmailId": null,
    "metadata": {
      "mentions": []
    },
    "createdAt": "2025-07-25T12:16:24.755Z",
    "updatedAt": "2025-07-25T12:16:24.754Z",
    "author": "shakthi+1",
    "authorAvatarUrl": null,
    "attachments": [],
    "authorId": "UTH00SEXXFNVVN",
    "authorUserType": "ORG_ADMIN",
    "impersonatedUserEmail": null,
    "impersonatedUserName": null,
    "impersonatedUserAvatar": null,
    "deletedAt": null
  },
  "status": true,
  "message": "Comment created successfully!",
  "timestamp": "2025-07-25T12:16:24.780Z"
}
```

## Error handling

Common error scenarios:

* Invalid entity type or ID
* Missing required content
* Invalid attachment IDs
* Permission denied for the entity
* Network or authentication errors

<Admonition type="tip">
  Always pass an object as input, even if empty, to avoid errors when calling the tool directly.
</Admonition>

***
