File size: 3,817 Bytes
7360460
 
 
 
 
 
 
a65e06d
9ad58d0
7360460
9ad58d0
7360460
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
"""
This module contains tools for managing Trello checklists.
"""

import logging
from typing import Dict, List, Optional

from pmcp.mcp_server.trello_server.services.checklist import ChecklistService
from pmcp.mcp_server.trello_server.trello import trello_client

service = ChecklistService(trello_client)


async def get_checklist(checklist_id: str) -> Dict:
    """
    Get a specific checklist by ID.

    Args:
        checklist_id (str): The ID of the checklist to retrieve

    Returns:
        Dict: The checklist data
    """
    return await service.get_checklist(checklist_id)


async def get_card_checklists(card_id: str) -> List[Dict]:
    """
    Get all checklists for a specific card.

    Args:
        card_id (str): The ID of the card to get checklists for

    Returns:
        List[Dict]: List of checklists on the card
    """
    return await service.get_card_checklists(card_id)


async def create_checklist(card_id: str, name: str, pos: Optional[str] = None) -> Dict:
    """
    Create a new checklist on a card.

    Args:
        card_id (str): The ID of the card to create the checklist on
        name (str): The name of the checklist
        pos (Optional[str]): The position of the checklist (top, bottom, or a positive number)

    Returns:
        Dict: The created checklist data
    """
    return await service.create_checklist(card_id, name, pos)


async def update_checklist(
    checklist_id: str, name: Optional[str] = None, pos: Optional[str] = None
) -> Dict:
    """
    Update an existing checklist.

    Args:
        checklist_id (str): The ID of the checklist to update
        name (Optional[str]): New name for the checklist
        pos (Optional[str]): New position for the checklist

    Returns:
        Dict: The updated checklist data
    """
    return await service.update_checklist(checklist_id, name, pos)


async def delete_checklist(checklist_id: str) -> Dict:
    """
    Delete a checklist.

    Args:
        checklist_id (str): The ID of the checklist to delete

    Returns:
        Dict: The response from the delete operation
    """
    return await service.delete_checklist(checklist_id)


async def add_checkitem(
    checklist_id: str, name: str, checked: bool = False, pos: Optional[str] = None
) -> Dict:
    """
    Add a new item to a checklist.

    Args:
        checklist_id (str): The ID of the checklist to add the item to
        name (str): The name of the checkitem
        checked (bool): Whether the item is checked
        pos (Optional[str]): The position of the item

    Returns:
        Dict: The created checkitem data
    """
    return await service.add_checkitem(checklist_id, name, checked, pos)


async def update_checkitem(
    checklist_id: str,
    checkitem_id: str,
    name: Optional[str] = None,
    checked: Optional[bool] = None,
    pos: Optional[str] = None,
) -> Dict:
    """
    Update a checkitem in a checklist.

    Args:
        checklist_id (str): The ID of the checklist containing the item
        checkitem_id (str): The ID of the checkitem to update
        name (Optional[str]): New name for the checkitem
        checked (Optional[bool]): New checked state
        pos (Optional[str]): New position for the item

    Returns:
        Dict: The updated checkitem data
    """
    return await service.update_checkitem(
        checklist_id, checkitem_id, name, checked, pos
    )


async def delete_checkitem(checklist_id: str, checkitem_id: str) -> Dict:
    """
    Delete a checkitem from a checklist.

    Args:
        checklist_id (str): The ID of the checklist containing the item
        checkitem_id (str): The ID of the checkitem to delete

    Returns:
        Dict: The response from the delete operation
    """
    return await service.delete_checkitem(checklist_id, checkitem_id)