get-tag
Retrieve a specific tag by ID using client and tag identifiers, enabling secure data interaction within n8n workflows via the Model Context Protocol.
Instructions
Retrieve a specific tag by ID.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| clientId | Yes | ||
| id | Yes |
Implementation Reference
- src/index.ts:1758-1788 (handler)Handler for the 'get-tag' tool execution. Validates client existence, calls N8nClient.getTag(id), and returns the tag as JSON or error.case "get-tag": { const { clientId, id } = args as { clientId: string; id: 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.getTag(id); return { content: [{ type: "text", text: JSON.stringify(tag, null, 2), }] }; } catch (error) { return { content: [{ type: "text", text: error instanceof Error ? error.message : "Unknown error occurred", }], isError: true }; } }
- src/index.ts:758-769 (registration)Registration of the 'get-tag' tool in the listTools response, including name, description, and input schema.{ name: "get-tag", description: "Retrieve a specific tag by ID.", inputSchema: { type: "object", properties: { clientId: { type: "string" }, id: { type: "string" } }, required: ["clientId", "id"] } },
- src/index.ts:761-768 (schema)Input schema definition for the 'get-tag' tool.inputSchema: { type: "object", properties: { clientId: { type: "string" }, id: { type: "string" } }, required: ["clientId", "id"] }
- src/index.ts:313-314 (helper)N8nClient.getTag(id) helper method that makes the API GET request to /tags/{id}.async getTag(id: string): Promise<N8nTag> { return this.makeRequest<N8nTag>(`/tags/${id}`);
- src/index.ts:79-84 (schema)TypeScript interface defining the structure of a tag returned by getTag.interface N8nTag { id: string; name: string; createdAt?: string; updatedAt?: string; }