Skip to main content
Glama
jakedx6

Helios-9 MCP Server

by jakedx6

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

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