archive-list
Archive or unarchive Trello lists to manage board organization and workflow stages.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| listId | Yes | ID of the list to archive or unarchive | |
| archived | Yes | Whether to archive (true) or unarchive (false) the list |
Implementation Reference
- src/tools/lists.ts:174-219 (handler)The handler function that implements the core logic of the 'archive-list' tool by making a PUT request to the Trello API to set the closed (archived) state of a list.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/lists/${listId}/closed?key=${credentials.apiKey}&token=${credentials.apiToken}`, { method: 'PUT', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ value: archived, }), } ); const data = await response.json(); return { content: [ { type: 'text', text: JSON.stringify(data), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error archiving list: ${error}`, }, ], isError: true, }; } }
- src/tools/lists.ts:170-173 (schema)Zod input schema for the 'archive-list' tool defining parameters listId and archived.listId: z.string().describe('ID of the list to archive or unarchive'), archived: z.boolean().describe('Whether to archive (true) or unarchive (false) the list'), }, async ({ listId, archived }) => {
- src/tools/lists.ts:167-220 (registration)The server.tool call that registers the 'archive-list' tool with its schema and handler function.server.tool( 'archive-list', { listId: z.string().describe('ID of the list to archive or unarchive'), archived: z.boolean().describe('Whether to archive (true) or unarchive (false) the list'), }, async ({ listId, archived }) => { 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/lists/${listId}/closed?key=${credentials.apiKey}&token=${credentials.apiToken}`, { method: 'PUT', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ value: archived, }), } ); const data = await response.json(); return { content: [ { type: 'text', text: JSON.stringify(data), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error archiving list: ${error}`, }, ], isError: true, }; } } );
- src/index.ts:89-89 (registration)Top-level call to registerListsTools in the main MCP server setup, which includes registration of the 'archive-list' tool.registerListsTools(server, credentials);