batch_update_documents
Update multiple Outline wiki documents simultaneously to modify titles, content, or append text in bulk operations.
Instructions
Update multiple documents at once.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| updates | Yes |
Implementation Reference
- src/lib/handlers/batch.ts:56-81 (handler)The core handler function that implements the batch_update_documents tool logic. It processes a list of updates, handling title changes, text updates (with optional append mode), and reports success/failure for each using the shared runBatch utility.async batch_update_documents(args: BatchUpdateDocumentsInput) { checkAccess(config, 'batch_update_documents'); return runBatch(args.updates, async (update) => { try { let text = update.text; if (update.append && update.text) { const { data: existing } = await apiCall(() => apiClient.post<OutlineDocument>('/documents.info', { id: update.documentId }) ); text = (existing.text || '') + '\n\n' + update.text; } const payload: Record<string, unknown> = { id: update.documentId }; if (update.title) payload.title = update.title; if (text !== undefined) payload.text = text; const { data } = await apiCall(() => apiClient.post<OutlineDocument>('/documents.update', payload) ); return { success: true, id: data.id, title: data.title }; } catch (error) { return { success: false, documentId: update.documentId, error: getErrorMessage(error) }; } }); },
- src/lib/schemas.ts:122-129 (schema)Zod schema defining the input structure for batch_update_documents, including an array of updates each with documentId, optional title/text, and append flag.export const batchUpdateDocumentsSchema = z.object({ updates: z.array(z.object({ documentId, title: z.string().min(1).optional(), text: z.string().optional(), append: z.boolean().default(false), })).min(1, 'At least one update is required'), });
- src/lib/tools.ts:178-182 (registration)Tool registration in the allTools array using createTool, which converts the Zod schema to JSON Schema for MCP tool definition.createTool( 'batch_update_documents', 'Update multiple documents at once.', 'batch_update_documents' ),
- src/lib/schemas.ts:196-196 (schema)TypeScript type derived from the batchUpdateDocumentsSchema for use in handler signatures.export type BatchUpdateDocumentsInput = z.infer<typeof batchUpdateDocumentsSchema>;
- src/lib/schemas.ts:239-239 (registration)Inclusion of the schema in the central toolSchemas map, referenced by tools.ts for JSON Schema conversion.batch_update_documents: batchUpdateDocumentsSchema,