update to handle null lists (errors from get details in 0.19)
CICD / Explore-Gitea-Actions (push) Successful in 35s Details

This commit is contained in:
Isaac Johnson 2025-10-14 06:41:12 -05:00
parent fe9d20ca2d
commit a6626a0959
4 changed files with 16 additions and 13 deletions

View File

@ -20,4 +20,4 @@ RUN pip install --no-cache-dir -r requirements.txt
COPY . . COPY . .
CMD ["python", "main.py"] CMD ["python", "main.py"]
#harbor.freshbrewed.science/library/vikunjamcp:0.19 #harbor.freshbrewed.science/library/vikunjamcp:0.20

Binary file not shown.

View File

@ -1,6 +1,6 @@
{ {
"name": "vikunja", "name": "vikunja",
"version": "1.0.19", "version": "1.0.20",
"mcpServers": { "mcpServers": {
"nodeServer": { "nodeServer": {
"command": "docker", "command": "docker",
@ -14,7 +14,7 @@
"VIKUNJA_USERNAME", "VIKUNJA_USERNAME",
"-e", "-e",
"VIKUNJA_PASSWORD", "VIKUNJA_PASSWORD",
"harbor.freshbrewed.science/library/vikunjamcp:0.19" "harbor.freshbrewed.science/library/vikunjamcp:0.20"
], ],
"env": { "env": {
"VIKUNJA_URL": "$VIKUNJA_URL", "VIKUNJA_URL": "$VIKUNJA_URL",

23
main.py
View File

@ -175,7 +175,7 @@ def get_task_details(task_id: int):
if not details: if not details:
return "No details found for this task." return "No details found for this task."
# Helpers to produce compact readable strings for nested structures # Helpers to produce compact readable strings for nested structures
def join_names(items): def join_names(items):
if not items: if not items:
return "[]" return "[]"
@ -218,7 +218,10 @@ def get_task_details(task_id: int):
project_id = details.get("project_id", "N/A") project_id = details.get("project_id", "N/A")
bucket_id = details.get("bucket_id", "N/A") bucket_id = details.get("bucket_id", "N/A")
buckets = details.get("buckets", []) # Coerce potentially-None fields to safe defaults so len() and iteration are safe.
# Vikunja may return null for some nested fields; normalize to empty lists/dicts
# to avoid TypeError when calling len() or iterating.
buckets = details.get("buckets") or []
index = details.get("index", "N/A") index = details.get("index", "N/A")
position = details.get("position", "N/A") position = details.get("position", "N/A")
@ -226,15 +229,15 @@ def get_task_details(task_id: int):
is_favorite = details.get("is_favorite", details.get("is_favourite", "N/A")) is_favorite = details.get("is_favorite", details.get("is_favourite", "N/A"))
hex_color = details.get("hex_color", "N/A") hex_color = details.get("hex_color", "N/A")
assignees = details.get("assignees", []) assignees = details.get("assignees") or []
attachments = details.get("attachments", []) attachments = details.get("attachments") or []
cover_image_attachment_id = details.get("cover_image_attachment_id", "N/A") cover_image_attachment_id = details.get("cover_image_attachment_id", "N/A")
comments = details.get("comments", []) comments = details.get("comments") or []
labels = details.get("labels", []) labels = details.get("labels") or []
reminders = details.get("reminders", []) reminders = details.get("reminders") or []
reactions = details.get("reactions", {}) reactions = details.get("reactions") or {}
related_tasks = details.get("related_tasks", {}) related_tasks = details.get("related_tasks") or {}
subscription = details.get("subscription", {}) subscription = details.get("subscription") or {}
result = [] result = []
result.append(f"ID: {fetched_id}, Identifier: {identifier}, Title: {title}") result.append(f"ID: {fetched_id}, Identifier: {identifier}, Title: {title}")