update_document
Modify existing documents by updating content, titles, types, or metadata within the Helios-9 project management system to maintain accurate project information.
Instructions
Update an existing document with new content or metadata
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| document_id | Yes | The unique identifier of the document to update | |
| title | No | New title for the document | |
| content | No | New markdown content for the document | |
| document_type | No | New document type | |
| metadata | No | Updated metadata for the document |
Implementation Reference
- src/tools/documents.ts:226-249 (handler)The core handler function for the 'update_document' MCP tool. Validates input using UpdateDocumentSchema, performs optional content analysis, updates the document via supabaseService.updateDocument, logs activity, and returns the updated document with analysis.export const updateDocument = requireAuth(async (args: any) => { const { document_id, ...updates } = UpdateDocumentSchema.parse(args) logger.info('Updating document', { document_id, updates: Object.keys(updates) }) // Analyze content if it's being updated let contentAnalysis = undefined if (updates.content) { const currentDoc = await supabaseService.getDocument(document_id) contentAnalysis = analyzeDocumentContentHelper(updates.content, updates.document_type || currentDoc.document_type) // Removed metadata updates as metadata doesn't exist in the database schema } const document = await supabaseService.updateDocument(document_id, updates) logger.info('Document updated successfully', { document_id: document.id }) return { document, content_analysis: contentAnalysis, message: `Document "${document.title}" updated successfully` } })
- src/tools/documents.ts:37-43 (schema)Zod schema defining the input validation for the update_document tool, including required document_id and optional fields like title, content, document_type, and metadata.const UpdateDocumentSchema = z.object({ document_id: z.string().uuid(), title: z.string().min(1).max(500).optional(), content: z.string().optional(), document_type: z.enum(['requirement', 'design', 'technical', 'meeting_notes', 'other']).optional(), metadata: z.record(z.any()).optional() })
- src/tools/documents.ts:191-224 (registration)MCPTool registration object for 'update_document', defining the tool name, description, and input schema structure for the MCP protocol.export const updateDocumentTool: MCPTool = { name: 'update_document', description: 'Update an existing document with new content or metadata', inputSchema: { type: 'object', properties: { document_id: { type: 'string', format: 'uuid', description: 'The unique identifier of the document to update' }, title: { type: 'string', minLength: 1, maxLength: 500, description: 'New title for the document' }, content: { type: 'string', description: 'New markdown content for the document' }, document_type: { type: 'string', enum: ['requirement', 'design', 'technical', 'meeting_notes', 'other'], description: 'New document type' }, metadata: { type: 'object', description: 'Updated metadata for the document' } }, required: ['document_id'] } }
- src/tools/documents.ts:1346-1358 (registration)Maps 'update_document' to its handler function updateDocument in the documentHandlers export, likely used for tool registration in the MCP system.export const documentHandlers = { list_documents: listDocuments, create_document: createDocument, get_document: getDocument, update_document: updateDocument, search_documents: searchDocuments, get_document_context: getDocumentContext, add_document_collaborator: addDocumentCollaborator, analyze_document_content: analyzeDocumentContent, get_document_collaboration: getDocumentCollaboration, generate_document_template: generateDocumentTemplate, bulk_document_operations: bulkDocumentOperations }
- src/tools/documents.ts:1361-1373 (registration)Exports updateDocumentTool as part of documentTools object, providing access to all document-related MCP tools including update_document.export const documentTools = { listDocumentsTool, createDocumentTool, getDocumentTool, updateDocumentTool, searchDocumentsTool, getDocumentContextTool, addDocumentCollaboratorTool, analyzeDocumentContentTool, getDocumentCollaborationTool, generateDocumentTemplateTool, bulkDocumentOperationsTool }