2026-10-27 14:37:26 +08:00
|
|
|
import { z } from 'zod'
|
|
|
|
|
import { defineOperation } from '../define'
|
|
|
|
|
|
|
|
|
|
export const createComment = defineOperation({
|
|
|
|
|
name: 'create_comment',
|
|
|
|
|
title: 'Create Comment',
|
|
|
|
|
description:
|
|
|
|
|
'Post a review comment on a file, or reply to an existing comment thread. The comment is ' +
|
|
|
|
|
'posted as you, and the people involved are notified. For a video or audio file, set ' +
|
|
|
|
|
'"second" to pin the comment to a timecode. For a version stack, the comment goes on its ' +
|
|
|
|
|
'latest version.',
|
|
|
|
|
input: z.object({
|
|
|
|
|
assetId: z.string().min(1).describe('The file or version stack to comment on.'),
|
|
|
|
|
message: z.string().trim().min(1).max(10_000).describe('The comment text.'),
|
|
|
|
|
replyToId: z
|
|
|
|
|
.string()
|
|
|
|
|
.min(1)
|
|
|
|
|
.optional()
|
|
|
|
|
.describe('ID of the comment to reply to (from list_comments). Omit for a new thread.'),
|
|
|
|
|
second: z
|
|
|
|
|
.number()
|
|
|
|
|
.min(0)
|
|
|
|
|
.optional()
|
|
|
|
|
.describe('Timecode in seconds on a video or audio file. Omit for other files.'),
|
2026-11-26 14:54:45 +08:00
|
|
|
isInternal: z
|
|
|
|
|
.boolean()
|
|
|
|
|
.optional()
|
|
|
|
|
.describe(
|
|
|
|
|
'Whether this is an internal comment hidden from public share links. Defaults to false.',
|
|
|
|
|
),
|
2026-10-27 14:37:26 +08:00
|
|
|
}),
|
|
|
|
|
output: z.object({
|
|
|
|
|
id: z.string().describe('The new comment ID.'),
|
|
|
|
|
assetId: z.string().describe('The file the comment is on (the latest version for a stack).'),
|
|
|
|
|
replyToId: z.string().nullable().describe('The thread it replies to, if any.'),
|
2026-11-26 14:54:45 +08:00
|
|
|
isInternal: z.boolean().describe('Whether the created comment is internal.'),
|
2026-10-27 14:37:26 +08:00
|
|
|
}),
|
|
|
|
|
surfaces: ['agent', 'mcp', 'cli'],
|
|
|
|
|
annotations: { readOnly: false, destructive: false },
|
|
|
|
|
cli: {
|
|
|
|
|
command: ['comment', 'add'],
|
|
|
|
|
description: 'Comment on a file, or reply to a comment with --reply-to.',
|
|
|
|
|
positional: ['assetId', 'message'],
|
2026-11-26 14:54:45 +08:00
|
|
|
flags: { replyToId: ['--reply-to'], second: ['-t', '--at'], isInternal: ['--internal'] },
|
2026-10-27 14:37:26 +08:00
|
|
|
format: (output) => `Posted comment ${output.id}`,
|
|
|
|
|
},
|
|
|
|
|
})
|