Skip to main content
Glama

move-list-to-board

Move a Trello list with all its cards to a different board for better organization or project restructuring.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
listIdYesID of the list to move
boardIdYesID of the destination board

Implementation Reference

  • The handler function that executes the tool logic by sending a PUT request to the Trello API to move the specified list to the destination board, handling credentials check, API call, response parsing, and error handling.
    async ({ listId, boardId }) => {
    	try {
    		if (!credentials.apiKey || !credentials.apiToken) {
    			return {
    				content: [
    					{
    						type: 'text',
    						text: 'Trello API credentials are not configured',
    					},
    				],
    				isError: true,
    			};
    		}
    
    		const response = await fetch(
    			`https://api.trello.com/1/lists/${listId}/idBoard?key=${credentials.apiKey}&token=${credentials.apiToken}`,
    			{
    				method: 'PUT',
    				headers: {
    					'Content-Type': 'application/json',
    				},
    				body: JSON.stringify({
    					value: boardId,
    				}),
    			}
    		);
    		const data = await response.json();
    		return {
    			content: [
    				{
    					type: 'text',
    					text: JSON.stringify(data),
    				},
    			],
    		};
    	} catch (error) {
    		return {
    			content: [
    				{
    					type: 'text',
    					text: `Error moving list to board: ${error}`,
    				},
    			],
    			isError: true,
    		};
    	}
    }
  • Zod schema defining the input parameters: listId and boardId.
    	listId: z.string().describe('ID of the list to move'),
    	boardId: z.string().describe('ID of the destination board'),
    },
  • The server.tool call that registers the 'move-list-to-board' tool, specifying its name, input schema, and handler function.
    	'move-list-to-board',
    	{
    		listId: z.string().describe('ID of the list to move'),
    		boardId: z.string().describe('ID of the destination board'),
    	},
    	async ({ listId, boardId }) => {
    		try {
    			if (!credentials.apiKey || !credentials.apiToken) {
    				return {
    					content: [
    						{
    							type: 'text',
    							text: 'Trello API credentials are not configured',
    						},
    					],
    					isError: true,
    				};
    			}
    
    			const response = await fetch(
    				`https://api.trello.com/1/lists/${listId}/idBoard?key=${credentials.apiKey}&token=${credentials.apiToken}`,
    				{
    					method: 'PUT',
    					headers: {
    						'Content-Type': 'application/json',
    					},
    					body: JSON.stringify({
    						value: boardId,
    					}),
    				}
    			);
    			const data = await response.json();
    			return {
    				content: [
    					{
    						type: 'text',
    						text: JSON.stringify(data),
    					},
    				],
    			};
    		} catch (error) {
    			return {
    				content: [
    					{
    						type: 'text',
    						text: `Error moving list to board: ${error}`,
    					},
    				],
    				isError: true,
    			};
    		}
    	}
    );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/adriangrahldev/advanced-trello-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server