Skip to main content
Glama

create-label

Create custom labels on Trello boards to categorize and organize cards using specified names and colors for improved project management.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
boardIdYesID of the board to create the label in
nameYesName of the label
colorYesColor of the label

Implementation Reference

  • Handler function that sends a POST request to the Trello API to create a new label on the specified board with given name and color.
    async ({ boardId, name, color }) => { try { 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, color, idBoard: boardId, }), } ); const data = await response.json(); return { content: [ { type: 'text', text: JSON.stringify(data), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error creating label: ${error}`, }, ], isError: true, }; } }
  • Input schema for the create-label tool using Zod validation.
    { 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'), },
  • Zod enum schema defining valid Trello label colors, referenced in create-label tool schema.
    export const TrelloColorEnum = z.enum([ 'yellow', 'purple', 'blue', 'red', 'green', 'orange', 'black', 'sky', 'pink', 'lime', ]);
  • Registration of the 'create-label' tool on the MCP server within registerLabelsTools function.
    'create-label', { 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 ({ boardId, name, color }) => { try { 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, color, idBoard: boardId, }), } ); const data = await response.json(); return { content: [ { type: 'text', text: JSON.stringify(data), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error creating label: ${error}`, }, ], isError: true, }; } } );
  • src/index.ts:91-91 (registration)
    Invocation of registerLabelsTools which registers the create-label 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