update to handle null lists (errors from get details in 0.19)
CICD / Explore-Gitea-Actions (push) Successful in 35s
Details
CICD / Explore-Gitea-Actions (push) Successful in 35s
Details
This commit is contained in:
parent
fe9d20ca2d
commit
a6626a0959
|
@ -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
|
||||
|
|
Binary file not shown.
|
@ -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",
|
||||
|
|
23
main.py
23
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}")
|
||||
|
|
Loading…
Reference in New Issue