Skip to main content
Glama

get-label

Retrieve Trello label details by specifying the label ID and optional fields to include. Simplify label management and integration with the Advanced Trello MCP Server.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fieldsNoComma-separated list of fields to include
labelIdYesID of the label to retrieve

Implementation Reference

  • Handler function that retrieves a specific Trello label by ID, optionally specifying fields, using the Trello API.
    async ({ labelId, fields }) => { try { if (!credentials.apiKey || !credentials.apiToken) { return { content: [ { type: 'text', text: 'Trello API credentials are not configured', }, ], isError: true, }; } const url = new URL(`https://api.trello.com/1/labels/${labelId}`); url.searchParams.append('key', credentials.apiKey); url.searchParams.append('token', credentials.apiToken); if (fields) url.searchParams.append('fields', fields); const response = await fetch(url.toString()); const data = await response.json(); return { content: [ { type: 'text', text: JSON.stringify(data), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error getting label: ${error}`, }, ], isError: true, }; } }
  • Zod schema defining the input parameters for the 'get-label' tool: required labelId and optional fields.
    { labelId: z.string().describe('ID of the label to retrieve'), fields: z.string().optional().describe('Comma-separated list of fields to include')
  • Registration of the 'get-label' tool on the MCP server within the registerLabelsTools function.
    server.tool( 'get-label', { labelId: z.string().describe('ID of the label to retrieve'), fields: z.string().optional().describe('Comma-separated list of fields to include') }, async ({ labelId, fields }) => { try { if (!credentials.apiKey || !credentials.apiToken) { return { content: [ { type: 'text', text: 'Trello API credentials are not configured', }, ], isError: true, }; } const url = new URL(`https://api.trello.com/1/labels/${labelId}`); url.searchParams.append('key', credentials.apiKey); url.searchParams.append('token', credentials.apiToken); if (fields) url.searchParams.append('fields', fields); const response = await fetch(url.toString()); const data = await response.json(); return { content: [ { type: 'text', text: JSON.stringify(data), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error getting label: ${error}`, }, ], isError: true, }; } } );

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