Skip to main content
Glama

create-labels

Generate and manage custom labels in Trello boards to improve task organization. Define label names and colors for enhanced project tracking and categorization.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
labelsYes

Implementation Reference

  • The handler function for the 'create-labels' tool, which batch-creates labels on Trello boards by making concurrent POST requests to the Trello API for each label in the input array.
    async ({ labels }) => { try { const results = await Promise.all( labels.map(async (label) => { const response = await fetch( `https://api.trello.com/1/labels?key=${credentials.apiKey}&token=${credentials.apiToken}`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ name: label.name, color: label.color, idBoard: label.boardId, }), } ); return await response.json(); }) ); return { content: [ { type: 'text', text: JSON.stringify(results), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error creating labels: ${error}`, }, ], isError: true, }; } }
  • The Zod input schema for the 'create-labels' tool, accepting an array of objects each containing boardId, name, and color for the labels to create.
    { labels: z.array( z.object({ boardId: z.string().describe('ID of the board to create the label in'), name: z.string().describe('Name of the label'), color: TrelloColorEnum.describe('Color of the label'), }) ), },
  • The MCP server.tool() call that registers the 'create-labels' tool, specifying its name, input schema, and handler function.
    server.tool( 'create-labels', { labels: z.array( z.object({ boardId: z.string().describe('ID of the board to create the label in'), name: z.string().describe('Name of the label'), color: TrelloColorEnum.describe('Color of the label'), }) ), }, async ({ labels }) => { try { const results = await Promise.all( labels.map(async (label) => { const response = await fetch( `https://api.trello.com/1/labels?key=${credentials.apiKey}&token=${credentials.apiToken}`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ name: label.name, color: label.color, idBoard: label.boardId, }), } ); return await response.json(); }) ); return { content: [ { type: 'text', text: JSON.stringify(results), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error creating labels: ${error}`, }, ], isError: true, }; } } );
  • src/index.ts:91-91 (registration)
    Invocation of registerLabelsTools in the main server setup, which includes registration of the 'create-labels' tool among others.
    registerLabelsTools(server, credentials);

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