Skip to main content
Glama

update-tag

Modify the name of an existing tag in n8n workflows to maintain organized and accurate workflow categorization.

Instructions

Update a tag's name.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
clientIdYes
idYes
nameYes

Implementation Reference

  • The main handler for the 'update-tag' tool within the CallToolRequestSchema switch statement. It retrieves the N8nClient instance and calls its updateTag method.
    case "update-tag": {
      const { clientId, id, name } = args as { clientId: string; id: string; name: string };
      const client = clients.get(clientId);
      if (!client) {
        return {
          content: [{
            type: "text",
            text: "Client not initialized. Please run init-n8n first.",
          }],
          isError: true
        };
      }
    
      try {
        const tag = await client.updateTag(id, name);
        return {
          content: [{
            type: "text",
            text: `Successfully updated tag:\n${JSON.stringify(tag, null, 2)}`,
          }]
        };
      } catch (error) {
        return {
          content: [{
            type: "text",
            text: error instanceof Error ? error.message : "Unknown error occurred",
          }],
          isError: true
        };
      }
    }
  • The N8nClient method that performs the actual API call to update a tag's name via PUT /tags/{id}.
    async updateTag(id: string, name: string): Promise<N8nTag> {
      return this.makeRequest<N8nTag>(`/tags/${id}`, {
        method: 'PUT',
        body: JSON.stringify({ name }),
      });
    }
  • src/index.ts:770-782 (registration)
    Tool registration in the listTools response, including name, description, and input schema.
    {
      name: "update-tag",
      description: "Update a tag's name.",
      inputSchema: {
        type: "object",
        properties: {
          clientId: { type: "string" },
          id: { type: "string" },
          name: { type: "string" }
        },
        required: ["clientId", "id", "name"]
      }
    },
  • Type definition for N8nTag used in updateTag responses.
      id: string;
      name: string;
      createdAt?: string;
      updatedAt?: string;
    }
    
    interface N8nTagList {
      data: N8nTag[];
      nextCursor?: string;
    }
    
    interface N8nAuditResult {
      'Credentials Risk Report'?: any;
      'Database Risk Report'?: any;
      'Filesystem Risk Report'?: any;
      'Nodes Risk Report'?: any;
      'Instance Risk Report'?: any;
    }
    
    class N8nClient {
      constructor(
        private baseUrl: string,
        private apiKey: string
      ) {
        // Remove trailing slash if present
        this.baseUrl = baseUrl.replace(/\/$/, '');
      }
    
      private async makeRequest<T>(endpoint: string, options: any = {}): Promise<T> {
        const url = `${this.baseUrl}/api/v1${endpoint}`;
        const headers = {
          'X-N8N-API-KEY': this.apiKey,
          'Accept': 'application/json',
          'Content-Type': 'application/json',
        };
    
        try {
          const response = await fetch(url, {
            ...options,
            headers: {
              ...headers,
              ...options.headers,
            },
          });
    
          if (!response.ok) {
            const errorText = await response.text();
            let errorMessage: string;
            try {
              const errorJson = JSON.parse(errorText);
              // Check for license-related errors
              if (errorJson.message && errorJson.message.includes('license')) {
                errorMessage = `This operation requires an n8n Enterprise license with project management features enabled. Error: ${errorJson.message}`;
              } else {
                errorMessage = errorJson.message || errorText;
              }
            } catch {
              errorMessage = errorText;
            }
            throw new Error(`N8N API error: ${errorMessage}`);
          }
    
          // Handle 204 No Content responses
          if (response.status === 204) {
            return {} as T;
          }
    
          return await response.json() as T;
        } catch (error) {
          if (error instanceof Error) {
            throw new Error(`Failed to connect to n8n: ${error.message}`);
          }
          throw error;
        }
      }
    
      async listWorkflows(): Promise<N8nWorkflowList> {
        return this.makeRequest<N8nWorkflowList>('/workflows');
      }
    
      async getWorkflow(id: string): Promise<N8nWorkflow> {
        return this.makeRequest<N8nWorkflow>(`/workflows/${id}`);
      }
    
      async createWorkflow(name: string, nodes: any[] = [], connections: any = {}): Promise<N8nWorkflow> {
        return this.makeRequest<N8nWorkflow>('/workflows', {
          method: 'POST',
          body: JSON.stringify({
            name,
            nodes,
            connections,
            settings: {
              saveManualExecutions: true,
              saveExecutionProgress: true,
            },
          }),
        });
      }
    
      async updateWorkflow(id: string, workflow: Partial<N8nWorkflow>): Promise<N8nWorkflow> {
        return this.makeRequest<N8nWorkflow>(`/workflows/${id}`, {
          method: 'PUT',
          body: JSON.stringify(workflow),
        });
      }
    
      async deleteWorkflow(id: string): Promise<N8nWorkflow> {
        return this.makeRequest<N8nWorkflow>(`/workflows/${id}`, {
          method: 'DELETE',
        });
      }
    
      async activateWorkflow(id: string): Promise<N8nWorkflow> {
        return this.makeRequest<N8nWorkflow>(`/workflows/${id}/activate`, {
          method: 'POST',
        });
      }
    
      async deactivateWorkflow(id: string): Promise<N8nWorkflow> {
        return this.makeRequest<N8nWorkflow>(`/workflows/${id}/deactivate`, {
          method: 'POST',
        });
      }
    
      // Project management methods (requires n8n Enterprise license)
      async listProjects(): Promise<N8nProjectList> {
        return this.makeRequest<N8nProjectList>('/projects');
      }
    
      async createProject(name: string): Promise<void> {
        return this.makeRequest<void>('/projects', {
          method: 'POST',
          body: JSON.stringify({ name }),
        });
      }
    
      async deleteProject(projectId: string): Promise<void> {
        return this.makeRequest<void>(`/projects/${projectId}`, {
          method: 'DELETE',
        });
      }
    
      async updateProject(projectId: string, name: string): Promise<void> {
        return this.makeRequest<void>(`/projects/${projectId}`, {
          method: 'PUT',
          body: JSON.stringify({ name }),
        });
      }
    
      // User management methods
      async listUsers(): Promise<N8nUserList> {
        return this.makeRequest<N8nUserList>('/users');
      }
    
      async createUsers(users: Array<{ email: string; role?: 'global:admin' | 'global:member' }>): Promise<any> {
        return this.makeRequest('/users', {
          method: 'POST',
          body: JSON.stringify(users),
        });
      }
    
      async getUser(idOrEmail: string): Promise<N8nUser> {
        return this.makeRequest<N8nUser>(`/users/${idOrEmail}`);
      }
    
      async deleteUser(idOrEmail: string): Promise<void> {
        return this.makeRequest<void>(`/users/${idOrEmail}`, {
          method: 'DELETE',
        });
      }
    
      // Variable management methods
      async listVariables(): Promise<N8nVariableList> {
        return this.makeRequest<N8nVariableList>('/variables');
      }
    
      async createVariable(key: string, value: string): Promise<void> {
        return this.makeRequest<void>('/variables', {
          method: 'POST',
          body: JSON.stringify({ key, value }),
        });
      }
    
      async deleteVariable(id: string): Promise<void> {
        return this.makeRequest<void>(`/variables/${id}`, {
          method: 'DELETE',
        });
      }
    
      // Execution management methods
      async getExecutions(options: { 
        includeData?: boolean; 
        status?: 'error' | 'success' | 'waiting';
        workflowId?: string;
        limit?: number;
      } = {}): Promise<N8nExecutionList> {
        const params = new URLSearchParams();
        if (options.includeData !== undefined) params.append('includeData', String(options.includeData));
        if (options.status) params.append('status', options.status);
        if (options.workflowId) params.append('workflowId', options.workflowId);
        if (options.limit) params.append('limit', String(options.limit));
    
        return this.makeRequest<N8nExecutionList>(`/executions?${params.toString()}`);
      }
    
      async getExecution(id: number, includeData: boolean = false): Promise<N8nExecution> {
        const params = new URLSearchParams();
        if (includeData) params.append('includeData', 'true');
    
        return this.makeRequest<N8nExecution>(`/executions/${id}?${params.toString()}`);
      }
    
      async deleteExecution(id: number): Promise<N8nExecution> {
        return this.makeRequest<N8nExecution>(`/executions/${id}`, {
          method: 'DELETE',
        });
      }
    
      // Tag management methods
      async createTag(name: string): Promise<N8nTag> {
        return this.makeRequest<N8nTag>('/tags', {
          method: 'POST',
          body: JSON.stringify({ name }),
        });
      }
    
      async getTags(options: { limit?: number } = {}): Promise<N8nTagList> {
        const params = new URLSearchParams();
        if (options.limit) params.append('limit', String(options.limit));
    
        return this.makeRequest<N8nTagList>(`/tags?${params.toString()}`);
      }
    
      async getTag(id: string): Promise<N8nTag> {
        return this.makeRequest<N8nTag>(`/tags/${id}`);
      }
    
      async updateTag(id: string, name: string): Promise<N8nTag> {
        return this.makeRequest<N8nTag>(`/tags/${id}`, {
          method: 'PUT',
          body: JSON.stringify({ name }),
        });
      }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

C2.8/5.0
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 states the tool updates a tag's name, implying a mutation, but doesn't address permissions, side effects, error conditions, or response format. This is inadequate for a mutation tool with zero annotation coverage.

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 with zero wasted words. It's appropriately sized and front-loaded, directly stating the tool's purpose without unnecessary elaboration.

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 tool's complexity (a mutation with 3 required parameters), lack of annotations, and no output schema, the description is incomplete. It doesn't explain parameter roles, behavioral traits, or expected outcomes, making it insufficient for safe and effective use by an agent.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate for undocumented parameters. It only mentions 'name' as the field to update, ignoring 'clientId' and 'id' parameters entirely. This leaves two required parameters semantically unexplained, failing to add meaningful value beyond the schema.

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 action ('Update') and the resource ('a tag's name'), providing a specific verb+resource combination. However, it doesn't distinguish this tool from sibling tools like 'update-project' or 'update-workflow' beyond the resource type, which prevents a perfect score.

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 provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an existing tag ID), exclusions, or comparisons to sibling tools like 'create-tag' or 'delete-tag', leaving the agent without contextual usage instructions.

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