Skip to main content
Glama

batch_update_documents

Update multiple Outline wiki documents simultaneously to modify titles, content, or append text efficiently.

Instructions

Update multiple documents at once.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
updatesYes

Implementation Reference

  • The core handler function that executes the batch_update_documents tool logic. It processes an array of updates, optionally appending text to existing documents, and calls the Outline API to update each document. Uses runBatch helper to handle batch execution and return summary.
    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 defining the input structure for batch_update_documents tool, including an array of updates 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'), });
  • Tool registration in the allTools array, converting the Zod schema to JSON Schema for MCP tool definition.
    createTool( 'batch_update_documents', 'Update multiple documents at once.', 'batch_update_documents' ),
  • Generic helper function used by batch_update_documents (and other batch handlers) to execute an operation on each item in a batch and compute summary statistics.
    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 tool name to its schema in the central toolSchemas object, used by tool registration.
    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-smart-mcp'

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