move_card
Change a card's workflow status by moving it to a different list, such as from To Do to In Progress.
Instructions
Move a card to a different list. Use this to change a card's workflow status (e.g., from "To Do" to "In Progress").
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| apiKey | No | Trello API key (optional if TRELLO_API_KEY env var is set) | |
| token | No | Trello API token (optional if TRELLO_TOKEN env var is set) | |
| cardId | Yes | ID or URL of the card to move (e.g. "abc123" or "https://trello.com/c/abc123/1-title") | |
| idList | Yes | ID of the destination list (you can get this from get_lists) | |
| pos | No | Position in the destination list: "top", "bottom", or specific number |
Implementation Reference
- src/tools/cards.ts:264-296 (schema)Tool definition and input schema for 'move_card'. Defines the tool name, description, and input properties: apiKey, token, cardId, idList, and optional pos.
export const moveCardTool: Tool = { name: 'move_card', description: 'Move a card to a different list. Use this to change a card\'s workflow status (e.g., from "To Do" to "In Progress").', inputSchema: { type: 'object', properties: { apiKey: { type: 'string', description: 'Trello API key (optional if TRELLO_API_KEY env var is set)' }, token: { type: 'string', description: 'Trello API token (optional if TRELLO_TOKEN env var is set)' }, cardId: { type: 'string', description: 'ID or URL of the card to move (e.g. "abc123" or "https://trello.com/c/abc123/1-title")' }, idList: { type: 'string', description: 'ID of the destination list (you can get this from get_lists)' }, pos: { oneOf: [ { type: 'number', minimum: 0 }, { type: 'string', enum: ['top', 'bottom'] } ], description: 'Position in the destination list: "top", "bottom", or specific number' } }, required: ['cardId', 'idList'] } }; - src/tools/cards.ts:298-345 (handler)Handler function handleMoveCard that executes the move_card tool logic: extracts credentials, validates params via validateMoveCard, calls TrelloClient.moveCard(), formats and returns the result.
export async function handleMoveCard(args: unknown) { try { const { credentials, params } = extractCredentials(args); const { cardId, ...moveParams } = validateMoveCard(params); const client = new TrelloClient(credentials); const response = await client.moveCard(cardId, moveParams); const card = response.data; const result = { summary: `Moved card "${card.name}" to list ${card.idList}`, card: { id: card.id, name: card.name, url: card.shortUrl, listId: card.idList, boardId: card.idBoard, position: card.pos }, rateLimit: response.rateLimit }; return { content: [ { type: 'text' as const, text: JSON.stringify(result, null, 2) } ] }; } catch (error) { const errorMessage = error instanceof z.ZodError ? formatValidationError(error) : error instanceof Error ? error.message : 'Unknown error occurred'; return { content: [ { type: 'text' as const, text: `Error moving card: ${errorMessage}` } ], isError: true }; } } - src/utils/validation.ts:94-98 (helper)Zod validation schema (moveCardSchema) for move_card: validates cardId, idList, and optional pos.
export const moveCardSchema = z.object({ cardId: trelloIdSchema, idList: trelloIdSchema, pos: z.union([z.number().min(0), z.string().regex(/^\d+(\.\d+)?$/).transform(Number), z.enum(['top', 'bottom'])]).optional() }); - src/trello/client.ts:366-375 (helper)TrelloClient.moveCard() method - makes the actual HTTP PUT request to /cards/{cardId} to move a card to a new list.
async moveCard(cardId: string, moveData: MoveCardRequest): Promise<TrelloApiResponse<TrelloCard>> { return this.makeRequest<TrelloCard>( `/cards/${cardId}`, { method: 'PUT', body: JSON.stringify(moveData) }, `Move card ${cardId}` ); } - src/types/trello.ts:155-158 (helper)TypeScript interface MoveCardRequest defining the shape: idList and optional pos.
export interface MoveCardRequest { idList: string; pos?: number | string | undefined; }