add_comment
Add comments or replies to Outline wiki documents to facilitate discussion and collaboration on content.
Instructions
Add a comment to a document. Supports replies.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| documentId | Yes | ||
| text | Yes | ||
| parentCommentId | No |
Implementation Reference
- src/lib/handlers/comments.ts:23-42 (handler)The core handler function for the 'add_comment' tool. It checks access, constructs the API payload, calls the Outline API to create a comment (supporting replies via parentCommentId), and returns a formatted response with id, documentId, createdAt, author, and success message.async add_comment(args: AddCommentInput) { checkAccess(config, 'add_comment'); const payload: Record<string, unknown> = { documentId: args.documentId, data: { text: args.text }, }; if (args.parentCommentId) payload.parentCommentId = args.parentCommentId; const { data } = await apiCall(() => apiClient.post<OutlineComment>('/comments.create', payload) ); return { id: data.id, documentId: data.documentId, createdAt: data.createdAt, createdBy: data.createdBy?.name, message: MESSAGES.COMMENT_ADDED, }; },
- src/lib/schemas.ts:75-79 (schema)Zod schema for 'add_comment' tool input validation: requires documentId and text, optional parentCommentId for replies.export const addCommentSchema = z.object({ documentId, text: z.string().min(1, 'Comment text is required'), parentCommentId: z.string().uuid().optional(), });
- src/lib/tools.ts:125-128 (registration)Registers the 'add_comment' tool definition in the allTools export, specifying name, description, and linking to its Zod schema for MCP tool advertisement.'add_comment', 'Add a comment to a document. Supports replies.', 'add_comment' ),
- src/lib/handlers/index.ts:19-28 (registration)Combines all handler factories, including createCommentHandlers (which provides the add_comment function), into a single ToolHandlers object for MCP tool execution.export function createAllHandlers(ctx: AppContext): ToolHandlers { return { ...createSearchHandlers(ctx), ...createDocumentHandlers(ctx), ...createCollectionHandlers(ctx), ...createCommentHandlers(ctx), ...createBatchHandlers(ctx), ...createSmartHandlers(ctx), } as ToolHandlers; }
- src/lib/access-control.ts:12-29 (helper)Classifies 'add_comment' as a write operation in WRITE_TOOLS set, used by checkAccess to enforce read-only mode restrictions.const WRITE_TOOLS = new Set([ 'create_document', 'update_document', 'move_document', 'archive_document', 'unarchive_document', 'delete_document', 'restore_document', 'add_comment', 'create_collection', 'update_collection', 'delete_collection', 'batch_create_documents', 'batch_update_documents', 'batch_move_documents', 'batch_archive_documents', 'batch_delete_documents', ]);