batch_create_documents
Create multiple documents simultaneously in Outline wiki by specifying titles, content, and collection placement in a single operation.
Instructions
Create multiple documents at once.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| documents | Yes |
Implementation Reference
- src/lib/handlers/batch.ts:35-54 (handler)The core handler function for the batch_create_documents tool. It iterates over the input documents, calls the Outline API's /documents.create endpoint for each, handles errors, and returns a batch summary with success/failure results.async batch_create_documents(args: BatchCreateDocumentsInput) { checkAccess(config, 'batch_create_documents'); return runBatch(args.documents, async (doc) => { try { const { data } = await apiCall(() => apiClient.post<OutlineDocument>('/documents.create', { title: doc.title, text: doc.text, collectionId: doc.collectionId, parentDocumentId: doc.parentDocumentId, publish: doc.publish, }) ); return { success: true, id: data.id, title: data.title }; } catch (error) { return { success: false, title: doc.title, error: getErrorMessage(error) }; } }); },
- src/lib/schemas.ts:112-120 (schema)Zod schema defining the input structure for batch_create_documents, including an array of document objects with title, text, collectionId, etc.export const batchCreateDocumentsSchema = z.object({ documents: z.array(z.object({ title: z.string().min(1), text: z.string().default(''), collectionId, parentDocumentId: z.string().uuid().optional(), publish: z.boolean().default(true), })).min(1, 'At least one document is required'), });
- src/lib/tools.ts:173-177 (registration)MCP tool registration in the allTools array. Converts the Zod schema to JSON Schema and defines the tool with name, description, and input schema.createTool( 'batch_create_documents', 'Create multiple documents at once.', 'batch_create_documents' ),