Skip to main content
Glama

contentrain_status

Check project configuration, models, and context to monitor content structure and governance status in Contentrain MCP.

Instructions

Get full project status (read-only). Returns config, models, context. Do NOT manually edit .contentrain/ based on this output.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for 'contentrain_status' tool. Reads config, models, and context files, performs git branch cleanup/health checks, and returns project status.
    async () => {
      const crDir = contentrainDir(projectRoot)
      const initialized = await pathExists(join(crDir, 'config.json'))
    
      if (!initialized) {
        const detectedStack = await detectStack(projectRoot)
        return {
          content: [{
            type: 'text' as const,
            text: JSON.stringify({
              initialized: false,
              detected_stack: detectedStack,
              suggestion: 'Run contentrain_init to set up .contentrain/ structure',
              next_steps: ['Run contentrain_init'],
            }, null, 2),
          }],
        }
      }
    
      const config = await readConfig(projectRoot)
      const models = await listModels(projectRoot)
      const context = await readContext(projectRoot)
      const vocabulary = await readVocabulary(projectRoot)
    
      const errors: string[] = []
      if (!config) errors.push('.contentrain/config.json missing')
    
      const result: Record<string, unknown> = {
        initialized: true,
        config: config ? {
          stack: config.stack,
          workflow: config.workflow,
          locales: config.locales,
          domains: config.domains,
          repository: config.repository,
        } : null,
        models,
        context: context ? {
          lastOperation: context.lastOperation,
          stats: context.stats,
        } : null,
        vocabulary_size: vocabulary ? Object.keys(vocabulary.terms).length : 0,
      }
    
      // Branch lifecycle: lazy cleanup + health check (run BEFORE validation summary)
      const hasGitRepo = await pathExists(join(projectRoot, '.git'))
      if (hasGitRepo) {
        try {
          const cleanup = await cleanupMergedBranches(projectRoot)
          const health = await checkBranchHealth(projectRoot)
          result['branches'] = {
            total: health.total,
            merged: health.merged,
            unmerged: health.unmerged,
            cleaned_up: cleanup.deleted,
          }
          if (health.message) {
            result['branch_warning'] = health.message
          }
          if (health.blocked) {
            errors.push(health.message!)
          }
        } catch {
          // Branch health check is best-effort — don't fail status
        }
      }
    
      if (errors.length > 0) {
        result['validation'] = { errors: errors.length, warnings: 0, summary: errors }
      }
    
      const nextSteps: string[] = []
      if (models.length === 0) nextSteps.push('Create models with contentrain_model_save')
      if (errors.length > 0) nextSteps.push(`Fix ${errors.length} validation error(s)`)
      if (nextSteps.length === 0) nextSteps.push('Use contentrain_describe to inspect a model')
      result['next_steps'] = nextSteps
    
      return {
        content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2) }],
      }
    },
  • Registration of the 'contentrain_status' tool in the McpServer using server.tool().
    server.tool(
      'contentrain_status',
      'Get full project status (read-only). Returns config, models, context. Do NOT manually edit .contentrain/ based on this output.',
      {},
      async () => {
        const crDir = contentrainDir(projectRoot)
        const initialized = await pathExists(join(crDir, 'config.json'))
    
        if (!initialized) {
          const detectedStack = await detectStack(projectRoot)
          return {
            content: [{
              type: 'text' as const,
              text: JSON.stringify({
                initialized: false,
                detected_stack: detectedStack,
                suggestion: 'Run contentrain_init to set up .contentrain/ structure',
                next_steps: ['Run contentrain_init'],
              }, null, 2),
            }],
          }
        }
    
        const config = await readConfig(projectRoot)
        const models = await listModels(projectRoot)
        const context = await readContext(projectRoot)
        const vocabulary = await readVocabulary(projectRoot)
    
        const errors: string[] = []
        if (!config) errors.push('.contentrain/config.json missing')
    
        const result: Record<string, unknown> = {
          initialized: true,
          config: config ? {
            stack: config.stack,
            workflow: config.workflow,
            locales: config.locales,
            domains: config.domains,
            repository: config.repository,
          } : null,
          models,
          context: context ? {
            lastOperation: context.lastOperation,
            stats: context.stats,
          } : null,
          vocabulary_size: vocabulary ? Object.keys(vocabulary.terms).length : 0,
        }
    
        // Branch lifecycle: lazy cleanup + health check (run BEFORE validation summary)
        const hasGitRepo = await pathExists(join(projectRoot, '.git'))
        if (hasGitRepo) {
          try {
            const cleanup = await cleanupMergedBranches(projectRoot)
            const health = await checkBranchHealth(projectRoot)
            result['branches'] = {
              total: health.total,
              merged: health.merged,
              unmerged: health.unmerged,
              cleaned_up: cleanup.deleted,
            }
            if (health.message) {
              result['branch_warning'] = health.message
            }
            if (health.blocked) {
              errors.push(health.message!)
            }
          } catch {
            // Branch health check is best-effort — don't fail status
          }
        }
    
        if (errors.length > 0) {
          result['validation'] = { errors: errors.length, warnings: 0, summary: errors }
        }
    
        const nextSteps: string[] = []
        if (models.length === 0) nextSteps.push('Create models with contentrain_model_save')
        if (errors.length > 0) nextSteps.push(`Fix ${errors.length} validation error(s)`)
        if (nextSteps.length === 0) nextSteps.push('Use contentrain_describe to inspect a model')
        result['next_steps'] = nextSteps
    
        return {
          content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2) }],
        }
      },
    )
Behavior4/5

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

No annotations provided, so description carries full burden. Successfully discloses read-only nature, return payload categories (config, models, context), and implies filesystem access to .contentrain/ directory. Missing minor details like idempotency or caching behavior, but sufficient for a status tool.

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?

Perfect efficiency: Two sentences, zero waste. First sentence front-loads purpose, scope, and safety (read-only). Second sentence provides critical operational warning. Every word earns its place.

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

Completeness4/5

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

Adequate for a zero-parameter read tool. Compensates for missing output schema by listing return categories (config, models, context). Minor gap: doesn't specify output format (JSON vs text) or structure details, but 'Returns' implies the presence of data.

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

Parameters4/5

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

Zero parameters with 100% schema coverage (empty object). Baseline score of 4 applies as there are no parameters requiring semantic clarification beyond the schema.

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

Purpose5/5

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

Excellent specificity: 'Get full project status' provides clear verb (Get) and resource (project status). The parenthetical '(read-only)' and return value description ('config, models, context') clearly distinguish this from sibling mutation tools like contentrain_apply, contentrain_content_save, and contentrain_model_delete.

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

Usage Guidelines4/5

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

Provides explicit negative guidance: 'Do NOT manually edit .contentrain/ based on this output' warns against a specific misuse pattern. However, lacks positive guidance on when to choose this over similar inspection tools like contentrain_describe or contentrain_scan.

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/Contentrain/ai'

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