create-cards
Create multiple Trello cards with names, descriptions, and list assignments to organize tasks and projects in your Trello boards.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cards | Yes |
Implementation Reference
- src/tools/cards.ts:70-111 (handler)Handler function that creates multiple Trello cards in parallel using Promise.all and the Trello API, returning JSON results or an error message.async ({ cards }) => { try { const results = await Promise.all( cards.map(async (card) => { const response = await fetch( `https://api.trello.com/1/cards?key=${credentials.apiKey}&token=${credentials.apiToken}`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ name: card.name, desc: card.description || '', idList: card.listId, pos: 'bottom', }), } ); return await response.json(); }) ); return { content: [ { type: 'text', text: JSON.stringify(results), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error creating cards: ${error}`, }, ], isError: true, }; } }
- src/tools/cards.ts:61-69 (schema)Zod input schema defining an array of card objects, each with name (string), optional description (string), and listId (string).{ cards: z.array( z.object({ name: z.string().describe('Name of the card'), description: z.string().optional().describe('Description of the card'), listId: z.string().describe('ID of the list to create the card in'), }) ), },
- src/tools/cards.ts:59-112 (registration)Local registration of the 'create-cards' tool within registerCardsTools using server.tool(name, schema, handler).server.tool( 'create-cards', { cards: z.array( z.object({ name: z.string().describe('Name of the card'), description: z.string().optional().describe('Description of the card'), listId: z.string().describe('ID of the list to create the card in'), }) ), }, async ({ cards }) => { try { const results = await Promise.all( cards.map(async (card) => { const response = await fetch( `https://api.trello.com/1/cards?key=${credentials.apiKey}&token=${credentials.apiToken}`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ name: card.name, desc: card.description || '', idList: card.listId, pos: 'bottom', }), } ); return await response.json(); }) ); return { content: [ { type: 'text', text: JSON.stringify(results), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error creating cards: ${error}`, }, ], isError: true, }; } } );
- src/index.ts:90-90 (registration)Top-level call to registerCardsTools in the main server setup, which includes registration of the 'create-cards' tool.registerCardsTools(server, credentials);