diff --git a/Dockerfile b/Dockerfile index 706303d..ada5bc4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,4 +20,4 @@ RUN pip install --no-cache-dir -r requirements.txt COPY . . CMD ["python", "main.py"] -#harbor.freshbrewed.science/library/vikunjamcp:0.15 +#harbor.freshbrewed.science/library/vikunjamcp:0.16 diff --git a/gemini-extension.json b/gemini-extension.json index fff6fba..46e036e 100644 --- a/gemini-extension.json +++ b/gemini-extension.json @@ -1,6 +1,6 @@ { "name": "vikunja", - "version": "1.0.15", + "version": "1.0.16", "mcpServers": { "nodeServer": { "command": "docker", @@ -14,7 +14,7 @@ "VIKUNJA_USERNAME", "-e", "VIKUNJA_PASSWORD", - "harbor.freshbrewed.science/library/vikunjamcp:0.15" + "harbor.freshbrewed.science/library/vikunjamcp:0.16" ], "env": { "VIKUNJA_URL": "$VIKUNJA_URL", diff --git a/main.py b/main.py index 36b15aa..c62888c 100644 --- a/main.py +++ b/main.py @@ -187,8 +187,36 @@ def comment_task(task_id: int, description: str): logger.exception("comment_task: request failed for task_id=%s", task_id) return f"Error adding comment to task: {e}" +@mcp.tool() +def lookup_comment_task(task_id: int): + """ + Lists comments in a task 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}/comments") + response.raise_for_status() + comments = response.json() + if not comments: + return "No comments found for this task." + + result = [] + for comment in comments: + comment_id = comment.get("id", "N/A") + comment_text = comment.get("comment", "N/A") + comment_created = comment.get("created", "N/A") + comment_author = comment.get("author", "N/A") + result.append(f"ID: {comment_id}, Created: {comment_created}, Author: {comment_author}, Comment: {comment_text}") + return "\n".join(result) - + except requests.exceptions.RequestException as e: + logger.exception("lookup_comment_task: request failed for task_id=%s", task_id) + return f"Error looking up comments to task: {e}" + @mcp.tool() def update_comment(task_id: int, comment_id: int, comment: str): """