[
  {
    "name": "check_new_comments",
    "description": "Check for new comments across pages in a space since a given timestamp. Optionally scope to a page subtree (folder). Returns only comments created after the specified time.",
    "parameters": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "spaceId": { "type": "string", "description": "Space ID to check for new comments" },
        "since": { "type": "string", "description": "ISO 8601 timestamp — only return comments created after this time (e.g. '2026-03-10T00:00:00Z')" },
        "parentPageId": { "type": "string", "description": "Optional root page ID to scope the check to a subtree (folder). Only pages under this parent will be checked." }
      },
      "required": ["spaceId", "since"]
    }
  },
  {
    "name": "create_comment",
    "description": "Create a new comment on a page. Content is provided as Markdown and automatically converted to the required format.",
    "parameters": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "pageId": { "type": "string", "description": "ID of the page to comment on" },
        "content": { "type": "string", "description": "Comment content in Markdown format" },
        "parentCommentId": { "type": "string", "description": "Parent comment ID to create a reply (max 2 nesting levels)" },
        "selection": { "type": "string", "description": "Selected text for inline comments (max 250 chars). Required when type is 'inline'." },
        "type": { "type": "string", "enum": ["page", "inline"], "description": "Comment type: 'page' for general page comment (default), 'inline' for text selection comment" }
      },
      "required": ["pageId", "content"]
    }
  },
  {
    "name": "create_page",
    "description": "Create a new page with content (automatically moves it to the correct hierarchy).",
    "parameters": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "title": { "type": "string", "description": "Title of the page" },
        "content": { "type": "string", "description": "Markdown content" },
        "spaceId": { "type": "string" },
        "parentPageId": { "type": "string", "description": "Optional parent page ID to nest under" }
      },
      "required": ["title", "content", "spaceId"]
    }
  },
  {
    "name": "delete_comment",
    "description": "Delete a comment. Only the comment creator or space admin can delete it.",
    "parameters": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "commentId": { "type": "string", "description": "ID of the comment to delete" }
      },
      "required": ["commentId"]
    }
  },
  {
    "name": "delete_page",
    "description": "Delete a single page by ID.",
    "parameters": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "pageId": { "type": "string" }
      },
      "required": ["pageId"]
    }
  },
  {
    "name": "delete_pages",
    "description": "Delete multiple pages at once. Useful for cleanup.",
    "parameters": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "pageIds": { "type": "array", "items": { "type": "string" } }
      },
      "required": ["pageIds"]
    }
  },
  {
    "name": "get_comment",
    "description": "Get a single comment by ID with content as Markdown.",
    "parameters": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "commentId": { "type": "string", "description": "ID of the comment" }
      },
      "required": ["commentId"]
    }
  },
  {
    "name": "get_page",
    "description": "Get details and content of a specific page by ID",
    "parameters": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "pageId": { "type": "string" }
      },
      "required": ["pageId"]
    }
  },
  {
    "name": "get_workspace",
    "description": "Get the current Docmost workspace",
    "parameters": { "type": "object", "properties": {} }
  },
  {
    "name": "list_comments",
    "description": "List all comments on a page. Returns comments with content converted to Markdown.",
    "parameters": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "pageId": { "type": "string", "description": "ID of the page to list comments for" }
      },
      "required": ["pageId"]
    }
  },
  {
    "name": "list_groups",
    "description": "List all available groups in Docmost",
    "parameters": { "type": "object", "properties": {} }
  },
  {
    "name": "list_pages",
    "description": "List pages in a space ordered by updatedAt (descending).",
    "parameters": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "spaceId": { "type": "string" }
      }
    }
  },
  {
    "name": "list_spaces",
    "description": "List all available spaces in Docmost",
    "parameters": { "type": "object", "properties": {} }
  },
  {
    "name": "move_page",
    "description": "Move a page to a new parent (nesting) or root. Essential for organizing pages created via 'import_page'.",
    "parameters": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "pageId": { "type": "string" },
        "parentPageId": { "type": ["string", "null"], "description": "Target parent page ID. Pass 'null' or empty string to move to root." },
        "position": { "type": "string", "description": "Optional position string (5-12 chars). Defaults to 'a00000' (end) if omitted." }
      },
      "required": ["pageId"]
    }
  },
  {
    "name": "search",
    "description": "Search for pages and content.",
    "parameters": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "query": { "type": "string", "description": "Search query" },
        "spaceId": { "type": "string", "description": "Optional space ID to filter by" }
      },
      "required": ["query"]
    }
  },
  {
    "name": "update_comment",
    "description": "Update an existing comment's content. Only the comment creator can update it. Content is provided as Markdown.",
    "parameters": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "commentId": { "type": "string", "description": "ID of the comment to update" },
        "content": { "type": "string", "description": "New comment content in Markdown format" }
      },
      "required": ["commentId", "content"]
    }
  },
  {
    "name": "update_page",
    "description": "Update a page's content and/or title via realtime collaboration (preserves Page ID and history).",
    "parameters": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "pageId": { "type": "string", "description": "ID of the page to update" },
        "content": { "type": "string", "description": "New Markdown content" },
        "title": { "type": "string", "description": "Optional new title" }
      },
      "required": ["pageId", "content"]
    },
    "notes": "Requiere SIEMPRE la fila separadora GFM (| --- | --- |) en tablas markdown, con cada fila en su propia linea -- sin eso el editor colapsa las filas en un parrafo ilegible (bug real documentado en el plan principal)."
  }
]
