Skip to main content
Glama

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
NameRequiredDescriptionDefault
updatesYes

Implementation Reference

  • The primary handler function for the 'batch_update_documents' tool. It processes a list of document updates, handles optional text appending by fetching existing content, constructs the API payload, calls the Outline API's documents.update endpoint for each, and returns batch results with success/failure status.
    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) }; } }); },
  • Zod schema definition for the batch_update_documents tool input, validating an array of updates each containing 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'), });
  • Registration of the 'batch_update_documents' tool in the allTools array, creating its JSON schema definition from the Zod schema for MCP protocol.
    createTool( 'batch_update_documents', 'Update multiple documents at once.', 'batch_update_documents' ),
  • Generic helper function runBatch used by batch_update_documents (and other batch handlers) to execute operations on an array of items and aggregate results into a BatchSummary.
    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 }; }
  • Mapping of the batch_update_documents tool name to its Zod schema in the central toolSchemas record.
    batch_update_documents: batchUpdateDocumentsSchema,

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/huiseo/outline-wiki-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server