Skip to main content
Glama
huiseo
by huiseo

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
NameRequiredDescriptionDefault
documentIdYes
textYes
parentCommentIdNo

Implementation Reference

  • The core handler function for the 'add_comment' tool. It performs access checks, constructs the API payload, calls the Outline API to create a comment, and returns a formatted response including the comment ID, document ID, creation time, 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,
      };
    },
  • Zod schema defining the input validation for the add_comment tool: requires documentId and text, optionally parentCommentId for replies.
    export const addCommentSchema = z.object({
      documentId,
      text: z.string().min(1, 'Comment text is required'),
      parentCommentId: z.string().uuid().optional(),
    });
  • Tool registration in the allTools array, specifying name, description, and schema key for MCP tool definition conversion from Zod to JSON schema.
      'add_comment',
      'Add a comment to a document. Supports replies.',
      'add_comment'
    ),
  • Aggregates all handlers, including comment handlers containing 'add_comment', into the main ToolHandlers object for the MCP server.
    export function createAllHandlers(ctx: AppContext): ToolHandlers {
      return {
        ...createSearchHandlers(ctx),
        ...createDocumentHandlers(ctx),
        ...createCollectionHandlers(ctx),
        ...createCommentHandlers(ctx),
        ...createBatchHandlers(ctx),
        ...createSmartHandlers(ctx),
      } as ToolHandlers;
  • Access control helper listing 'add_comment' as a write operation tool, used by checkAccess in the handler 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',
    ]);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/huiseo/outline-wiki-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server