diff --git a/tasksd.c b/tasksd.c index 681746b..bc14c6f 100644 --- a/tasksd.c +++ b/tasksd.c @@ -739,12 +739,12 @@ static void t_list(mcp_conn *c, const mcp_json *args, void *user) static void t_scopes(mcp_conn *c, const mcp_json *args, void *user) { + const char *scope = mcp_arg_string(args, "scope"); char **ids = NULL; size_t n, i, s, nscopes = 0; char **scopes = NULL; mcp_buf b; - (void)args; (void)user; n = scan_tasks(&ids); for (i = 0; i < n; i++) { @@ -754,6 +754,10 @@ static void t_scopes(mcp_conn *c, const mcp_json *args, void *user) if (task_load(ids[i], &t) != 0) continue; + if (!scope_matches(t.scope, scope)) { + free_task(&t); + continue; + } for (k = 0; k < nscopes; k++) if (strcmp(scopes[k], t.scope) == 0) found = 1; @@ -887,13 +891,13 @@ static const mcp_tool TOOLS[] = { "Add a task to the central store. Every task needs three things: a title, a " "GOAL (why it exists, one sentence, written for the agent who picks it up " "later) and a SCOPE - a free string you choose that groups this work, e.g. " - "\"makronix\", \"fleet/console\", \"studio/mastering\". Reuse an existing " + "\"project\", \"fleet/console\", \"studio/mastering\". Reuse an existing " "scope when the work belongs to it; invent a new one only for a new area. " "Higher priority is claimed first.", "{\"type\":\"object\",\"properties\":{" "\"title\":{\"type\":\"string\",\"description\":\"what to do, one line\"}," "\"goal\":{\"type\":\"string\",\"description\":\"why it exists - required\"}," - "\"scope\":{\"type\":\"string\",\"description\":\"category string, e.g. makronix or fleet/console\"}," + "\"scope\":{\"type\":\"string\",\"description\":\"category string, e.g. project or fleet/console\"}," "\"priority\":{\"type\":\"integer\",\"description\":\"higher runs first, default 0\"}," "\"tags\":{\"type\":\"string\",\"description\":\"extra keywords, comma separated\"}}," "\"required\":[\"title\",\"goal\",\"scope\"]}", @@ -922,14 +926,19 @@ static const mcp_tool TOOLS[] = { "\"scope\":{\"type\":\"string\",\"description\":\"empty or omitted matches every scope\"}}}", t_next }, { "task_scopes", - "Overview of every scope that has tasks, with counts of pending, running, " - "paused, done and dropped. Read this when you join work you have not done " - "before: it shows where things are waiting for an agent.", - "{\"type\":\"object\",\"properties\":{}}", + "Overview of the scopes that have tasks, with counts of pending, running, " + "paused, done and dropped. Pass scope= to see only that project and " + "its children. When the working directory is a project, use its name as the " + "scope; never present another project's scopes as the answer to a question " + "about this one.", + "{\"type\":\"object\",\"properties\":{" + "\"scope\":{\"type\":\"string\",\"description\":\"only this project/prefix, e.g. mikronix\"}}}", t_scopes }, { "task_list", "List tasks filtered by scope and, optionally, by state. Use it to see the " - "whole picture of one area, or to review what is paused.", + "whole picture of one area, or to review what is paused. When the user names " + "a project or the working directory is a project, pass its scope; without one " + "the list is global and may be dominated by unrelated work.", "{\"type\":\"object\",\"properties\":{" "\"scope\":{\"type\":\"string\"}," "\"state\":{\"type\":\"string\",\"description\":\"pending|running|paused|done|dropped\"},"