update_document
Modify existing documents by updating content, titles, types, or metadata in the Helios-9 MCP Server's project management system.
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. It validates input using UpdateDocumentSchema, performs content analysis if content is updated, calls supabaseService.updateDocument, 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 for validating input parameters to the update_document tool.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 definition for 'update_document', including name, description, and inputSchema for the tool registry.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)Object mapping tool names to their handler functions, including 'update_document': updateDocument. Likely used for tool registration in the MCP server.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/lib/api-client.ts:480-487 (helper)Underlying API client method supabaseService.updateDocument that performs the actual database update via PATCH /api/mcp/documents/{documentId}.async updateDocument(documentId: string, updates: Partial<Document>): Promise<Document> { const response = await this.request<{ document: Document }>(`/api/mcp/documents/${documentId}`, { method: 'PATCH', body: JSON.stringify(updates), }) return response.document }