Skip to content

feat(cards): support pos parameter when creating cards - #115

Open
Underlor wants to merge 1 commit into
delorenj:mainfrom
Underlor:feat/add-card-pos
Open

Underlor wants to merge 1 commit into
delorenj:mainfrom
Underlor:feat/add-card-pos

Conversation

@Underlor

Copy link
Copy Markdown

Summary

  • Adds optional pos to add_card_to_list ("top" / "bottom" / positive number), forwarded to POST /cards
  • Adds per-card pos to add_cards_to_list (batch)
  • Matches the existing update_card_details / move_card pos semantics; omitted pos keeps the Trello default (bottom)

Motivation

There was no way to create a card at the top of a list in one call — the only workaround was create + update_card_details(pos) (two API calls per card, worse with batch).

Test plan

  • npx tsc --noEmit clean
  • Verified end-to-end against the Trello API: addCard({ pos: 'top' }) and batchAddCards([{ pos: 'top' }]) both place the new card at the top of the list

Add optional pos to add_card_to_list and per-card pos to add_cards_to_list,
forwarded to POST /cards. Accepts "top", "bottom", or a positive number,
matching the existing update_card_details/move_card behavior.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for specifying a card’s position (pos) at creation time, exposing this through the MCP tools and forwarding it to Trello’s POST /cards so callers can create cards at the top/bottom (or a numeric position) without a follow-up update call.

Changes:

  • Adds optional pos support to TrelloClient.addCard() and forwards it to POST /cards.
  • Adds per-card pos support to TrelloClient.batchAddCards() (sequential creation).
  • Extends the add_card_to_list and add_cards_to_list MCP tool input schemas to accept pos.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/trello-client.ts Forwards pos through single-card creation and batch card creation APIs.
src/index.ts Exposes pos on the MCP tool schemas for single and batch card creation.
Suppressed comments (2)

src/index.ts:1611

  • Same validation issue for batch card creation: pos is z.union([z.string(), z.number()]) but the description restricts it to "top"/"bottom" or a positive number. Consider using z.enum(['top','bottom']) for strings plus z.number().positive() for numeric positions to fail fast with a clearer error.
                pos: z
                  .union([z.string(), z.number()])
                  .optional()
                  .describe(
                    'Position of the card in the list. Accepts "top", "bottom", or a positive number. Defaults to "bottom" (Trello API default)'
                  ),

src/trello-client.ts:1237

  • batchAddCards similarly types each card's pos as string | number. Consider narrowing this to number | 'top' | 'bottom' (or a shared TrelloPos type) to match Trello semantics and keep the batch API consistent with single-card creation.
      name: string;
      description?: string;
      dueDate?: string;
      start?: string;
      labels?: string[];
      pos?: string | number;
    }>

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/index.ts
Comment on lines +215 to +220
pos: z
.union([z.string(), z.number()])
.optional()
.describe(
'Position of the card in the list. Accepts "top", "bottom", or a positive number. Defaults to "bottom" (Trello API default)'
),
Comment thread src/trello-client.ts
Comment on lines 381 to 386
dueDate?: string;
dueReminder?: number | null;
start?: string;
labels?: string[];
pos?: string | number;
}

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants