create-labels
Automate label creation in Trello boards by specifying board ID, label name, and color. Simplify organization and categorization of tasks using predefined options.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| labels | Yes |
Implementation Reference
- src/tools/label-tools.ts:27-49 (schema)Input schema for the 'create_label' tool defining required parameters: boardId, name, and color.{ name: "create_label", description: "Create a new label on a board. Use this tool when you need to add a new label to a board for categorizing cards.", inputSchema: { type: "object", properties: { boardId: { type: "string", description: "ID of the board" }, name: { type: "string", description: "Name of the label" }, color: { type: ["string", "null"], enum: ["green", "yellow", "orange", "red", "purple", "blue", "sky", "lime", "pink", "black", null], description: "Color of the label, or null for no color" } }, required: ["boardId", "name", "color"] } },
- src/tools/label-tool-handlers.ts:24-32 (handler)The handler function that executes the 'create_label' tool by invoking the LabelService.createLabel method with the provided arguments./** * Create a new label on a board * @param args - Tool arguments * @returns Promise resolving to the created label */ create_label: async (args: any) => { const labelService = ServiceFactory.getInstance().getLabelService(); return labelService.createLabel(args.boardId, args.name, args.color); },
- src/tools/trello-tools.ts:18-25 (registration)Aggregates and registers the labelTools (including create_label schema) into the main trelloTools array used by the MCP server.export const trelloTools = [ ...boardTools, ...listTools, ...cardTools, ...memberTools, ...labelTools, ...checklistTools ];
- src/tools/trello-tool-handlers.ts:18-25 (registration)Aggregates and registers the labelToolHandlers (including create_label handler) into the main trelloToolHandlers object used by the MCP server.export const trelloToolHandlers = { ...boardToolHandlers, ...listToolHandlers, ...cardToolHandlers, ...memberToolHandlers, ...labelToolHandlers, ...checklistToolHandlers };
- src/index.ts:92-96 (registration)Registers the handler for listing available tools, returning trelloTools which includes the create_label tool.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: trelloTools }; });
- src/index.ts:120-164 (registration)Registers the generic tool call handler that dispatches to the specific create_label handler from trelloToolHandlers based on tool name.server.setRequestHandler(CallToolRequestSchema, async (request) => { try { const toolName = request.params.name; // Use type assertion to tell TypeScript that toolName is a valid key const handler = trelloToolHandlers[toolName as keyof typeof trelloToolHandlers]; if (!handler) { throw new McpError( ErrorCode.MethodNotFound, `Unknown tool: ${toolName}` ); } // Execute the tool handler with the provided arguments const result = await handler(request.params.arguments); // Return the result return { content: [ { type: "text", text: JSON.stringify(result, null, 2) } ] }; } catch (error) { console.error("Error handling tool call:", error); // If it's already an MCP error, rethrow it if (error instanceof McpError) { throw error; } // Otherwise, wrap it in an MCP error return { content: [ { type: "text", text: `Error: ${error instanceof Error ? error.message : String(error)}` } ], isError: true }; } });