move-card
Move Trello cards between lists or reposition them within a list using card and destination IDs.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cardId | Yes | ID of the card to move | |
| listId | Yes | ID of the destination list | |
| position | No | Position in the list (e.g. "top", "bottom") |
Implementation Reference
- src/index.ts:248-283 (handler)The asynchronous handler function that executes the logic to move a Trello card by sending a PUT request to the Trello API, updating the idList and position.async ({ cardId, listId, position = 'bottom' }) => { try { const response = await fetch( `https://api.trello.com/1/cards/${cardId}?key=${trelloApiKey}&token=${trelloApiToken}`, { method: 'PUT', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ idList: listId, pos: position, }), } ); const data = await response.json(); return { content: [ { type: 'text', text: JSON.stringify(data), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error moving card: ${error}`, }, ], isError: true, }; } }
- src/index.ts:243-247 (schema)Zod input schema defining parameters for the move-card tool: cardId (required string), listId (required string), position (optional string).{ cardId: z.string().describe('ID of the card to move'), listId: z.string().describe('ID of the destination list'), position: z.string().optional().describe('Position in the list (e.g. "top", "bottom")'), },
- src/index.ts:241-284 (registration)The server.tool registration call that defines and registers the 'move-card' tool with its name, input schema, and handler function.server.tool( 'move-card', { cardId: z.string().describe('ID of the card to move'), listId: z.string().describe('ID of the destination list'), position: z.string().optional().describe('Position in the list (e.g. "top", "bottom")'), }, async ({ cardId, listId, position = 'bottom' }) => { try { const response = await fetch( `https://api.trello.com/1/cards/${cardId}?key=${trelloApiKey}&token=${trelloApiToken}`, { method: 'PUT', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ idList: listId, pos: position, }), } ); const data = await response.json(); return { content: [ { type: 'text', text: JSON.stringify(data), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error moving card: ${error}`, }, ], isError: true, }; } } );