add-label
Associate a specific label with a Trello card by providing the card ID and label ID. Simplify card organization and management on Trello boards.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cardId | Yes | ID of the card to add the label to | |
| labelId | Yes | ID of the label to add |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"cardId": {
"description": "ID of the card to add the label to",
"type": "string"
},
"labelId": {
"description": "ID of the label to add",
"type": "string"
}
},
"required": [
"cardId",
"labelId"
],
"type": "object"
}
Implementation Reference
- src/tools/card-tool-handlers.ts:164-172 (handler)The handler function that implements the logic for the 'add_label' MCP tool. It retrieves the LabelService and calls addLabelToCard with the provided cardId and labelId, returning a success message.* Add a label to a card * @param args - Tool arguments * @returns Promise resolving when the operation is complete */ 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 (schema)The schema definition for the 'add_label' tool, including input schema for validation of cardId and labelId parameters.{ 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"] } },
- The underlying service method called by the tool handler, which makes the Trello API POST request to add the label ID to the card's idLabels.async addLabelToCard(cardId: string, labelId: string): Promise<void> { return this.trelloService.post<void>(`/cards/${cardId}/idLabels`, { value: labelId }); }