create-card
Add a new card to a Trello list by specifying the card name and list ID. This tool enables AI assistants to create task cards within Trello boards for project management automation.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| description | No | ||
| listId | Yes |
Implementation Reference
- src/index.ts:86-123 (handler)The asynchronous handler function that executes the tool logic: sends a POST request to the Trello API to create a new card with the given name, description, and list ID.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 schema for input validation: requires 'name' and 'listId' strings, optional 'description' string.{ name: z.string(), description: z.string().optional(), listId: z.string(), },
- src/index.ts:79-124 (registration)MCP server.tool call that registers the 'create-card' tool with its name, input schema, and handler function.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, }; } } );