@@ -83,7 +83,11 @@ Handlers return plain data (`(tbd.http/respond 200 {:result 5})`), and the muunt
|
||||
|
||||
Each logged-in user has their own todo list, keyed by their Gitea user id. Every query is
|
||||
filtered by that id, so users can't see or change each other's todos; someone else's todo answers
|
||||
`404`, exactly like a missing one. Without a login the todo routes answer `401`.
|
||||
`404`, exactly like a missing one. Without a login the todo routes answer `401`. The operations
|
||||
themselves (ownership, validation, storage) live in `src/tbd/todo/service.clj`, which the HTTP routes
|
||||
and the [MCP tools](#mcp-server) both call, so they behave the same and are tested once; a route or
|
||||
tool only translates its request into a service call and the result into a response, and never
|
||||
touches the database.
|
||||
|
||||
Todos are stored in a local [SQLite](https://www.sqlite.org/) file, `data/todo.db` by default
|
||||
(git-ignored), which is created and migrated on the first todo request. Set `TODO_DB_PATH` to put it
|
||||
@@ -117,7 +121,9 @@ be the address the client uses; without them `/mcp` answers `503` rather than be
|
||||
It offers these tools: `ping`, `add` (the same logic as `/api/add`), `whoami` (which user this
|
||||
connection acts as, and whether they are an admin), and, on the caller's own todos (the same ones
|
||||
as `/api/todos`), `list_todos`, `get_todo`, `create_todo`, `update_todo` and `delete_todo`. To add a
|
||||
tool, add a `tool` to `src/tbd/mcp/tools.clj`. Its arguments are described by the group's
|
||||
tool, add a `tool` to `src/tbd/mcp/tools.clj`; it should call the group's service (or pure `core`
|
||||
functions), not a database, and if the group has no service yet, that is the thing to add, so the
|
||||
HTTP routes can share it. Its arguments are described by the group's
|
||||
[Malli](https://github.com/metosin/malli) schema in `src/tbd/<group>/schema.clj`, the same schema the
|
||||
HTTP routes use for their parameters, so a shape of data is written down once: the tool's
|
||||
input schema is generated from it, and the arguments a client sends are coerced and validated against
|
||||
|
||||
Reference in New Issue
Block a user