update_card
Update any property of a Trello card including name, description, due date, list, and position. Modify card details with a single API call.
Instructions
Update properties of an existing Trello card. Use this to change card details like name, description, due date, or status.
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 update (e.g. "abc123" or "https://trello.com/c/abc123/1-title") | |
| name | No | New name/title for the card | |
| desc | No | New description for the card | |
| closed | No | Set to true to archive the card, false to unarchive | |
| due | No | Set due date (ISO 8601 format) or null to remove due date | |
| dueComplete | No | Mark the due date as complete (true) or incomplete (false) | |
| start | No | Set start date (ISO 8601 format) or null to remove start date | |
| idList | No | Move card to a different list by providing the list ID | |
| pos | No | Change position in the list: "top", "bottom", or specific number |
Implementation Reference
- src/tools/cards.ts:205-262 (handler)The handleUpdateCard function executes the update_card tool logic: extracts credentials, validates input via validateUpdateCard, calls TrelloClient.updateCard, and formats the response with updated card details.
export async function handleUpdateCard(args: unknown) { try { const { credentials, params } = extractCredentials(args); const { cardId, ...updates } = validateUpdateCard(params); const client = new TrelloClient(credentials); const response = await client.updateCard(cardId, updates); const card = response.data; const result = { summary: `Updated card: ${card.name}`, card: { id: card.id, name: card.name, description: card.desc || 'No description', url: card.shortUrl, listId: card.idList, boardId: card.idBoard, position: card.pos, due: card.due, dueComplete: card.dueComplete, start: card.start, closed: card.closed, labels: card.labels?.map(label => ({ id: label.id, name: label.name, color: label.color })) || [] }, 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 updating card: ${errorMessage}` } ], isError: true }; } } - src/tools/cards.ts:145-203 (schema)The updateCardTool definition with inputSchema describing all updatable properties: cardId (required), name, desc, closed, due, dueComplete, start, idList, pos.
export const updateCardTool: Tool = { name: 'update_card', description: 'Update properties of an existing Trello card. Use this to change card details like name, description, due date, or status.', 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 update (e.g. "abc123" or "https://trello.com/c/abc123/1-title")' }, name: { type: 'string', description: 'New name/title for the card' }, desc: { type: 'string', description: 'New description for the card' }, closed: { type: 'boolean', description: 'Set to true to archive the card, false to unarchive' }, due: { type: ['string', 'null'], format: 'date-time', description: 'Set due date (ISO 8601 format) or null to remove due date' }, dueComplete: { type: 'boolean', description: 'Mark the due date as complete (true) or incomplete (false)' }, start: { type: ['string', 'null'], format: 'date-time', description: 'Set start date (ISO 8601 format) or null to remove start date' }, idList: { type: 'string', description: 'Move card to a different list by providing the list ID' }, pos: { oneOf: [ { type: 'number', minimum: 0 }, { type: 'string', enum: ['top', 'bottom'] } ], description: 'Change position in the list: "top", "bottom", or specific number' } }, required: ['cardId'] } }; - src/utils/validation.ts:80-92 (schema)The updateCardSchema Zod schema used to validate update_card inputs at runtime.
export const updateCardSchema = z.object({ cardId: trelloIdSchema, name: z.string().min(1).max(16384).optional(), desc: z.string().max(16384).optional(), closed: z.boolean().optional(), due: z.string().datetime().nullable().optional(), dueComplete: z.boolean().optional(), start: z.string().datetime().nullable().optional(), idList: trelloIdOptionalSchema, pos: z.union([z.number().min(0), z.string().regex(/^\d+(\.\d+)?$/).transform(Number), z.enum(['top', 'bottom'])]).optional(), idMembers: z.array(trelloIdSchema).optional(), idLabels: z.array(trelloIdSchema).optional() }); - src/types/trello.ts:142-153 (schema)The UpdateCardRequest TypeScript interface defining the type for the updates object passed to the Trello client.
export interface UpdateCardRequest { name?: string | undefined; desc?: string | undefined; closed?: boolean | undefined; due?: string | null | undefined; dueComplete?: boolean | undefined; start?: string | null | undefined; idList?: string | undefined; pos?: number | string | undefined; idMembers?: string[] | undefined; idLabels?: string[] | undefined; } - src/index.ts:276-279 (registration)Tool handler dispatch: the 'update_card' case in the main request handler calls handleUpdateCard.
// Phase 2: Core operations case 'update_card': result = await handleUpdateCard(argsWithCredentials); break;