add-label
Add a label to a Trello card using its ID and label ID to organize and categorize tasks.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cardId | Yes | ID of the card to add the label to | |
| labelId | Yes | ID of the label to add |
Implementation Reference
- src/tools/card-tool-handlers.ts:168-172 (handler)Handler function for the 'add_label' MCP tool. It retrieves the label service from the service factory and calls addLabelToCard with the provided cardId and labelId, returning a success message.add_label: async (args: any) => { const labelService = ServiceFactory.getInstance().getLabelService(); await labelService.addLabelToCard(args.cardId, args.labelId); return { success: true, message: 'Label added to card successfully' }; },
- src/tools/card-tools.ts:399-416 (registration)Registration of the 'add_label' tool in the cardTools array, including name, description, and input schema for MCP registration.{ name: "add_label", description: "Add a label to a card. Use this tool to categorize a card.", inputSchema: { type: "object", properties: { cardId: { type: "string", description: "ID of the card" }, labelId: { type: "string", description: "ID of the label to add" } }, required: ["cardId", "labelId"] } },
- Helper service method in LabelService that implements the core logic by posting to Trello API endpoint /cards/{cardId}/idLabels with the labelId.async addLabelToCard(cardId: string, labelId: string): Promise<void> { return this.trelloService.post<void>(`/cards/${cardId}/idLabels`, { value: labelId }); }