Skip to main content
Glama

export_document

Export document content as plain markdown text for external use, sharing, or processing in other applications without additional formatting.

Instructions

    Exports a document as plain markdown text.
    
    Use this tool when you need to:
    - Get clean markdown content without formatting
    - Extract document content for external use
    - Process document content in another application
    - Share document content outside Outline
    
    Args:
        document_id: The document ID to export
        
    Returns:
        Document content in markdown format without additional formatting
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
document_idYes

Implementation Reference

  • Core implementation of the export_document MCP tool. Retrieves markdown export of a document via the Outline API.
    async def export_document(document_id: str) -> str:
        """
        Exports a document as plain markdown text.
    
        Use this tool when you need to:
        - Get clean markdown content without formatting
        - Extract document content for external use
        - Process document content in another application
        - Share document content outside Outline
    
        Args:
            document_id: The document ID to export
    
        Returns:
            Document content in markdown format without additional formatting
        """
        try:
            client = await get_outline_client()
            response = await client.post(
                "documents.export", {"id": document_id}
            )
            return response.get("data", "No content available")
        except OutlineClientError as e:
            return f"Error exporting document: {str(e)}"
        except Exception as e:
            return f"Unexpected error: {str(e)}"
  • MCP tool registration decorator for export_document, specifying read-only and idempotent hints.
    @mcp.tool(
        annotations=ToolAnnotations(readOnlyHint=True, idempotentHint=True)
    )
  • Tool annotations defining behavioral hints (read-only, idempotent) used by MCP clients.
    annotations=ToolAnnotations(readOnlyHint=True, idempotentHint=True)
  • Helper function to create and authenticate the OutlineClient instance used by the export_document handler.
    async def get_outline_client() -> OutlineClient:
        """
        Get the document outline client (async).
    
        Returns:
            OutlineClient instance
    
        Raises:
            OutlineClientError: If client creation fails
        """
        try:
            # Get API credentials from environment variables
            api_key = os.getenv("OUTLINE_API_KEY")
            api_url = os.getenv("OUTLINE_API_URL")
    
            # Create an instance of the outline client
            client = OutlineClient(api_key=api_key, api_url=api_url)
    
            # Test the connection by attempting to get auth info
            _ = await client.auth_info()
    
            return client
        except OutlineError as e:
            raise OutlineClientError(f"Outline client error: {str(e)}")
        except Exception as e:
            raise OutlineClientError(f"Unexpected error: {str(e)}")
  • Function that registers both read_document and export_document tools on the MCP server instance.
    def register_tools(mcp) -> None:
        """
        Register document reading tools with the MCP server.
    
        Args:
            mcp: The FastMCP server instance
        """
    
        @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)}"
    
        @mcp.tool(
            annotations=ToolAnnotations(readOnlyHint=True, idempotentHint=True)
        )
        async def export_document(document_id: str) -> str:
            """
            Exports a document as plain markdown text.
    
            Use this tool when you need to:
            - Get clean markdown content without formatting
            - Extract document content for external use
            - Process document content in another application
            - Share document content outside Outline
    
            Args:
                document_id: The document ID to export
    
            Returns:
                Document content in markdown format without additional formatting
            """
            try:
                client = await get_outline_client()
                response = await client.post(
                    "documents.export", {"id": document_id}
                )
                return response.get("data", "No content available")
            except OutlineClientError as e:
                return f"Error exporting document: {str(e)}"
            except Exception as e:
                return f"Unexpected error: {str(e)}"
Behavior4/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 clearly states the tool exports content 'as plain markdown text' and 'without additional formatting,' which helps the agent understand the output behavior. However, it doesn't mention potential limitations like file size constraints, authentication requirements, or error conditions, leaving some behavioral aspects uncovered.

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

Conciseness5/5

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

The description is well-structured and front-loaded with the core purpose, followed by usage guidelines and parameter/return details. Every sentence adds value without redundancy, and the bulleted list enhances readability while maintaining efficiency. No wasted words or unnecessary elaboration.

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

Completeness4/5

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

Given the tool's moderate complexity (single parameter, no output schema, no annotations), the description is mostly complete. It covers purpose, usage, parameters, and returns adequately. However, it lacks details on error handling or output specifics beyond 'markdown format,' which could be important for an agent invoking the tool without an output schema.

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

Parameters4/5

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

The schema description coverage is 0%, so the description must compensate. It adds meaning by explaining that 'document_id' refers to 'The document ID to export,' clarifying the parameter's purpose beyond the schema's basic type information. However, it doesn't provide details on ID format or sourcing, which could be helpful given the lack of schema descriptions.

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 specific action ('Exports a document as plain markdown text') and resource ('document'), distinguishing it from siblings like 'read_document' (which likely returns formatted content) or 'export_collection' (which exports collections rather than individual documents). The verb 'exports' is precise and unambiguous.

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

Usage Guidelines5/5

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

The description provides explicit usage scenarios in a bulleted list ('when you need to: - Get clean markdown content without formatting - Extract document content for external use - Process document content in another application - Share document content outside Outline'), clearly indicating when to use this tool versus alternatives like 'read_document' (which might include formatting) or other export tools. It effectively guides the agent on appropriate contexts.

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