archive-card
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 |
|---|---|---|---|
| cardId | Yes | ID of the card to archive |
Implementation Reference
- src/tools/cards.ts:414-460 (handler)The handler function for the 'archive-card' tool. It sends a PUT request to the Trello API endpoint for the given card ID, setting 'closed: true' to archive the card. Handles credentials check and errors.async ({ cardId }) => { try { if (!credentials.apiKey || !credentials.apiToken) { return { content: [ { type: 'text', text: 'Trello API credentials are not configured', }, ], isError: true, }; } 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, }), } ); const data = await response.json(); return { content: [ { type: 'text', text: JSON.stringify(data), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error archiving card: ${error}`, }, ], isError: true, }; } }
- src/tools/cards.ts:411-413 (schema)Zod input schema for the 'archive-card' tool, requiring a 'cardId' string parameter.{ cardId: z.string().describe('ID of the card to archive'), },
- src/tools/cards.ts:409-461 (registration)Direct registration of the 'archive-card' tool using McpServer.tool(), including name, input schema, and handler function.server.tool( 'archive-card', { cardId: z.string().describe('ID of the card to archive'), }, async ({ cardId }) => { try { if (!credentials.apiKey || !credentials.apiToken) { return { content: [ { type: 'text', text: 'Trello API credentials are not configured', }, ], isError: true, }; } 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, }), } ); const data = await response.json(); return { content: [ { type: 'text', text: JSON.stringify(data), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error archiving card: ${error}`, }, ], isError: true, }; } } );
- src/index.ts:90-90 (registration)Top-level call to registerCardsTools, which includes registration of the 'archive-card' tool among other cards tools.registerCardsTools(server, credentials);