-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
Bug Description
The addTag and removeTag operations in n8n_update_partial_workflow report success but tags are not actually persisted on the workflow.
Root Cause
Two issues in workflow-diff-engine.js:
-
Wrong API endpoint: The diff engine modifies
workflow.tagsin-memory, then sends the updated workflow viaPUT /api/v1/workflows/{id}. However, the n8n API ignores thetagsfield in this endpoint. Tags must be managed via the dedicatedPUT /api/v1/workflows/{id}/tagsendpoint. -
Type mismatch:
applyAddTag()pushes a plain string intoworkflow.tags, but the array contains tag objects ({id, name, createdAt, updatedAt}). Even if the API accepted tags in the workflow PUT, the format would be wrong.
Steps to Reproduce
// 1. Check current tags on a workflow
n8n_get_workflow({ id: "workflow_id", mode: "minimal" })
// Returns: tags: [{ id: "abc", name: "EXISTING_TAG" }]
// 2. Try to add a tag
n8n_update_partial_workflow({
id: "workflow_id",
operations: [{ type: "addTag", tag: "NEW_TAG" }]
})
// Returns: success: true, operationsApplied: 1
// 3. Check tags again
n8n_get_workflow({ id: "workflow_id", mode: "minimal" })
// Returns: tags: [{ id: "abc", name: "EXISTING_TAG" }]
// NEW_TAG was NOT added despite reported successSame behavior for removeTag — reports success but tag remains.
Suggested Fix
addTag and removeTag should make separate API calls to PUT /api/v1/workflows/{id}/tags instead of modifying the workflow payload. This endpoint expects an array of tag objects with id fields:
PUT /api/v1/workflows/{id}/tags
Body: [{"id": "tag-id-1"}, {"id": "tag-id-2"}]
The implementation would need to:
- Look up the tag ID by name (via
GET /api/v1/tags) - For
addTag: merge with existing tag IDs and PUT the full list - For
removeTag: filter out the tag ID and PUT the remaining list
Environment
- n8n-mcp version: 2.35.2
- n8n version: self-hosted (latest)
Workaround
Use the n8n tags API directly via a separate tool/HTTP call to PUT /api/v1/workflows/{id}/tags.