Skip to main content
Glama

list_document_comments

Retrieve and paginate comments on a specific document to review feedback, track collaboration, or find specific input from users. Supports optional anchor text inclusion.

Instructions

    Retrieves comments on a specific document with pagination support.
    
    IMPORTANT: By default, this returns up to 25 comments at a time. If 
    there are more than 25 comments on the document, you'll need to make 
    multiple calls with different offset values to get all comments. The 
    response will indicate if there 
    are more comments available.
    
    Use this tool when you need to:
    - Review feedback and discussions on a document
    - See all comments from different users
    - Find specific comments or questions
    - Track collaboration and input on documents
    
    Args:
        document_id: The document ID to get comments from
        include_anchor_text: Whether to include the document text that 
            comments refer to
        limit: Maximum number of comments to return (default: 25)
        offset: Number of comments to skip for pagination (default: 0)
        
    Returns:
        Formatted string containing comments with author, date, and 
        optional anchor text
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
document_idYes
include_anchor_textNo
limitNo
offsetNo

Implementation Reference

  • The main execution logic for the list_document_comments tool. Fetches comments via Outline API, handles pagination, and formats output using _format_comments.
    async def list_document_comments(
        document_id: str,
        include_anchor_text: bool = False,
        limit: int = 25,
        offset: int = 0,
    ) -> str:
        """
        Retrieves comments on a specific document with pagination support.
    
        IMPORTANT: By default, this returns up to 25 comments at a time. If
        there are more than 25 comments on the document, you'll need to make
        multiple calls with different offset values to get all comments. The
        response will indicate if there
        are more comments available.
    
        Use this tool when you need to:
        - Review feedback and discussions on a document
        - See all comments from different users
        - Find specific comments or questions
        - Track collaboration and input on documents
    
        Args:
            document_id: The document ID to get comments from
            include_anchor_text: Whether to include the document text that
                comments refer to
            limit: Maximum number of comments to return (default: 25)
            offset: Number of comments to skip for pagination (default: 0)
    
        Returns:
            Formatted string containing comments with author, date, and
            optional anchor text
        """
        try:
            client = await get_outline_client()
            data = {
                "documentId": document_id,
                "includeAnchorText": include_anchor_text,
                "limit": limit,
                "offset": offset,
            }
    
            response = await client.post("comments.list", data)
            comments = response.get("data", [])
            pagination = response.get("pagination", {})
    
            total_count = pagination.get("total", len(comments))
            return _format_comments(comments, total_count, limit, offset)
        except OutlineClientError as e:
            return f"Error listing comments: {str(e)}"
        except Exception as e:
            return f"Unexpected error: {str(e)}"
  • Registers the list_document_comments tool with the MCP server using the @mcp.tool decorator inside register_tools.
    @mcp.tool(
        annotations=ToolAnnotations(readOnlyHint=True, idempotentHint=True)
    )
  • Supporting function that formats the raw comments data into a human-readable markdown string with pagination and metadata.
    def _format_comments(
        comments: List[Dict[str, Any]],
        total_count: int = 0,
        limit: int = 25,
        offset: int = 0,
    ) -> str:
        """Format document comments into readable text."""
        if not comments:
            return "No comments found for this document."
    
        output = "# Document Comments\n\n"
    
        # Add pagination info if provided
        if total_count:
            shown_range = (
                f"{offset + 1}-{min(offset + len(comments), total_count)}"
            )
            output += f"Showing comments {shown_range} of {total_count} total\n\n"
    
            # Add warning if there might be more comments than shown
            if len(comments) == limit:
                output += "Note: Only showing the first batch of comments. "
                output += f"Use offset={offset + limit} to see more comments.\n\n"
    
        for i, comment in enumerate(comments, offset + 1):
            user = comment.get("createdBy", {}).get("name", "Unknown User")
            created_at = comment.get("createdAt", "")
            comment_id = comment.get("id", "")
            anchor_text = comment.get("anchorText", "")
    
            # Extract data object containing the comment content
            data = comment.get("data", {})
    
            # Convert data to JSON string for display
            try:
                import json
    
                text = json.dumps(data, indent=2)
            except Exception:
                text = str(data)
    
            output += f"## {i}. Comment by {user}\n"
            output += f"ID: {comment_id}\n"
            if created_at:
                output += f"Date: {created_at}\n"
            if anchor_text:
                output += f'\nReferencing text: "{anchor_text}"\n'
            if data:
                output += f"\nComment content:\n```json\n{text}\n```\n\n"
            else:
                output += "\n(No comment content found)\n\n"
    
        return output
  • Higher-level registration that invokes register_tools from document_collaboration module, making list_document_comments available.
    document_collaboration.register_tools(mcp)
  • Function signature with type hints and defaults defining the input schema (parameters) and output type (str). Docstring provides detailed description.
    async def list_document_comments(
        document_id: str,
        include_anchor_text: bool = False,
        limit: int = 25,
        offset: int = 0,
    ) -> str:
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behavioral traits: it's a read operation (implied by 'retrieves'), includes pagination details (default limit of 25, need for multiple calls with offset, response indicates more available), and specifies the return format (formatted string with author, date, optional anchor text). This covers essential aspects like output format and operational constraints.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (overview, important note, usage guidelines, args, returns) and front-loaded key information. However, the usage guidelines bullet points are somewhat redundant (e.g., 'Review feedback' and 'See all comments' overlap), and the overall length could be slightly trimmed without losing value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (4 parameters, no annotations, no output schema), the description is complete enough. It covers purpose, usage, behavioral details (pagination, output format), and parameter semantics. The lack of output schema is mitigated by describing the return value as a 'formatted string containing comments with author, date, and optional anchor text,' providing adequate context for the agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must fully compensate. It adds significant meaning beyond the schema by explaining each parameter: 'document_id' specifies the target document, 'include_anchor_text' clarifies it's about document text references, 'limit' notes the default and purpose (maximum comments), and 'offset' explains its role in pagination. This provides complete parameter semantics not covered in the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool 'retrieves comments on a specific document with pagination support,' which is a specific verb+resource combination. It distinguishes itself from siblings like 'get_comment' (singular) and 'add_comment' (write operation) by focusing on listing multiple comments with pagination.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit usage scenarios ('Use this tool when you need to:') with four bullet points that clearly define the context for using this tool. However, it does not explicitly state when NOT to use it or name specific alternatives among the sibling tools (e.g., 'get_comment' for a single comment).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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/Vortiago/mcp-outline'

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