Skip to main content
Glama
jakedx6
by jakedx6

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
NameRequiredDescriptionDefault
document_idYesThe unique identifier of the document to update
titleNoNew title for the document
contentNoNew markdown content for the document
document_typeNoNew document type
metadataNoUpdated metadata for the document

Implementation Reference

  • 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` } })
  • 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() })
  • 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'] } }
  • 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 }
  • 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 }

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/jakedx6/helios9-MCP-Server'

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