You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/graph/tool-handlers.ts
+62-16Lines changed: 62 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -15,14 +15,15 @@ import {
15
15
listProjectsForMcp,
16
16
listUserTeams,
17
17
getProjectTags,
18
+
getProjectTagsTx,
18
19
getProjectMeta,
19
20
}from"@/lib/data/project";
20
21
import{
21
22
createTask,
22
23
updateTask,
23
24
deleteTask,
24
25
deleteTaskPreview,
25
-
searchTasks,
26
+
searchTasksTx,
26
27
getProjectTasksSlim,
27
28
getTaskFull,
28
29
fetchAssigneesUnchecked,
@@ -81,6 +82,7 @@ import type { AuthContext } from "@/lib/auth/context";
81
82
import{
82
83
ForbiddenError,
83
84
InsufficientRoleError,
85
+
assertProjectAccessTx,
84
86
assertTaskAccess,
85
87
}from"@/lib/auth/authorization";
86
88
import{withUserContext}from"@/lib/db/rls";
@@ -699,7 +701,7 @@ export const DESCRIPTIONS = {
699
701
"Server rejects self-edges, duplicates, and cycles. On 'duplicate edge' (concurrent-write race): treat as success and verify with mymir_query type='edges'.",
700
702
mymir_query:
701
703
"Search and browse project data. Pick the slim tool first; reserve overview for unfamiliar projects. "+
702
-
"search=tasks by taskRef, title, or tag substring (case-insensitive, up to 20). Pass tags=[...] for exact tag match (OR-within); combine with `query` to AND-narrow. Single-result responses include a state hint pointing to the right next call. "+
704
+
"search=tasks by taskRef, title, or tag substring (case-insensitive, up to 20). Pass tags=[...] for exact tag match (OR-within); combine with `query` to AND-narrow. Pass category='...' for exact project-category match (closed vocabulary; unknown values rejected with the valid list inline); combines with query/tags via AND. Single-result responses include a state hint pointing to the right next call. "+
703
705
"list=every task in the project (slim, ordered by position). "+
704
706
"edges=relationships on one task (connected title, status, direction, note). "+
705
707
"meta=slim project metadata: header, description, status, categories, tag vocabulary (with usage counts), progress + status counts. No task list, no edges. Use this to look up categories before setting one, or the tag vocabulary before coining new tags. "+
@@ -785,6 +787,7 @@ export type QueryParams = {
785
787
projectId?: string;
786
788
query?: string;
787
789
tags?: string[];
790
+
category?: string;
788
791
taskId?: string;
789
792
};
790
793
@@ -1359,25 +1362,68 @@ export async function handleQuery(
1359
1362
);
1360
1363
consthasQuery=(p.query?.trim()??"").length>0;
1361
1364
consttagFilter=normalizeTags(p.tags);
1362
-
if(!hasQuery&&tagFilter.length===0){
1365
+
consttrimmedCategory=p.category?.trim()??"";
1366
+
if(
1367
+
!hasQuery&&
1368
+
tagFilter.length===0&&
1369
+
trimmedCategory.length===0
1370
+
){
1363
1371
returnfail(
1364
-
"queryor tags required for search. Pass `query` (taskRef, title or tag substring) or `tags=[...]` (exact tag, OR-within).",
1372
+
"query, tags, or category required for search. Pass `query` (taskRef, title or tag substring), `tags=[...]` (exact tag, OR-within), or `category` (exact project category).",
`Category "${trimmedCategory}" not in this project's categories: [${outcome.categories.join(", ")}]. Run mymir_query type='meta' for the current list.`,
"Filter to tasks containing ANY of these exact tags (OR-within). Combine with `query` to narrow further. Pick from the tag vocabulary in `type='meta'`.",
516
516
),
517
+
category: z
518
+
.string()
519
+
.optional()
520
+
.describe(
521
+
"Filter to tasks in exactly this category (AND with `query`/`tags`). Must be one of the project's categories (closed vocabulary); unknown values are rejected. Run mymir_query type='meta' for the current list.",
522
+
),
517
523
taskId: z.uuid().optional().describe("Task UUID for type='edges'."),
0 commit comments