Skip to main content
Glama

read_document

Retrieve and display the full content of a specific document using the document ID. Use this tool to review, quote, reference, or analyze detailed document information within the MCP Outline Server.

Instructions

    Retrieves and displays the full content of a document.
    
    Use this tool when you need to:
    - Access the complete content of a specific document
    - Review document information in detail
    - Quote or reference document content
    - Analyze document contents
    
    Args:
        document_id: The document ID to retrieve
        
    Returns:
        Formatted string containing the document title and content
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
document_idYes

Implementation Reference

  • The handler function for the read_document tool, registered via @mcp.tool decorator. Fetches document content from Outline API and formats it for display.
    @mcp.tool(
        annotations=ToolAnnotations(readOnlyHint=True, idempotentHint=True)
    )
    async def read_document(document_id: str) -> str:
        """
        Retrieves and displays the full content of a document.
    
        Use this tool when you need to:
        - Access the complete content of a specific document
        - Review document information in detail
        - Quote or reference document content
        - Analyze document contents
    
        Args:
            document_id: The document ID to retrieve
    
        Returns:
            Formatted string containing the document title and content
        """
        try:
            client = await get_outline_client()
            document = await client.get_document(document_id)
            return _format_document_content(document)
        except OutlineClientError as e:
            return f"Error reading document: {str(e)}"
        except Exception as e:
            return f"Unexpected error: {str(e)}"
  • Helper function to format the raw document dictionary into a markdown string with title and content.
    def _format_document_content(document: Dict[str, Any]) -> str:
        """Format document content into readable text."""
        title = document.get("title", "Untitled Document")
        text = document.get("text", "")
    
        return f"""# {title}
    
    {text}
    """
  • Registers the document_reading module's tools, including read_document, as part of document features.
    document_search.register_tools(mcp)
    document_reading.register_tools(mcp)
    document_collaboration.register_tools(mcp)
    collection_tools.register_tools(mcp)
  • Top-level registration call to documents.register which includes read_document tool.
    # Register document management features
    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