Skip to main content
Glama

create_collection

Organize documents by creating a new section or category, setting up project workspaces, or grouping content by department or topic. Customize with a name, optional description, and color for easy identification.

Instructions

    Creates a new collection for organizing documents.
    
    Use this tool when you need to:
    - Create a new section or category for documents
    - Set up a workspace for a new project or team
    - Organize content by department or topic
    - Establish a separate space for related documents
    
    Args:
        name: Name for the collection
        description: Optional description of the collection's purpose
        color: Optional hex color code for visual identification 
(e.g. #FF0000)
        
    Returns:
        Result message with the new collection ID
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
colorNo
descriptionNo
nameYes

Implementation Reference

  • The MCP tool handler function that creates a new collection. It calls the OutlineClient helper and returns a success message with the collection ID.
    async def create_collection(
        name: str, description: str = "", color: Optional[str] = None
    ) -> str:
        """
        Creates a new collection for organizing documents.
    
        Use this tool when you need to:
        - Create a new section or category for documents
        - Set up a workspace for a new project or team
        - Organize content by department or topic
        - Establish a separate space for related documents
    
        Args:
            name: Name for the collection
            description: Optional description of the collection's
                purpose
            color: Optional hex color code for visual
                identification (e.g. #FF0000)
    
        Returns:
            Result message with the new collection ID
        """
        try:
            client = await get_outline_client()
            collection = await client.create_collection(
                name, description, color
            )
    
            if not collection:
                return "Failed to create collection."
    
            collection_id = collection.get("id", "unknown")
            collection_name = collection.get("name", "Untitled")
    
            return (
                f"Collection created successfully: {collection_name} "
                f"(ID: {collection_id})"
            )
        except OutlineClientError as e:
            return f"Error creating collection: {str(e)}"
        except Exception as e:
            return f"Unexpected error: {str(e)}"
  • OutlineClient helper method that performs the actual API POST request to create the collection.
    async def create_collection(
        self, name: str, description: str = "", color: Optional[str] = None
    ) -> Dict[str, Any]:
        """
        Create a new collection.
    
        Args:
            name: The name of the collection
            description: Optional description for the collection
            color: Optional hex color code for the collection
    
        Returns:
            The created collection data
        """
        data: Dict[str, Any] = {"name": name, "description": description}
    
        if color:
            data["color"] = color
    
        response = await self.post("collections.create", data)
        return response.get("data", {})
  • Registration call for collection tools module during documents feature setup. This invokes the register_tools function that defines and registers the create_collection tool.
    collection_tools.register_tools(mcp)
  • The @mcp.tool decorator that registers the create_collection handler with the MCP server, including tool annotations.
    @mcp.tool(
        annotations=ToolAnnotations(
            readOnlyHint=False,
            destructiveHint=False,
            idempotentHint=False,
        )
    )

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