# Create Document Comment — Linear (API key)

> Add a comment to a Linear document, or reply to an existing comment on it. Use Search Documents to find the document ID, and List Document Comments to find a comment ID to reply to. For comments on issues use Create Comment instead. A…

- Key: `linear_app-create-document-comment`
- Type: Action (Write)
- Version: 0.0.1
- App: Linear (API key) (`linear_app`) — https://pipedream.com/apps/linear-app.md
- This page (HTML): https://pipedream.com/apps/linear-app/actions/create-document-comment
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/linear_app/actions/create-document-comment/create-document-comment.mjs

## Description

Add a comment to a Linear document, or reply to an existing comment on it. Use **Search Documents** to find the document ID, and **List Document Comments** to find a comment ID to reply to. For comments on issues use **Create Comment** instead. A reply's parent must be a top-level comment on the same document (Linear allows only one level of replies). Returns `success` and the new comment's `id`, `body`, `createdAt`, `parent`, and author. Example: `documentId: "10b5bc2940c7"`, `body: "Looks good, one question on the rollout plan."` → returns `{success: true, comment: {id: "cmt_xyz", body: "Looks good, one question on the rollout plan.", parent: null}}`. [See the documentation](https://studio.apollographql.com/public/Linear-API/variant/current/schema/reference/objects/Mutation?query=commentCreate)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `documentId` | `string` | Yes | The document to comment on: its UUID or slugId (the short code at the end of the document URL, e.g. 10b5bc2940c7). Use Search Documents to find document IDs. |
| `body` | `string` | Yes | The content of the comment in markdown format. Example: Looks good, one question on the rollout plan. |
| `parentId` | `string` | No | The ID of an existing top-level comment on this document to reply to (a UUID, e.g. 2160d3b4-99a7-41ad-a24f-b2f28ef7d320). Linear allows only one level of replies, so don't pass the ID of a reply: top-level comments have parent: null, and for a reply use its parent ID instead. Leave blank to post a new top-level comment. Use List Document Comments to find comment IDs. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "linear_app",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "linear_app-create-document-comment",
  arguments: {
    documentId: "Document ID",
    body: "Body",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "linear_app-create-document-comment",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    linear_app: { authProvisionId: "apn_xxxxxxx" },
    documentId: "Document ID",
    body: "Body",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "linear_app-create-document-comment",
    "configured_props": {
      "linear_app": { "authProvisionId": "apn_xxxxxxx" },
      "documentId": "Document ID",
      "body": "Body"
    }
  }'
```

---

- App: https://pipedream.com/apps/linear-app.md · All apps: https://pipedream.com/apps
