@brxce/mcp-server 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +220 -0
- package/dist/config/environment.d.ts +8 -0
- package/dist/config/environment.d.ts.map +1 -0
- package/dist/config/environment.js +16 -0
- package/dist/config/environment.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +167 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/worknode-prompts.d.ts +7 -0
- package/dist/prompts/worknode-prompts.d.ts.map +1 -0
- package/dist/prompts/worknode-prompts.js +369 -0
- package/dist/prompts/worknode-prompts.js.map +1 -0
- package/dist/prompts/workspace-context-prompt.d.ts +4 -0
- package/dist/prompts/workspace-context-prompt.d.ts.map +1 -0
- package/dist/prompts/workspace-context-prompt.js +101 -0
- package/dist/prompts/workspace-context-prompt.js.map +1 -0
- package/dist/resources/user-resource.d.ts +4 -0
- package/dist/resources/user-resource.d.ts.map +1 -0
- package/dist/resources/user-resource.js +40 -0
- package/dist/resources/user-resource.js.map +1 -0
- package/dist/resources/workspace-members-resource.d.ts +4 -0
- package/dist/resources/workspace-members-resource.d.ts.map +1 -0
- package/dist/resources/workspace-members-resource.js +39 -0
- package/dist/resources/workspace-members-resource.js.map +1 -0
- package/dist/resources/workspace-resource.d.ts +4 -0
- package/dist/resources/workspace-resource.d.ts.map +1 -0
- package/dist/resources/workspace-resource.js +27 -0
- package/dist/resources/workspace-resource.js.map +1 -0
- package/dist/services/api-client.d.ts +17 -0
- package/dist/services/api-client.d.ts.map +1 -0
- package/dist/services/api-client.js +118 -0
- package/dist/services/api-client.js.map +1 -0
- package/dist/tools/meeting-agenda-tool.d.ts +7 -0
- package/dist/tools/meeting-agenda-tool.d.ts.map +1 -0
- package/dist/tools/meeting-agenda-tool.js +452 -0
- package/dist/tools/meeting-agenda-tool.js.map +1 -0
- package/dist/tools/meeting-create-tool.d.ts +8 -0
- package/dist/tools/meeting-create-tool.d.ts.map +1 -0
- package/dist/tools/meeting-create-tool.js +309 -0
- package/dist/tools/meeting-create-tool.js.map +1 -0
- package/dist/tools/meeting-decisions-tool.d.ts +7 -0
- package/dist/tools/meeting-decisions-tool.d.ts.map +1 -0
- package/dist/tools/meeting-decisions-tool.js +431 -0
- package/dist/tools/meeting-decisions-tool.js.map +1 -0
- package/dist/tools/meeting-list-tool.d.ts +7 -0
- package/dist/tools/meeting-list-tool.d.ts.map +1 -0
- package/dist/tools/meeting-list-tool.js +305 -0
- package/dist/tools/meeting-list-tool.js.map +1 -0
- package/dist/tools/meeting-notes-tool.d.ts +7 -0
- package/dist/tools/meeting-notes-tool.d.ts.map +1 -0
- package/dist/tools/meeting-notes-tool.js +318 -0
- package/dist/tools/meeting-notes-tool.js.map +1 -0
- package/dist/tools/meeting-update-tool.d.ts +7 -0
- package/dist/tools/meeting-update-tool.d.ts.map +1 -0
- package/dist/tools/meeting-update-tool.js +310 -0
- package/dist/tools/meeting-update-tool.js.map +1 -0
- package/dist/tools/tag-category-tool.d.ts +4 -0
- package/dist/tools/tag-category-tool.d.ts.map +1 -0
- package/dist/tools/tag-category-tool.js +293 -0
- package/dist/tools/tag-category-tool.js.map +1 -0
- package/dist/tools/tag-search-tool.d.ts +4 -0
- package/dist/tools/tag-search-tool.d.ts.map +1 -0
- package/dist/tools/tag-search-tool.js +358 -0
- package/dist/tools/tag-search-tool.js.map +1 -0
- package/dist/tools/tag-tool.d.ts +4 -0
- package/dist/tools/tag-tool.d.ts.map +1 -0
- package/dist/tools/tag-tool.js +450 -0
- package/dist/tools/tag-tool.js.map +1 -0
- package/dist/tools/worknode-archive-tool.d.ts +7 -0
- package/dist/tools/worknode-archive-tool.d.ts.map +1 -0
- package/dist/tools/worknode-archive-tool.js +163 -0
- package/dist/tools/worknode-archive-tool.js.map +1 -0
- package/dist/tools/worknode-create-tool.d.ts +4 -0
- package/dist/tools/worknode-create-tool.d.ts.map +1 -0
- package/dist/tools/worknode-create-tool.js +382 -0
- package/dist/tools/worknode-create-tool.js.map +1 -0
- package/dist/tools/worknode-my-work-tool.d.ts +8 -0
- package/dist/tools/worknode-my-work-tool.d.ts.map +1 -0
- package/dist/tools/worknode-my-work-tool.js +302 -0
- package/dist/tools/worknode-my-work-tool.js.map +1 -0
- package/dist/tools/worknode-search-tool.d.ts +4 -0
- package/dist/tools/worknode-search-tool.d.ts.map +1 -0
- package/dist/tools/worknode-search-tool.js +289 -0
- package/dist/tools/worknode-search-tool.js.map +1 -0
- package/dist/tools/worknode-subtree-tool.d.ts +4 -0
- package/dist/tools/worknode-subtree-tool.d.ts.map +1 -0
- package/dist/tools/worknode-subtree-tool.js +175 -0
- package/dist/tools/worknode-subtree-tool.js.map +1 -0
- package/dist/tools/worknode-tag-tool.d.ts +4 -0
- package/dist/tools/worknode-tag-tool.d.ts.map +1 -0
- package/dist/tools/worknode-tag-tool.js +353 -0
- package/dist/tools/worknode-tag-tool.js.map +1 -0
- package/dist/tools/worknode-update-tool.d.ts +4 -0
- package/dist/tools/worknode-update-tool.d.ts.map +1 -0
- package/dist/tools/worknode-update-tool.js +409 -0
- package/dist/tools/worknode-update-tool.js.map +1 -0
- package/dist/tools/workspace-inbox-tool.d.ts +8 -0
- package/dist/tools/workspace-inbox-tool.d.ts.map +1 -0
- package/dist/tools/workspace-inbox-tool.js +210 -0
- package/dist/tools/workspace-inbox-tool.js.map +1 -0
- package/dist/tools/workspace-tree-tool.d.ts +4 -0
- package/dist/tools/workspace-tree-tool.d.ts.map +1 -0
- package/dist/tools/workspace-tree-tool.js +419 -0
- package/dist/tools/workspace-tree-tool.js.map +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const WorknodeTypeSchema = z.enum(['goal', 'project', 'subproject', 'task', 'subtask']);
|
|
3
|
+
const WorkNodeStatusSchema = z.enum(['backlog', 'not_started', 'in_progress', 'in_review', 'completed', 'cancelled']);
|
|
4
|
+
const WorkNodePrioritySchema = z.enum(['critical', 'urgent', 'high', 'medium', 'low']);
|
|
5
|
+
const CreateWorknodeSchema = z.object({
|
|
6
|
+
title: z.string().min(1).describe('WorkNode title'),
|
|
7
|
+
description: z.string().optional().describe('WorkNode description'),
|
|
8
|
+
nodeType: WorknodeTypeSchema.describe('Node type in hierarchy: goal (top-level), project, subproject, task, subtask'),
|
|
9
|
+
parentNodeId: z.number().optional().describe('Parent WorkNode ID - required for structured work under existing hierarchy'),
|
|
10
|
+
workspaceId: z.number().optional().describe('Workspace ID (inherited from parent if not specified)'),
|
|
11
|
+
status: WorkNodeStatusSchema.optional().describe(`Initial status - CRITICAL CHOICE:
|
|
12
|
+
- 'backlog': INBOX MODE - Quick capture, no parent needed, organize later
|
|
13
|
+
- 'not_started': DIRECT MODE - Structured planning, requires parent (except goals/projects)
|
|
14
|
+
- Defaults to 'backlog' if omitted`),
|
|
15
|
+
priority: WorkNodePrioritySchema.optional().describe('Priority (defaults to medium)'),
|
|
16
|
+
startDate: z.string().optional().describe('Start date (ISO 8601)'),
|
|
17
|
+
dueDate: z.string().optional().describe('Due date (ISO 8601)'),
|
|
18
|
+
tags: z.array(z.string()).optional().describe('Tags'),
|
|
19
|
+
assignee: z.array(z.string()).optional().describe('Assignee user IDs'),
|
|
20
|
+
});
|
|
21
|
+
const BatchCreateRequestSchema = z.object({
|
|
22
|
+
worknodes: z.array(CreateWorknodeSchema).min(1).describe('Array of WorkNodes to create'),
|
|
23
|
+
preview: z.boolean().optional().default(false).describe('If true, validate but do not create (dry run for user confirmation)'),
|
|
24
|
+
});
|
|
25
|
+
export function registerWorknodeCreateTool(server, apiClient) {
|
|
26
|
+
server.registerTool('brxce_create_worknodes', {
|
|
27
|
+
description: `Create one or more WorkNodes in BRXCE with batch support and preview mode.
|
|
28
|
+
|
|
29
|
+
⚠️ **CRITICAL: Workspace Verification Required**
|
|
30
|
+
Before calling this tool, you MUST determine the workspace:
|
|
31
|
+
|
|
32
|
+
**Case 1: Creating under existing parent (structured work)**
|
|
33
|
+
1. Use \`brxce_workspace_overview\` first to find the parent node
|
|
34
|
+
2. Workspace will be inherited from parent automatically
|
|
35
|
+
3. Verify parent exists in workspace tree before creating
|
|
36
|
+
|
|
37
|
+
**Case 2: Creating root-level or inbox items**
|
|
38
|
+
1. Read the \`user://me\` resource to get available workspaces
|
|
39
|
+
2. Identify the correct workspaceId from the resource data
|
|
40
|
+
3. Use default workspace if user doesn't specify
|
|
41
|
+
4. NEVER assume or guess workspaceId values
|
|
42
|
+
|
|
43
|
+
**Example Workflow (Structured):**
|
|
44
|
+
\`\`\`
|
|
45
|
+
User: "MVP 프로젝트 아래에 백엔드 개발 태스크 추가해줘"
|
|
46
|
+
LLM:
|
|
47
|
+
1. Calls brxce_workspace_overview to find "MVP" project
|
|
48
|
+
2. Finds project ID 856 in workspace 138
|
|
49
|
+
3. Creates task with parentNodeId: 856 (workspace auto-inherited)
|
|
50
|
+
\`\`\`
|
|
51
|
+
|
|
52
|
+
**Example Workflow (Inbox/Root):**
|
|
53
|
+
\`\`\`
|
|
54
|
+
User: "기억해줘, 블로그 글 써야 해"
|
|
55
|
+
LLM:
|
|
56
|
+
1. Reads user://me resource
|
|
57
|
+
2. Finds default workspace: 138
|
|
58
|
+
3. Creates inbox item with workspaceId: 138, status: "backlog"
|
|
59
|
+
\`\`\`
|
|
60
|
+
|
|
61
|
+
BRXCE WorkNode Hierarchy:
|
|
62
|
+
🎯 Goal - Top-level strategic objectives (no parent required)
|
|
63
|
+
├── 📁 Project - Major initiatives to achieve goals (can have goal as parent or be root-level)
|
|
64
|
+
│ ├── 📂 SubProject - Component parts of projects (requires project or subproject parent)
|
|
65
|
+
│ │ ├── ✅ Task - Actionable work items (requires project/subproject parent)
|
|
66
|
+
│ │ │ └── ☑️ SubTask - Granular task breakdown (requires task parent)
|
|
67
|
+
|
|
68
|
+
🔑 TWO CRITICAL CREATION MODES - Choose Wisely:
|
|
69
|
+
|
|
70
|
+
1️⃣ INBOX MODE (status: 'backlog', no parent):
|
|
71
|
+
📥 Use when user says: "I need to...", "Remember to...", "Don't forget...", "Add this to my list..."
|
|
72
|
+
💡 For quick capture of ideas that need organization later
|
|
73
|
+
✅ Creates standalone items in backlog status (inbox area)
|
|
74
|
+
✅ No parent required - user will organize them later
|
|
75
|
+
✅ Low friction - just capture the thought
|
|
76
|
+
|
|
77
|
+
Example scenarios:
|
|
78
|
+
- "기억해줘, 다음주에 고객 미팅 준비해야 해"
|
|
79
|
+
- "나중에 블로그 글 써야겠다고 생각했어"
|
|
80
|
+
- "API 문서 업데이트하는 거 잊지 말자"
|
|
81
|
+
|
|
82
|
+
How to create:
|
|
83
|
+
{
|
|
84
|
+
"worknodes": [{
|
|
85
|
+
"title": "고객 미팅 준비",
|
|
86
|
+
"nodeType": "task",
|
|
87
|
+
"status": "backlog" // ← KEY: backlog for inbox
|
|
88
|
+
// NO parentNodeId - it's an inbox item
|
|
89
|
+
}]
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
2️⃣ DIRECT CREATION MODE (status: 'not_started', with parent):
|
|
93
|
+
🎯 Use when user is actively planning/organizing within existing structure
|
|
94
|
+
💡 For structured work that fits into current goals/projects
|
|
95
|
+
✅ Creates items ready to work on (not_started status)
|
|
96
|
+
✅ Requires proper parent in hierarchy
|
|
97
|
+
✅ Part of active planning - not just capturing
|
|
98
|
+
|
|
99
|
+
Example scenarios:
|
|
100
|
+
- "MVP 프로젝트 아래에 백엔드 개발 태스크 추가해줘"
|
|
101
|
+
- "이 Goal 아래에 3개 프로젝트 만들어줘"
|
|
102
|
+
- "현재 스프린트에 이 작업들 넣어줘"
|
|
103
|
+
|
|
104
|
+
How to create:
|
|
105
|
+
{
|
|
106
|
+
"worknodes": [{
|
|
107
|
+
"title": "백엔드 개발",
|
|
108
|
+
"nodeType": "task",
|
|
109
|
+
"parentNodeId": 100, // ← KEY: has parent
|
|
110
|
+
"status": "not_started" // ← KEY: ready to work
|
|
111
|
+
}]
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
🤔 HOW TO DECIDE:
|
|
115
|
+
- User mentions existing Goal/Project/Parent? → Direct Creation (not_started)
|
|
116
|
+
- User just capturing ideas/todos? → Inbox Mode (backlog)
|
|
117
|
+
- User says "organize", "plan", "structure"? → Direct Creation
|
|
118
|
+
- User says "remember", "don't forget", "add to list"? → Inbox Mode
|
|
119
|
+
- Multiple related items forming a structure? → Direct Creation with hierarchy
|
|
120
|
+
- Single random thought? → Inbox Mode
|
|
121
|
+
|
|
122
|
+
Best Practices:
|
|
123
|
+
1. Always use preview: true first to show the user what will be created
|
|
124
|
+
2. For hierarchical structures, create parent nodes first and use their IDs for children
|
|
125
|
+
3. Workspace is inherited from parent if not specified
|
|
126
|
+
4. Default status is 'backlog' (inbox) if not specified - but be intentional!
|
|
127
|
+
5. Goals and Projects can be root-level (no parent)
|
|
128
|
+
6. SubProjects, Tasks, and SubTasks typically require appropriate parents
|
|
129
|
+
|
|
130
|
+
Preview Mode (preview: true):
|
|
131
|
+
- Validates all inputs without creating
|
|
132
|
+
- Shows inferred workspaceId from parent or user default
|
|
133
|
+
- Shows parent node information (id, title, type, level)
|
|
134
|
+
- Returns warnings for potential issues (e.g., hierarchy mismatch)
|
|
135
|
+
- Returns errors for validation failures
|
|
136
|
+
- Allows user to confirm before actual creation
|
|
137
|
+
|
|
138
|
+
Creation Mode (preview: false or omitted):
|
|
139
|
+
- Actually creates the WorkNodes
|
|
140
|
+
- Returns created nodes with full details
|
|
141
|
+
- Returns failed items with error messages
|
|
142
|
+
|
|
143
|
+
Example 1 - INBOX MODE (Quick Capture):
|
|
144
|
+
User: "기억해줘, 내일 고객한테 이메일 보내야 해"
|
|
145
|
+
{
|
|
146
|
+
"worknodes": [{
|
|
147
|
+
"title": "고객에게 이메일 발송",
|
|
148
|
+
"nodeType": "task",
|
|
149
|
+
"status": "backlog", // Inbox item
|
|
150
|
+
"priority": "medium"
|
|
151
|
+
// No parent - will organize later
|
|
152
|
+
}],
|
|
153
|
+
"preview": true
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
Example 2 - DIRECT CREATION (Structured Planning):
|
|
157
|
+
User: "Launch AI SaaS Goal 만들고 그 아래 MVP 개발 프로젝트 추가해줘"
|
|
158
|
+
{
|
|
159
|
+
"worknodes": [
|
|
160
|
+
{
|
|
161
|
+
"title": "Launch AI Writing SaaS",
|
|
162
|
+
"description": "Build and launch SaaS in 6 months",
|
|
163
|
+
"nodeType": "goal",
|
|
164
|
+
"status": "not_started", // Ready to work on
|
|
165
|
+
"priority": "critical",
|
|
166
|
+
"dueDate": "2025-06-30T23:59:59Z"
|
|
167
|
+
}
|
|
168
|
+
],
|
|
169
|
+
"preview": true
|
|
170
|
+
}
|
|
171
|
+
// Then after getting Goal ID (e.g., 100):
|
|
172
|
+
{
|
|
173
|
+
"worknodes": [{
|
|
174
|
+
"title": "MVP Development",
|
|
175
|
+
"nodeType": "project",
|
|
176
|
+
"parentNodeId": 100, // Under the Goal
|
|
177
|
+
"status": "not_started", // Part of active planning
|
|
178
|
+
"priority": "high"
|
|
179
|
+
}],
|
|
180
|
+
"preview": false
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
Example 3 - BATCH INBOX ITEMS:
|
|
184
|
+
User: "오늘 생각난 것들: 블로그 글 쓰기, 운동 계획, 독서 시작"
|
|
185
|
+
{
|
|
186
|
+
"worknodes": [
|
|
187
|
+
{
|
|
188
|
+
"title": "블로그 글 작성",
|
|
189
|
+
"nodeType": "task",
|
|
190
|
+
"status": "backlog" // All inbox items
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"title": "운동 계획 세우기",
|
|
194
|
+
"nodeType": "task",
|
|
195
|
+
"status": "backlog"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"title": "책 읽기 시작",
|
|
199
|
+
"nodeType": "task",
|
|
200
|
+
"status": "backlog"
|
|
201
|
+
}
|
|
202
|
+
],
|
|
203
|
+
"preview": false
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
Example 4 - BATCH STRUCTURED TASKS:
|
|
207
|
+
User: "프로젝트 #101 아래에 백엔드랑 프론트엔드 태스크 추가"
|
|
208
|
+
{
|
|
209
|
+
"worknodes": [
|
|
210
|
+
{
|
|
211
|
+
"title": "백엔드 API 개발",
|
|
212
|
+
"nodeType": "task",
|
|
213
|
+
"parentNodeId": 101,
|
|
214
|
+
"status": "not_started", // Structured work
|
|
215
|
+
"priority": "high",
|
|
216
|
+
"assignee": ["backend-dev-id"]
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"title": "프론트엔드 UI 구현",
|
|
220
|
+
"nodeType": "task",
|
|
221
|
+
"parentNodeId": 101,
|
|
222
|
+
"status": "not_started",
|
|
223
|
+
"priority": "high",
|
|
224
|
+
"assignee": ["frontend-dev-id"]
|
|
225
|
+
}
|
|
226
|
+
],
|
|
227
|
+
"preview": false
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
⚠️ CRITICAL RULES:
|
|
231
|
+
1. STATUS CHOICE MATTERS:
|
|
232
|
+
- INBOX (backlog): Quick thoughts, no parent, organize later
|
|
233
|
+
- DIRECT (not_started): Active planning, needs parent (except goal/project)
|
|
234
|
+
|
|
235
|
+
2. HIERARCHY RULES:
|
|
236
|
+
- SubProjects, Tasks, SubTasks → MUST have parentNodeId (use DIRECT mode)
|
|
237
|
+
- Goals, Projects → CAN be root-level (use INBOX or DIRECT based on context)
|
|
238
|
+
|
|
239
|
+
3. PARENT REQUIREMENT:
|
|
240
|
+
- If status='not_started' BUT no parent → Will fail for task/subtask/subproject
|
|
241
|
+
- If status='backlog' with parent → Works but unusual (item is planned but in inbox)
|
|
242
|
+
|
|
243
|
+
4. VALIDATION:
|
|
244
|
+
- Workspace access is validated for the authenticated user
|
|
245
|
+
- Start date must be before due date if both are specified
|
|
246
|
+
- Use preview mode to validate complex hierarchies before creation
|
|
247
|
+
|
|
248
|
+
5. DEFAULT BEHAVIOR:
|
|
249
|
+
- No status specified → defaults to 'backlog' (INBOX mode)
|
|
250
|
+
- LLM should be EXPLICIT about status choice based on user intent
|
|
251
|
+
|
|
252
|
+
⏰ **TIMEZONE HANDLING:**
|
|
253
|
+
When specifying dates (dueDate, startDate), provide them in ISO 8601 format with timezone information.
|
|
254
|
+
The API will store dates in UTC, but the LLM should help users specify dates in their local timezone.
|
|
255
|
+
|
|
256
|
+
Example for Korea Time (UTC+9):
|
|
257
|
+
- User says: "Due on October 20" → LLM converts to: "2025-10-20T14:59:59.999Z" (end of day in KST)
|
|
258
|
+
- User says: "Start on October 15 at 2pm" → LLM converts to: "2025-10-15T05:00:00.000Z" (2pm KST)
|
|
259
|
+
|
|
260
|
+
When creating WorkNodes with dates:
|
|
261
|
+
1. Check the current date/time from the <env> tag in the system prompt
|
|
262
|
+
2. Identify the user's timezone (e.g., Asia/Seoul = UTC+9)
|
|
263
|
+
3. Convert user's local dates to UTC for the API
|
|
264
|
+
4. For date-only input (dueDate without time), use end of day (23:59:59) in user's timezone`,
|
|
265
|
+
inputSchema: {
|
|
266
|
+
worknodes: z.array(CreateWorknodeSchema).min(1).describe('Array of WorkNodes to create'),
|
|
267
|
+
preview: z.boolean().optional().describe('If true, validate but do not create (dry run for user confirmation)'),
|
|
268
|
+
},
|
|
269
|
+
}, async (args) => {
|
|
270
|
+
const request = args;
|
|
271
|
+
try {
|
|
272
|
+
const response = await apiClient.post('/mcp/worknodes/create', request);
|
|
273
|
+
if (!response.success) {
|
|
274
|
+
return {
|
|
275
|
+
content: [
|
|
276
|
+
{
|
|
277
|
+
type: 'text',
|
|
278
|
+
text: `Failed to create WorkNodes: ${response.message || 'Unknown error'}`,
|
|
279
|
+
},
|
|
280
|
+
],
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
const { data } = response;
|
|
284
|
+
if (data.preview) {
|
|
285
|
+
// Preview mode response
|
|
286
|
+
let resultText = '## WorkNode Creation Preview\n\n';
|
|
287
|
+
resultText += `**Summary**: ${data.summary.valid}/${data.summary.total} valid, ${data.summary.invalid}/${data.summary.total} invalid\n\n`;
|
|
288
|
+
if (data.previews && data.previews.length > 0) {
|
|
289
|
+
for (let i = 0; i < data.previews.length; i++) {
|
|
290
|
+
const preview = data.previews[i];
|
|
291
|
+
if (!preview)
|
|
292
|
+
continue;
|
|
293
|
+
const status = preview.valid ? '✅ VALID' : '❌ INVALID';
|
|
294
|
+
resultText += `### ${i + 1}. ${preview.node?.title || 'Untitled'} (${preview.node?.nodeType || 'unknown'}) - ${status}\n\n`;
|
|
295
|
+
if (preview.inferredWorkspaceId) {
|
|
296
|
+
resultText += `- **Workspace ID**: ${preview.inferredWorkspaceId}\n`;
|
|
297
|
+
}
|
|
298
|
+
if (preview.inferredParentInfo) {
|
|
299
|
+
resultText += `- **Parent**: #${preview.inferredParentInfo.id} "${preview.inferredParentInfo.title}" (${preview.inferredParentInfo.nodeType}, level ${preview.inferredParentInfo.nodeLevel})\n`;
|
|
300
|
+
}
|
|
301
|
+
if (preview.warnings && preview.warnings.length > 0) {
|
|
302
|
+
resultText += `- **Warnings**:\n`;
|
|
303
|
+
preview.warnings.forEach(w => resultText += ` ⚠️ ${w}\n`);
|
|
304
|
+
}
|
|
305
|
+
if (preview.errors && preview.errors.length > 0) {
|
|
306
|
+
resultText += `- **Errors**:\n`;
|
|
307
|
+
preview.errors.forEach(e => resultText += ` ❌ ${e}\n`);
|
|
308
|
+
}
|
|
309
|
+
resultText += '\n';
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
if (data.summary.valid === data.summary.total) {
|
|
313
|
+
resultText += '\n✅ **All WorkNodes are valid and ready to create!**\n';
|
|
314
|
+
resultText += 'Call this tool again with `preview: false` to create them.\n';
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
resultText += '\n⚠️ **Some WorkNodes have validation errors.**\n';
|
|
318
|
+
resultText += 'Please fix the errors before creating.\n';
|
|
319
|
+
}
|
|
320
|
+
return {
|
|
321
|
+
content: [
|
|
322
|
+
{
|
|
323
|
+
type: 'text',
|
|
324
|
+
text: resultText,
|
|
325
|
+
},
|
|
326
|
+
],
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
// Creation mode response
|
|
331
|
+
let resultText = '## WorkNode Creation Result\n\n';
|
|
332
|
+
resultText += `**Created**: ${data.summary.created}/${data.summary.total}\n`;
|
|
333
|
+
if (data.summary.failed && data.summary.failed > 0) {
|
|
334
|
+
resultText += `**Failed**: ${data.summary.failed}/${data.summary.total}\n`;
|
|
335
|
+
}
|
|
336
|
+
resultText += '\n';
|
|
337
|
+
if (data.created && data.created.length > 0) {
|
|
338
|
+
resultText += '### ✅ Successfully Created:\n\n';
|
|
339
|
+
data.created.forEach((node, i) => {
|
|
340
|
+
resultText += `${i + 1}. **${node.title}** (${node.nodeType})\n`;
|
|
341
|
+
resultText += ` - ID: ${node.id}\n`;
|
|
342
|
+
resultText += ` - Workspace: ${node.workspaceId}\n`;
|
|
343
|
+
if (node.parentNodeId) {
|
|
344
|
+
resultText += ` - Parent: #${node.parentNodeId}\n`;
|
|
345
|
+
}
|
|
346
|
+
resultText += ` - Status: ${node.status}\n`;
|
|
347
|
+
if (node.priority) {
|
|
348
|
+
resultText += ` - Priority: ${node.priority}\n`;
|
|
349
|
+
}
|
|
350
|
+
resultText += '\n';
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
if (data.failed && data.failed.length > 0) {
|
|
354
|
+
resultText += '### ❌ Failed to Create:\n\n';
|
|
355
|
+
data.failed.forEach((failure) => {
|
|
356
|
+
resultText += `${failure.index + 1}. ${failure.error}\n`;
|
|
357
|
+
});
|
|
358
|
+
resultText += '\n';
|
|
359
|
+
}
|
|
360
|
+
return {
|
|
361
|
+
content: [
|
|
362
|
+
{
|
|
363
|
+
type: 'text',
|
|
364
|
+
text: resultText,
|
|
365
|
+
},
|
|
366
|
+
],
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
catch (error) {
|
|
371
|
+
return {
|
|
372
|
+
content: [
|
|
373
|
+
{
|
|
374
|
+
type: 'text',
|
|
375
|
+
text: `Error creating WorkNodes: ${error.message || 'Unknown error'}`,
|
|
376
|
+
},
|
|
377
|
+
],
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
//# sourceMappingURL=worknode-create-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worknode-create-tool.js","sourceRoot":"","sources":["../../src/tools/worknode-create-tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;AACxF,MAAM,oBAAoB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC;AACtH,MAAM,sBAAsB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;AAEvF,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,gBAAgB,CAAC;IACnD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC;IACnE,QAAQ,EAAE,kBAAkB,CAAC,QAAQ,CAAC,8EAA8E,CAAC;IACrH,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4EAA4E,CAAC;IAC1H,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE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F,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { ApiClient } from '../services/api-client.js';
|
|
3
|
+
/**
|
|
4
|
+
* Register WorkNode my-work tool for LLM-invoked queries
|
|
5
|
+
* This tool allows the LLM to automatically fetch user's work based on context
|
|
6
|
+
*/
|
|
7
|
+
export declare function registerWorknodeMyWorkTool(server: McpServer, apiClient: ApiClient): void;
|
|
8
|
+
//# sourceMappingURL=worknode-my-work-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worknode-my-work-tool.d.ts","sourceRoot":"","sources":["../../src/tools/worknode-my-work-tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAe3D;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,QAkWjF"}
|