archive-cards
Archive Trello cards to remove them from active boards while preserving their data for future reference or restoration.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cardIds | Yes | IDs of the cards to archive |
Implementation Reference
- src/tools/cards.ts:464-520 (registration)Registers the 'archive-cards' tool with schema for cardIds array and handler that archives multiple Trello cards by sending PUT requests to set closed: true for each card.server.tool( 'archive-cards', { cardIds: z.array(z.string()).describe('IDs of the cards to archive'), }, async ({ cardIds }) => { try { if (!credentials.apiKey || !credentials.apiToken) { return { content: [ { type: 'text', text: 'Trello API credentials are not configured', }, ], isError: true, }; } const results = await Promise.all( cardIds.map(async (cardId) => { const response = await fetch( `https://api.trello.com/1/cards/${cardId}?key=${credentials.apiKey}&token=${credentials.apiToken}`, { method: 'PUT', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ closed: true, }), } ); return await response.json(); }) ); return { content: [ { type: 'text', text: JSON.stringify(results), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error archiving cards: ${error}`, }, ], isError: true, }; } } );
- src/tools/cards.ts:469-519 (handler)Handler function for 'archive-cards' tool: iterates over cardIds, performs PUT /cards/{id} with closed: true for each, returns results or error.async ({ cardIds }) => { try { if (!credentials.apiKey || !credentials.apiToken) { return { content: [ { type: 'text', text: 'Trello API credentials are not configured', }, ], isError: true, }; } const results = await Promise.all( cardIds.map(async (cardId) => { const response = await fetch( `https://api.trello.com/1/cards/${cardId}?key=${credentials.apiKey}&token=${credentials.apiToken}`, { method: 'PUT', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ closed: true, }), } ); return await response.json(); }) ); return { content: [ { type: 'text', text: JSON.stringify(results), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error archiving cards: ${error}`, }, ], isError: true, }; } }
- src/tools/cards.ts:466-468 (schema)Input schema for 'archive-cards' tool: requires an array of card ID strings.{ cardIds: z.array(z.string()).describe('IDs of the cards to archive'), },