Skip to main content
Glama

update_document_lifecycle

Change document lifecycle states like draft, review, or published, and schedule reviews when needed for document management.

Instructions

Update the lifecycle state of a document with optional review scheduling

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
documentIdYesUUID of the document
newStateYesNew lifecycle state
reviewCommentNoOptional review comment
scheduledReviewNoISO datetime for scheduled review

Implementation Reference

  • The main handler function that executes the tool logic: updates document state via lifecycleService, schedules reviews if provided, fetches updated document, and returns confirmation details.
    tools.set('update_document_lifecycle', async (args: any) => {
      try {
        logger.info(`Updating document ${args.documentId} to state: ${args.newState}`);
        
        // Update document state
        await lifecycleService.updateDocumentState(args.documentId, args.newState);
        
        // Schedule review if provided
        if (args.scheduledReview) {
          await lifecycleService.scheduleReview(args.documentId, args.scheduledReview);
        }
        
        // Get updated document for confirmation
        const document = await lifecycleService.getDocumentById(args.documentId);
        
        return {
          success: true,
          document: document?.title || 'Unknown',
          newState: args.newState,
          reviewComment: args.reviewComment,
          scheduledReview: args.scheduledReview ? localizationService.formatDateTime(new Date(args.scheduledReview)) : null,
          updatedAt: localizationService.getCurrentDateTimeString()
        };
      } catch (error) {
        logger.error('Failed to update document lifecycle:', error);
        throw error;
      }
    });
  • Zod schema defining input validation for the update_document_lifecycle tool parameters.
    export const UpdateDocumentLifecycleSchema = z.object({
      documentId: z.string().uuid(),
      newState: z.nativeEnum(DocumentLifecycleState),
      reviewComment: z.string().optional(),
      scheduledReview: z.string().datetime().optional(),
    });
  • Tool registration entry defining name, description, and JSON input schema.
    {
      name: 'update_document_lifecycle',
      description: 'Update the lifecycle state of a document with optional review scheduling',
      inputSchema: {
        type: 'object',
        properties: {
          documentId: {
            type: 'string',
            description: 'UUID of the document'
          },
          newState: {
            type: 'string',
            enum: ['draft', 'review', 'approved', 'published', 'outdated', 'archived'],
            description: 'New lifecycle state'
          },
          reviewComment: {
            type: 'string',
            description: 'Optional review comment'
          },
          scheduledReview: {
            type: 'string',
            description: 'ISO datetime for scheduled review'
          }
        },
        required: ['documentId', 'newState']
      }
    },

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/Ghostseller/CastPlan_mcp'

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