# Vikunja tasks tools: design Date: 2026-11-25. Status: implemented (2026-11-25). ## Goal Ask the assistant to list, add, edit, close and delete tasks in the user's Vikunja, by voice or text, in Italian or English. Same Vikunja MCP endpoint the end-of-work skill uses. ## Transport Vikunja's built-in MCP server (`/api/v2/mcp`, streamable HTTP) answers a stateless JSON-RPC `tools/call` POST with no `initialize` and no session id: one request per action, reply as one SSE `data:` line whose `result.structuredContent` holds the JSON. Probed 2026-11-25 with `projects_list` and `tools/list`. The script reads two values from the tool environment (config `[env]`, so the LAN address and pass entry stay out of the repo): - `VIKUNJA_MCP_URL`, the endpoint. - `VIKUNJA_TOKEN_CMD`, a command printing the bearer token on its first line (e.g. `pass show `), run without a shell. `examples/config.toml` gets both as commented placeholders. ## Files `examples/tools/vikunja.py` (stdlib only: urllib, json, datetime, shlex, subprocess) and four tool files, installed to `~/.config/desktop-assistant/tools/`: | Tool | Command | MCP calls | |---------------|---------------------------------|-----------| | `tasks` | `vikunja.py list {query} {project} {due_before} {all} {id}` | `projects_list`, `tasks_list` or `tasks_read` | | `task_add` | `vikunja.py add {title} {description} {due} {project}` | `projects_list`, `tasks_create` | | `task_edit` | `vikunja.py edit {id} {title} {description} {due} {project} {done}` | `projects_list`, `tasks_update` | | `task_delete` | `vikunja.py delete {id}` | `tasks_read`, `tasks_delete` | All four: `cloud = ["hetzner"]`, `timeout = 20`. Every param is a string; empty means not given. ## Tools - **tasks.** `query` matches the title (substring), `project` a project by name, `due_before` a date, `all=1` includes done tasks (default open only), `id` shows one task with its full description. Output, one line per task, sorted by due date (none last), then id, at most 50, capped by the daemon at 2000 characters: `#42 [dev/quickshell] Fix lamp, due Fri 28 Nov 18:00`. Done tasks, when shown, carry `(done)`. A title search with no open match falls back to matching done tasks, then to all open tasks, each under a line saying so (found live: the model does not retry). Nothing found: `no tasks`. - **task_add.** `title` required; `description`, `due`, `project` optional. No project: Inbox (the project titled `Inbox`). Prints the created task's line. - **task_edit.** `id` required; `title`, `description`, `due` (`none` clears it), `project`, `done` (`1`/`0`) optional. Only given fields are sent; `tasks_update` changes only the fields passed. Prints the updated task's line. - **task_delete.** `id`. The description tells the model to call `tasks` with the id first, say the task's title, ask, and call delete only after a yes in the next turn (as `project` does). Prints `deleted #42 "title"`. Writes other than delete run with no confirmation: an edit or done is undone by asking again. Delete moves the task to Vikunja's trash. ## Projects Named by title, case-insensitive. A nested project shows as `parent/title` in output and matches by either form. An unknown name is an error that lists the project names. The tools never create projects. ## Dates In: `YYYY-MM-DD` or `YYYY-MM-DD HH:MM`, local time, which the model builds from the prompt's date stamp. A date with no time means 23:59 that day. Sent to Vikunja as UTC ISO 8601. Out: local time with the weekday printed by the script (the model gets weekdays wrong). A bad date is an error naming the expected forms. ## Descriptions Read and written with `format: "markdown"`. The list shows titles only; `id` shows the description. ## Errors On stderr, exit 1 (the daemon adds `error: `): - HTTP 401: `Vikunja token expired: make a new one in Vikunja, Settings > MCP`. - Unreachable or timeout: `Vikunja unreachable at `. - Token command fails: its own last stderr line. - MCP tool error (`result.isError` or JSON-RPC `error`): its message. - Missing env: `VIKUNJA_MCP_URL / VIKUNJA_TOKEN_CMD not set in config [env]`. ## Testing - `vikunja.py --test`: asserts on date parsing (date only, date and time, `none`, bad input), local/UTC round trip, line formatting and project lookup (case, nested path, unknown). No network. - Live, through a second daemon on a scratch socket and data dir, on a scratch Vikunja project deleted afterwards: add with due and project, list, "what's due this week", edit title and due, mark done, delete (asked first, nothing deleted before the yes); Italian and English phrasings. Findings to AGENTS.md. ## Not done Labels, priority, reminders, assignees, comments, project creation.