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 . .
|
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.
|
@ -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",
|
||||||
|
|
21
main.py
21
main.py
|
@ -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}")
|
||||||
|
|
Loading…
Reference in New Issue