update_document
Modify existing documents in Outline wiki by editing titles, content, or appending new information to maintain current documentation.
Instructions
Update an existing document. Can append content with append mode.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| documentId | Yes | ||
| title | No | ||
| text | No | ||
| append | No |
Implementation Reference
- src/lib/handlers/documents.ts:70-89 (handler)The core handler function for the 'update_document' tool. It handles optional append mode by fetching current content, builds the payload for title and/or text updates, calls the Outline API '/documents.update', and returns a formatted result with document info and success message.async update_document(args: UpdateDocumentInput) { checkAccess(config, 'update_document'); let text = args.text; if (args.append && args.text) { const { data: existing } = await apiCall(() => apiClient.post<OutlineDocument>('/documents.info', { id: args.documentId }) ); text = (existing.text || '') + '\n\n' + args.text; } const payload: Record<string, unknown> = { id: args.documentId }; if (args.title) payload.title = args.title; if (text !== undefined) payload.text = text; const { data } = await apiCall(() => apiClient.post<OutlineDocument>('/documents.update', payload) ); return docResult(data, MESSAGES.DOCUMENT_UPDATED); },
- src/lib/schemas.ts:50-55 (schema)Zod schema defining the input parameters for the update_document tool: required documentId, optional title and text, and append boolean flag.export const updateDocumentSchema = z.object({ documentId, title: z.string().min(1).optional(), text: z.string().optional(), append: z.boolean().default(false), });
- src/lib/tools.ts:80-84 (registration)Registers the 'update_document' tool in the allTools array for MCP, providing name, description, and reference to its Zod schema via createTool.createTool( 'update_document', 'Update an existing document. Can append content with append mode.', 'update_document' ),
- src/lib/schemas.ts:178-178 (schema)TypeScript type inferred from updateDocumentSchema for use in handler function signatures.export type UpdateDocumentInput = z.infer<typeof updateDocumentSchema>;
- src/lib/schemas.ts:221-221 (registration)Maps the tool name 'update_document' to its schema in the central toolSchemas object used by tool definitions.update_document: updateDocumentSchema,