archive-cards
Automate archiving of Trello cards by specifying their IDs, streamlining project management and reducing board clutter. Integrate with Advanced Trello MCP Server for efficient workflows.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cardIds | Yes | IDs of the cards to archive |
Implementation Reference
- src/tools/cards.ts:470-519 (handler)The handler function for the 'archive-cards' tool. It takes an array of card IDs, checks credentials, and for each card, makes a PUT request to the Trello API to set 'closed: true', effectively archiving the cards. Returns the JSON results or error.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 the 'archive-cards' tool using Zod: requires an array of string card IDs.{ cardIds: z.array(z.string()).describe('IDs of the cards to archive'), },
- src/tools/cards.ts:465-520 (registration)The server.tool call that registers the 'archive-cards' tool, including its name, input schema, and inline handler function within registerCardsTools.'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/index.ts:90-90 (registration)Invocation of registerCardsTools in the main index.ts, which registers the 'archive-cards' tool among others.registerCardsTools(server, credentials);