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
| Name | Required | Description | Default |
|---|---|---|---|
| fields | No | Comma-separated list of fields to include | |
| labelId | Yes | ID of the label to retrieve |
Implementation Reference
- src/tools/labels.ts:214-255 (handler)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, }; } }
- src/tools/labels.ts:210-212 (schema)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')
- src/tools/labels.ts:208-256 (registration)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, }; } } );