Skip to main content
Glama

create_document

Create new documents in a specified collection for knowledge bases, guides, or notes. Add content via markdown, nest under parent documents, and publish immediately or save as draft.

Instructions

    Creates a new document in a specified collection.
    
    Use this tool when you need to:
    - Add new content to a knowledge base
    - Create documentation, guides, or notes
    - Add a child document to an existing parent
    - Start a new document thread or topic
    
    Args:
        title: The document title
        collection_id: The collection ID to create the document in
        text: Optional markdown content for the document
        parent_document_id: Optional parent document ID for nesting
        publish: Whether to publish the document immediately (True) or 
            save as draft (False)
        
    Returns:
        Result message with the new document ID
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collection_idYes
parent_document_idNo
publishNo
textNo
titleYes

Implementation Reference

  • The core handler function for the 'create_document' tool. It uses the OutlineClient to POST to 'documents.create' endpoint with the provided title, collection_id, text, parent, and publish parameters.
    @mcp.tool(
        annotations=ToolAnnotations(
            readOnlyHint=False,
            destructiveHint=False,
            idempotentHint=False,
        )
    )
    async def create_document(
        title: str,
        collection_id: str,
        text: str = "",
        parent_document_id: Optional[str] = None,
        publish: bool = True,
    ) -> str:
        """
        Creates a new document in a specified collection.
    
        Use this tool when you need to:
        - Add new content to a knowledge base
        - Create documentation, guides, or notes
        - Add a child document to an existing parent
        - Start a new document thread or topic
    
        Note: For Mermaid diagrams, use ```mermaidjs (not ```mermaid)
        as the code fence language identifier for proper rendering.
    
        Args:
            title: The document title
            collection_id: The collection ID to create the document in
            text: Optional markdown content for the document
            parent_document_id: Optional parent document ID for nesting
            publish: Whether to publish the document immediately (True) or
                save as draft (False)
    
        Returns:
            Result message with the new document ID
        """
        try:
            client = await get_outline_client()
    
            data = {
                "title": title,
                "text": text,
                "collectionId": collection_id,
                "publish": publish,
            }
    
            if parent_document_id:
                data["parentDocumentId"] = parent_document_id
    
            response = await client.post("documents.create", data)
            document = response.get("data", {})
    
            if not document:
                return "Failed to create document."
    
            doc_id = document.get("id", "unknown")
            doc_title = document.get("title", "Untitled")
    
            return f"Document created successfully: {doc_title} (ID: {doc_id})"
        except OutlineClientError as e:
            return f"Error creating document: {str(e)}"
        except Exception as e:
            return f"Unexpected error: {str(e)}"
  • Conditional registration of write tools including document_content.register_tools(mcp) which registers the create_document handler, only when OUTLINE_READ_ONLY is not set.
    # Conditionally register write tools (disabled in read-only mode)
    if os.getenv("OUTLINE_READ_ONLY", "").lower() not in (
        "true",
        "1",
        "yes",
    ):
        document_content.register_tools(mcp)
        document_lifecycle.register_tools(mcp)
        document_organization.register_tools(mcp)
        batch_operations.register_tools(mcp)
  • The register function that orchestrates registration of all document tools, calling document_content.register_tools among others conditionally.
    def register(
        mcp, api_key: Optional[str] = None, api_url: Optional[str] = None
  • The function signature defines the input schema via type hints: title (str required), collection_id (str required), text (str optional), parent_document_id (str optional), publish (bool default True). Returns str message with new doc ID.
    async def create_document(
        title: str,
        collection_id: str,
        text: str = "",
        parent_document_id: Optional[str] = None,
        publish: bool = True,
    ) -> str:
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 effectively describes the core behavior (creating documents with optional nesting and publish/draft status) and mentions the return format ('Result message with the new document ID'). However, it doesn't cover potential side effects like permissions needed, rate limits, or error conditions, which would be helpful for a mutation tool.

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 details. Every sentence earns its place by providing essential information without redundancy. The bulleted lists enhance readability while maintaining efficiency.

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 complexity (5 parameters, mutation operation) and lack of annotations/output schema, the description does an excellent job covering purpose, usage, and parameters. However, it doesn't fully address behavioral aspects like authentication requirements, error handling, or what happens if 'collection_id' is invalid, leaving minor gaps for a mutation tool.

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?

The description adds significant meaning beyond the input schema, which has 0% description coverage. It explains each parameter's purpose: 'title' as the document title, 'collection_id' as where to create it, 'text' as optional markdown content, 'parent_document_id' for nesting, and 'publish' for immediate publication vs. draft. This fully compensates for the schema's lack of 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 ('Creates a new document') and resource ('in a specified collection'), distinguishing it from siblings like 'create_collection' (which creates collections) and 'update_document' (which modifies existing documents). The verb+resource combination 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: 'Add new content to a knowledge base', 'Create documentation, guides, or notes', 'Add a child document to an existing parent', and 'Start a new document thread or topic'. This gives clear context for when to use this tool versus alternatives like 'update_document' or 'add_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