Skip to main content
Glama

contentrain_content_delete

Delete content entries or specific dictionary keys from Contentrain MCP. Changes are automatically committed to git after confirmation.

Instructions

Delete content entries. For dictionaries, use "keys" to remove specific keys (omit to delete entire locale file). Changes are auto-committed to git — do NOT manually edit .contentrain/ files after calling this tool.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelYesModel ID
idNoEntry ID (collection)
slugNoSlug (document)
localeNoLocale code
keysNoDictionary only: specific keys to remove. Omit to delete entire locale file.
confirmYesMust be true to confirm deletion

Implementation Reference

  • The handler function that executes the content deletion, including transaction management, branch health checks, and calling the underlying deleteContent logic.
    async (input) => {
      const config = await readConfig(projectRoot)
      if (!config) {
        return {
          content: [{ type: 'text' as const, text: JSON.stringify({ error: 'Project not initialized.' }) }],
          isError: true,
        }
      }
    
      const model = await readModel(projectRoot, input.model)
      if (!model) {
        return {
          content: [{ type: 'text' as const, text: JSON.stringify({ error: `Model "${input.model}" not found` }) }],
          isError: true,
        }
      }
    
      // Branch health gate
      const deleteHealth = await checkBranchHealth(projectRoot)
      if (deleteHealth.blocked) {
        return {
          content: [{ type: 'text' as const, text: JSON.stringify({
            error: deleteHealth.message,
            action: 'blocked',
            hint: 'Merge or delete old contentrain/* branches before creating new ones.',
          }, null, 2) }],
          isError: true,
        }
      }
    
      const branch = buildBranchName('content', input.model)
      const tx = await createTransaction(projectRoot, branch)
    
      try {
        let removed: string[] = []
    
        await tx.write(async (wt) => {
          removed = await deleteContent(wt, model, {
            id: input.id,
            slug: input.slug,
            locale: input.locale,
            keys: input.keys,
          })
        })
    
        await tx.commit(`[contentrain] delete content: ${input.model}`)
        const gitResult = await tx.complete({
          tool: 'contentrain_content_delete',
          model: input.model,
          locale: input.locale,
        })
    
        return {
          content: [{ type: 'text' as const, text: JSON.stringify({
            status: 'committed',
            message: 'Content deleted and committed to git. Do NOT manually edit .contentrain/ files.',
            deleted: true,
            files_removed: removed,
            git: { branch, action: gitResult.action, commit: gitResult.commit },
            context_updated: true,
          }, null, 2) }],
        }
      } catch (error) {
        await tx.cleanup()
        return {
          content: [{ type: 'text' as const, text: JSON.stringify({
            error: `Delete failed: ${error instanceof Error ? error.message : String(error)}`,
          }) }],
          isError: true,
        }
      } finally {
        await tx.cleanup()
      }
    },
  • The input schema defining parameters for the content deletion tool, including model, id, slug, locale, keys, and confirmation.
    {
      model: z.string().describe('Model ID'),
      id: z.string().optional().describe('Entry ID (collection)'),
      slug: z.string().optional().describe('Slug (document)'),
      locale: z.string().optional().describe('Locale code'),
      keys: z.array(z.string()).optional().describe('Dictionary only: specific keys to remove. Omit to delete entire locale file.'),
      confirm: z.literal(true).describe('Must be true to confirm deletion'),
    },
  • Registration of the 'contentrain_content_delete' tool within the MCP server instance.
    server.tool(
      'contentrain_content_delete',
      'Delete content entries. For dictionaries, use "keys" to remove specific keys (omit to delete entire locale file). Changes are auto-committed to git — do NOT manually edit .contentrain/ files after calling this tool.',
Behavior4/5

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

With no annotations provided, the description carries full burden and succeeds in disclosing that changes are 'auto-committed to git'—crucial behavioral context for a deletion tool. It also warns against manual file edits. Could improve by stating whether deletions are irreversible or describing error behavior on missing entries.

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?

Three sentences with zero waste: sentence 1 states purpose, sentence 2 covers dictionary-specific usage, sentence 3 gives the git/manual-edit warning. Information is front-loaded and every clause 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?

For a 6-parameter destructive operation with no output schema or annotations, the description adequately covers the git side-effect, confirmation requirement, and dictionary nuances. Minor gap: does not describe what happens when required identifiers (id/slug) are missing or the return value on success.

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?

While the schema has 100% description coverage (baseline 3), the description adds valuable semantic context that 'keys' is specifically for dictionary partial deletion versus full locale file removal. This adds meaning beyond the schema's technical description of the parameter.

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?

The description opens with 'Delete content entries'—a specific verb plus clear resource. It distinguishes from the sibling 'contentrain_model_delete' by targeting entries rather than models, and clarifies it handles both collections (via id) and documents (via slug).

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 clear guidance on when to use the 'keys' parameter versus omitting it for dictionary operations. Includes a critical warning not to manually edit .contentrain/ files post-invocation. Lacks explicit naming of sibling alternatives (e.g., when to use contentrain_content_save instead), preventing a 5.

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