update-label
Modify Trello card labels by updating their name and color. Change label appearance or remove colors to organize project boards effectively.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| labelId | Yes | ID of the label to update | |
| name | No | New name for the label | |
| color | No | New color for the label (use "null" to remove color) |
Implementation Reference
- src/tools/labels.ts:266-314 (handler)Handler function that performs a PUT request to the Trello API to update a label's name and/or color.async ({ labelId, name, color }) => { try { if (!credentials.apiKey || !credentials.apiToken) { return { content: [ { type: 'text', text: 'Trello API credentials are not configured', }, ], isError: true, }; } const updateData: any = {}; if (name !== undefined) updateData.name = name; if (color !== undefined) updateData.color = color === 'null' ? null : color; const response = await fetch( `https://api.trello.com/1/labels/${labelId}?key=${credentials.apiKey}&token=${credentials.apiToken}`, { method: 'PUT', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify(updateData), } ); const data = await response.json(); return { content: [ { type: 'text', text: JSON.stringify(data), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error updating label: ${error}`, }, ], isError: true, }; }
- src/tools/labels.ts:261-265 (schema)Input schema using Zod for validating labelId, optional name, and optional color parameters.{ labelId: z.string().describe('ID of the label to update'), name: z.string().optional().describe('New name for the label'), color: TrelloColorWithNullEnum.optional().describe('New color for the label (use "null" to remove color)') },
- src/tools/labels.ts:259-316 (registration)Direct registration of the 'update-label' tool using server.tool() within registerLabelsTools.server.tool( 'update-label', { labelId: z.string().describe('ID of the label to update'), name: z.string().optional().describe('New name for the label'), color: TrelloColorWithNullEnum.optional().describe('New color for the label (use "null" to remove color)') }, async ({ labelId, name, color }) => { try { if (!credentials.apiKey || !credentials.apiToken) { return { content: [ { type: 'text', text: 'Trello API credentials are not configured', }, ], isError: true, }; } const updateData: any = {}; if (name !== undefined) updateData.name = name; if (color !== undefined) updateData.color = color === 'null' ? null : color; const response = await fetch( `https://api.trello.com/1/labels/${labelId}?key=${credentials.apiKey}&token=${credentials.apiToken}`, { method: 'PUT', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify(updateData), } ); const data = await response.json(); return { content: [ { type: 'text', text: JSON.stringify(data), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error updating label: ${error}`, }, ], isError: true, }; } } );
- src/index.ts:91-91 (registration)Top-level call to registerLabelsTools, which includes the 'update-label' tool registration.registerLabelsTools(server, credentials);