create_collection
Create a new collection in Outline wiki to organize documents with custom names, descriptions, and colors for better content management.
Instructions
Create a new collection.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| description | No | ||
| color | No |
Implementation Reference
- src/lib/handlers/collections.ts:29-40 (handler)The core handler function for the 'create_collection' tool. It validates access, constructs the payload from input args, calls the Outline API to create the collection, and returns the result with a success message.async create_collection(args: CreateCollectionInput) { checkAccess(config, 'create_collection'); const payload: Record<string, unknown> = { name: args.name }; if (args.description) payload.description = args.description; if (args.color) payload.color = args.color; const { data } = await apiCall(() => apiClient.post<OutlineCollection>('/collections.create', payload) ); return colResult(data, MESSAGES.COLLECTION_CREATED); },
- src/lib/schemas.ts:93-97 (schema)Zod schema defining the input structure for the 'create_collection' tool, including required name and optional description/color fields.export const createCollectionSchema = z.object({ name: z.string().min(1, 'Name is required'), description: z.string().optional(), color: hexColor.optional(), });
- src/lib/tools.ts:146-150 (registration)Registers the 'create_collection' tool in the allTools array, providing name, description, and linking to the Zod schema for MCP tool definition.createTool( 'create_collection', 'Create a new collection.', 'create_collection' ),
- src/lib/handlers/index.ts:23-23 (registration)Includes the createCollectionHandlers (which contains create_collection) into the combined ToolHandlers object via spread operator....createCollectionHandlers(ctx),
- src/lib/handlers/collections.ts:19-89 (registration)Factory function that creates and returns the handlers object including 'create_collection', injected with AppContext.export function createCollectionHandlers({ apiClient, apiCall, config }: AppContext) { const colResult = (col: OutlineCollection, message: string) => ({ id: col.id, name: col.name, description: col.description, color: col.color, message, }); return { async create_collection(args: CreateCollectionInput) { checkAccess(config, 'create_collection'); const payload: Record<string, unknown> = { name: args.name }; if (args.description) payload.description = args.description; if (args.color) payload.color = args.color; const { data } = await apiCall(() => apiClient.post<OutlineCollection>('/collections.create', payload) ); return colResult(data, MESSAGES.COLLECTION_CREATED); }, async update_collection(args: UpdateCollectionInput) { checkAccess(config, 'update_collection'); const payload: Record<string, unknown> = { id: args.collectionId }; if (args.name) payload.name = args.name; if (args.description !== undefined) payload.description = args.description; if (args.color) payload.color = args.color; const { data } = await apiCall(() => apiClient.post<OutlineCollection>('/collections.update', payload) ); return colResult(data, MESSAGES.COLLECTION_UPDATED); }, async delete_collection(args: DeleteCollectionInput) { checkAccess(config, 'delete_collection'); await apiCall(() => apiClient.post('/collections.delete', { id: args.collectionId }) ); return { success: true, collectionId: args.collectionId, message: MESSAGES.COLLECTION_DELETED }; }, async export_collection(args: ExportCollectionInput) { const { data } = await apiCall(() => apiClient.post<unknown>('/collections.export', { id: args.collectionId, format: args.format }) ); return { success: true, collectionId: args.collectionId, format: args.format, fileOperation: data, message: MESSAGES.COLLECTION_EXPORT_STARTED, }; }, async export_all_collections(args: ExportAllCollectionsInput) { const { data } = await apiCall(() => apiClient.post<unknown>('/collections.export_all', { format: args.format }) ); return { success: true, format: args.format, fileOperation: data, message: MESSAGES.COLLECTION_EXPORT_ALL_STARTED, }; }, }; }