codemap_template_edit

Edit an existing code template with updated content

templateseditupdatemodify

Parameters

NameTypeRequiredDescription
namestring✅ RequiredTemplate name
contentstring✅ RequiredUpdated template content

Usage Examples

MCP Usage (for AI Agents like Claude)

json
{
  "name": "codemap_template_edit",
  "arguments": {
    "name": "mcp-tool",
    "content": "/* Updated template with improvements */"
  }
}

Example Output

JSON Response

json
{
  "success": true,
  "message": "Template 'mcp-tool' updated successfully",
  "name": "mcp-tool",
  "path": ".codemap/templates/mcp-tool.txt"
}
ℹ️When to Use This Tool
    Use codemap_template_edit when you need to:
  • Update existing templates with improved patterns
  • Fix bugs or issues in template code
  • Add new placeholders to existing templates
  • Modernize templates to match current project standards
  • Update templates after team feedback or code reviews
💡Common Patterns
Template Improvement Pattern
1. Deploy template and test it
2. Identify issues or improvements
3. Edit template with fixes
4. Test again with new deployment


Iteratively improve templates based on actual usage.

Version Update Pattern
1. Keep old template (rename to template-v1)
2. Edit main template with new version
3. Gradually migrate to new version
💡Pro Tips
  • Must exist: Template must already exist - use template_add to create new ones
  • Complete replacement: Edit replaces entire template content, not partial updates
  • Test after edit: Always deploy and test templates after editing to verify changes work
  • Affects future only: Editing doesn't change already-deployed files - only future deployments use new version
Best Practices
  • Test template changes by deploying to a test file before updating the main template
  • Document what changed in commit messages when editing templates
  • Consider versioning templates (template-name-v2) for breaking changes
  • Review with team before editing shared templates
  • Keep templates focused and single-purpose
⚠️Common Mistakes
Mistake: Editing without testing the new content first
Instead: Deploy the new template content to a test file to verify it works before editing the template

Mistake: Making breaking changes to templates used across the team
Instead: Create a new versioned template (component-v2) for breaking changes

Mistake: Forgetting that edit replaces the entire template
Instead: Get the current template content first if you only want to make small changes

Mistake: Using edit to create a new template
Instead: Use template_add to create new templates - edit is only for existing ones

Related Tools