Skip to main content
Glama

get_comment

Retrieve specific comment details by ID, including content and metadata, for reference or quoting purposes. Optionally include anchor text from the document the comment refers to.

Instructions

    Retrieves a specific comment by its ID.
    
    Use this tool when you need to:
    - View details of a specific comment
    - Reference or quote a particular comment
    - Check comment content and metadata
    - Find a comment mentioned elsewhere
    
    Args:
        comment_id: The comment ID to retrieve
        include_anchor_text: Whether to include the document text that 
            the comment refers to
        
    Returns:
        Formatted string with the comment content and metadata
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
comment_idYes
include_anchor_textNo

Implementation Reference

  • The core handler implementation for the 'get_comment' MCP tool. It fetches the comment details from the Outline API using comments.info endpoint, extracts metadata like author and date, formats the comment data as JSON, and returns a Markdown-formatted string with optional anchor text.
    @mcp.tool(
        annotations=ToolAnnotations(readOnlyHint=True, idempotentHint=True)
    )
    async def get_comment(
        comment_id: str, include_anchor_text: bool = False
    ) -> str:
        """
        Retrieves a specific comment by its ID.
    
        Use this tool when you need to:
        - View details of a specific comment
        - Reference or quote a particular comment
        - Check comment content and metadata
        - Find a comment mentioned elsewhere
    
        Args:
            comment_id: The comment ID to retrieve
            include_anchor_text: Whether to include the document text that
                the comment refers to
    
        Returns:
            Formatted string with the comment content and metadata
        """
        try:
            client = await get_outline_client()
            response = await client.post(
                "comments.info",
                {"id": comment_id, "includeAnchorText": include_anchor_text},
            )
            comment = response.get("data", {})
    
            if not comment:
                return "Comment not found."
    
            user = comment.get("createdBy", {}).get("name", "Unknown User")
            created_at = comment.get("createdAt", "")
            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"# Comment by {user}\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"
            else:
                output += "\n(No comment content found)\n"
    
            return output
        except OutlineClientError as e:
            return f"Error getting comment: {str(e)}"
        except Exception as e:
            return f"Unexpected error: {str(e)}"
  • Registration point where the document_collaboration module's register_tools function is called on the MCP server instance, thereby registering the get_comment tool along with other collaboration tools.
    document_collaboration.register_tools(mcp)
  • Higher-level registration call that invokes the documents module registration, which in turn registers the document_collaboration tools including get_comment.
    documents.register(mcp)

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