wip
This commit is contained in:
parent
5c95a27bb0
commit
e125661161
37
main.py
37
main.py
|
@ -151,6 +151,43 @@ def active_tasks(project_id: int = None):
|
|||
logger.exception("active_tasks: request failed")
|
||||
return f"Error retrieving active tasks: {e}"
|
||||
|
||||
@mcp.tool()
|
||||
def get_task_details(task_id: int):
|
||||
"""
|
||||
Gets task details in Vikunja.
|
||||
|
||||
:param task_id: The ID of the task of which to fetch comments.
|
||||
"""
|
||||
if "Authorization" not in session.headers:
|
||||
return "Please run the 'login' command first."
|
||||
|
||||
try:
|
||||
response = session.get(f"{VIKUNJA_URL}/api/v1/tasks/{task_id}")
|
||||
response.raise_for_status()
|
||||
details = response.json()
|
||||
if not details:
|
||||
return "No details found for this task."
|
||||
|
||||
result = []
|
||||
task_id = details.get("id", "N/A")
|
||||
task_created = details.get("created", "N/A")
|
||||
task_done = details.get("done", "N/A")
|
||||
task_percent_done = details.get("percent_done", "N/A")
|
||||
task_due_date = details.get("due_date", "N/A")
|
||||
task_favorite = details.get("is_favorite", "N/A")
|
||||
task_position = details.get("position", "N/A")
|
||||
task_priority = details.get("priority", "N/A")
|
||||
task_title = details.get("title", "N/A")
|
||||
task_description = details.get("description", "N/A")
|
||||
task_project_id = details.get("project_id", "N/A")
|
||||
|
||||
result.append(f"ID: {task_id}, Created: {task_created}, Done: {task_done}, Percent Done: {task_percent_done}, Due Date: {task_due_date}, Favorite: {task_favorite}, Position: {task_position}, Priority: {task_priority}, Title: {task_title}, Description: {task_description}, Project ID: {task_project_id}")
|
||||
return "\n".join(result)
|
||||
|
||||
except requests.exceptions.RequestException as e:
|
||||
logger.exception("get_task_details: request failed for task_id=%s", task_id)
|
||||
return f"Error looking up details for task: {e}"
|
||||
|
||||
@mcp.tool()
|
||||
def add_task(project_id: int, title: str, description: str = ""):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue