Skip to main content
Glama

update-label

Modify Trello label properties such as name and color using the specified label ID, enabling precise label management in project workflows.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
colorNoNew color for the label (use "null" to remove color)
labelIdYesID of the label to update
nameNoNew name for the label

Implementation Reference

  • Handler function that performs a PUT request to the Trello Labels API endpoint to update the specified label's name and/or color. Handles credentials check, constructs update data, sends request, and returns response or error.
    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, }; } }
  • Zod input schema for the 'update-label' tool, defining required labelId and optional name/color parameters. Uses TrelloColorWithNullEnum for color validation.
    { 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)') },
  • Registration of the 'update-label' tool within the registerLabelsTools function using server.tool(). This is called from src/index.ts.
    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, }; } } );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/adriangrahldev/advanced-trello-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server