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
| Name | Required | Description | Default |
|---|---|---|---|
| document_id | Yes |
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} """
- src/mcp_outline/features/documents/__init__.py:30-33 (registration)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)
- src/mcp_outline/features/__init__.py:15-17 (registration)Top-level registration call to documents.register which includes read_document tool.# Register document management features documents.register(mcp)