diff --git a/Dockerfile b/Dockerfile index 60f7b52..e056a1b 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.19 +#harbor.freshbrewed.science/library/vikunjamcp:0.20 diff --git a/__pycache__/main.cpython-311.pyc b/__pycache__/main.cpython-311.pyc new file mode 100644 index 0000000..a8e1df2 Binary files /dev/null and b/__pycache__/main.cpython-311.pyc differ diff --git a/gemini-extension.json b/gemini-extension.json index a3c5c17..a492978 100644 --- a/gemini-extension.json +++ b/gemini-extension.json @@ -1,6 +1,6 @@ { "name": "vikunja", - "version": "1.0.19", + "version": "1.0.20", "mcpServers": { "nodeServer": { "command": "docker", @@ -14,7 +14,7 @@ "VIKUNJA_USERNAME", "-e", "VIKUNJA_PASSWORD", - "harbor.freshbrewed.science/library/vikunjamcp:0.19" + "harbor.freshbrewed.science/library/vikunjamcp:0.20" ], "env": { "VIKUNJA_URL": "$VIKUNJA_URL", diff --git a/main.py b/main.py index 17f401b..5cda223 100644 --- a/main.py +++ b/main.py @@ -175,7 +175,7 @@ def get_task_details(task_id: int): if not details: 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): if not items: return "[]" @@ -218,7 +218,10 @@ def get_task_details(task_id: int): project_id = details.get("project_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") 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")) hex_color = details.get("hex_color", "N/A") - assignees = details.get("assignees", []) - attachments = details.get("attachments", []) + assignees = details.get("assignees") or [] + attachments = details.get("attachments") or [] cover_image_attachment_id = details.get("cover_image_attachment_id", "N/A") - comments = details.get("comments", []) - labels = details.get("labels", []) - reminders = details.get("reminders", []) - reactions = details.get("reactions", {}) - related_tasks = details.get("related_tasks", {}) - subscription = details.get("subscription", {}) + comments = details.get("comments") or [] + labels = details.get("labels") or [] + reminders = details.get("reminders") or [] + reactions = details.get("reactions") or {} + related_tasks = details.get("related_tasks") or {} + subscription = details.get("subscription") or {} result = [] result.append(f"ID: {fetched_id}, Identifier: {identifier}, Title: {title}")