batch_archive_documents
Archive multiple Outline wiki documents simultaneously to manage document lifecycle and reduce clutter.
Instructions
Archive multiple documents at once.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| documentIds | Yes |
Implementation Reference
- src/lib/handlers/batch.ts:102-115 (handler)The core handler function for the 'batch_archive_documents' tool. It performs access check and batches API calls to archive each document using the Outline API's '/documents.archive' endpoint, collecting success/failure results.async batch_archive_documents(args: BatchArchiveDocumentsInput) { checkAccess(config, 'batch_archive_documents'); return runBatch(args.documentIds, async (documentId) => { try { const { data } = await apiCall(() => apiClient.post<OutlineDocument>('/documents.archive', { id: documentId }) ); return { success: true, id: data.id, title: data.title }; } catch (error) { return { success: false, documentId, error: getErrorMessage(error) }; } }); },
- src/lib/schemas.ts:137-137 (schema)Zod schema defining the input for batch_archive_documents: an array of document IDs.export const batchArchiveDocumentsSchema = z.object({ documentIds });
- src/lib/tools.ts:188-192 (registration)Registers the tool definition in the allTools array, specifying name, description, and referencing the schema.createTool( 'batch_archive_documents', 'Archive multiple documents at once.', 'batch_archive_documents' ),
- src/lib/schemas.ts:241-241 (registration)Maps the tool name to its schema in the central toolSchemas object used by tool definitions.batch_archive_documents: batchArchiveDocumentsSchema,
- src/lib/handlers/batch.ts:21-31 (helper)Generic helper function used by all batch handlers, including batch_archive_documents, to execute operations on a list of items and summarize results.async function runBatch<TItem>( items: TItem[], operation: (item: TItem) => Promise<BatchResult> ): Promise<BatchSummary> { const results: BatchResult[] = []; for (const item of items) { results.push(await operation(item)); } const succeeded = results.filter((r) => r.success).length; return { total: results.length, succeeded, failed: results.length - succeeded, results }; }