create-card
Create new Trello cards with specified names and descriptions, organizing tasks directly into designated lists for project management.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| description | No | ||
| listId | Yes |
Implementation Reference
- src/index.ts:86-123 (handler)The handler function executes the create-card tool by sending a POST request to the Trello API to create a new card in the specified list, returning the card data or error.async ({ name, description, listId }) => { try { const response = await fetch( `https://api.trello.com/1/cards?key=${trelloApiKey}&token=${trelloApiToken}`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ name, desc: description || '', idList: listId, pos: 'bottom', }), } ); const data = await response.json(); return { content: [ { type: 'text', text: JSON.stringify(data), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error creating card: ${error}`, }, ], isError: true, }; } }
- src/index.ts:81-85 (schema)Zod input schema defining parameters: name (required string), description (optional string), listId (required string).{ name: z.string(), description: z.string().optional(), listId: z.string(), },
- src/index.ts:79-124 (registration)Registration of the 'create-card' tool on the MCP server using server.tool(), including inline schema and handler.server.tool( 'create-card', { name: z.string(), description: z.string().optional(), listId: z.string(), }, async ({ name, description, listId }) => { try { const response = await fetch( `https://api.trello.com/1/cards?key=${trelloApiKey}&token=${trelloApiToken}`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ name, desc: description || '', idList: listId, pos: 'bottom', }), } ); const data = await response.json(); return { content: [ { type: 'text', text: JSON.stringify(data), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error creating card: ${error}`, }, ], isError: true, }; } } );