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']
      }
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It indicates a mutation operation ('update') and hints at scheduling, but fails to cover critical aspects such as required permissions, whether changes are reversible, error handling, or rate limits. This leaves significant gaps for a tool that modifies document states.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose ('update the lifecycle state') and includes a key feature ('optional review scheduling') without any wasted words. It is appropriately sized and structured for quick comprehension.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of updating document lifecycle states, no annotations, and no output schema, the description is insufficient. It lacks details on behavioral traits, error cases, return values, and how it integrates with sibling tools, making it incomplete for safe and effective use by an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds minimal value beyond the input schema, which has 100% coverage with clear descriptions for all parameters. It mentions 'optional review scheduling', aligning with the 'scheduledReview' parameter, but does not provide additional context like format details or usage examples. The baseline score of 3 reflects adequate but not enhanced parameter understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'update' and the resource 'lifecycle state of a document', specifying the action and target. However, it does not explicitly distinguish this tool from sibling tools like 'docs_update', which might handle general document updates, leaving some ambiguity in differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description mentions 'optional review scheduling', implying usage for review-related states, but provides no explicit guidance on when to use this tool versus alternatives like 'docs_update' or 'track_document_work'. There are no prerequisites, exclusions, or named alternatives stated, resulting in minimal usage direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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