@ainote/mcp 1.3.1 → 1.3.3

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.
@@ -1,280 +1,280 @@
1
- import { toSuccessContent, enhanceWithStructuredData } from './internal/formatters.js';
2
-
3
- function listTasksDefinition() {
4
- return {
5
- name: 'list_tasks',
6
- description: `List tasks from AI Note with natural language support and advanced filtering.
7
-
8
- NATURAL LANGUAGE EXAMPLES:
9
- • Location: "여의도에서", "서울에 있는", "강남 관련"
10
- • Time: "오늘", "이번 주", "다음 주", "지난달", "1월에"
11
- • Importance: "중요한", "우선순위 높은", "급한"
12
- • Status: "완료한", "미완료", "안 끝난"
13
- • Special: "마감일 지난", "늦어진", "오늘 마감", "알림 설정된"
14
- • Sort: "마감일 순으로", "최신순으로", "오래된 순으로"
15
-
16
- QUERY EXAMPLES:
17
- 1. "여의도에서 이번 주 마감인 중요한 미완료 할일"
18
- → {location: "여의도", due_date_start: "2025-01-27", due_date_end: "2025-02-02",
19
- is_important: true, status: "pending"}
20
-
21
- 2. "지난달 완료한 업무 카테고리 할일들을 완료일 순으로"
22
- → {category_id: "...", status: "completed",
23
- completed_date_start: "2024-12-01", completed_date_end: "2024-12-31",
24
- sort_by: "completed_at", sort_order: "asc"}
25
-
26
- 3. "마감일 지났는데 아직 안 끝난 할일들 마감일 빠른 순으로"
27
- → {overdue: true, sort_by: "due_date", sort_order: "asc"}
28
-
29
- TIME CALCULATIONS (today = 2025-01-27):
30
- • "오늘" → due_today: true
31
- • "이번 주" → due_date_start: "2025-01-27", due_date_end: "2025-02-02"
32
- • "다음 주" → due_date_start: "2025-02-03", due_date_end: "2025-02-09"
33
- • "이번 달" → due_date_start: "2025-01-01", due_date_end: "2025-01-31"
34
- • "지난 주" → completed_date_start: "2025-01-20", completed_date_end: "2025-01-26"
35
- • "지난 달" → completed_date_start: "2024-12-01", completed_date_end: "2024-12-31"
36
-
37
- Returns structured data with all task fields including location, dates, and categories.`,
38
- inputSchema: {
39
- type: 'object',
40
- properties: {
41
- status: {
42
- type: 'string',
43
- enum: ['pending', 'completed'],
44
- description: 'Filter by task status'
45
- },
46
- is_important: {
47
- type: 'boolean',
48
- description: 'Filter by important tasks only'
49
- },
50
- limit: {
51
- type: 'number',
52
- description: 'Maximum number of tasks to return (default: 25, max: 500)'
53
- },
54
- search: {
55
- type: 'string',
56
- description: 'Search keyword in task content'
57
- },
58
- location: {
59
- type: 'string',
60
- description: 'Filter by location (partial match, e.g., "여의도", "서울")'
61
- },
62
- category_id: {
63
- type: 'string',
64
- description: 'Filter by category UUID'
65
- },
66
- due_date_start: {
67
- type: 'string',
68
- description: 'Filter tasks with due_date >= this date (ISO 8601 format)'
69
- },
70
- due_date_end: {
71
- type: 'string',
72
- description: 'Filter tasks with due_date <= this date (ISO 8601 format)'
73
- },
74
- completed_date_start: {
75
- type: 'string',
76
- description: 'Filter tasks completed >= this date (ISO 8601 format)'
77
- },
78
- completed_date_end: {
79
- type: 'string',
80
- description: 'Filter tasks completed <= this date (ISO 8601 format)'
81
- },
82
- created_date_start: {
83
- type: 'string',
84
- description: 'Filter tasks created >= this date (ISO 8601 format)'
85
- },
86
- created_date_end: {
87
- type: 'string',
88
- description: 'Filter tasks created <= this date (ISO 8601 format)'
89
- },
90
- overdue: {
91
- type: 'boolean',
92
- description: 'Filter overdue incomplete tasks (due_date < today)'
93
- },
94
- due_today: {
95
- type: 'boolean',
96
- description: 'Filter tasks due today'
97
- },
98
- has_notification: {
99
- type: 'boolean',
100
- description: 'Filter by notification enabled status'
101
- },
102
- sort_by: {
103
- type: 'string',
104
- enum: ['due_date', 'created_at', 'completed_at', 'updated_at', 'is_important'],
105
- description: 'Sort field (default: created_at)'
106
- },
107
- sort_order: {
108
- type: 'string',
109
- enum: ['asc', 'desc'],
110
- description: 'Sort order (default: desc)'
111
- }
112
- }
113
- }
114
- };
115
- }
116
-
117
- // Shared field definitions — keep create and update in sync so MCP exposes
118
- // the same surface for both operations. Server-side strong params
119
- // (Api::McpTasksController#task_params) accepts this full set.
120
- const TASK_FIELD_SCHEMA = {
121
- content: {
122
- type: 'string',
123
- description: 'Task content'
124
- },
125
- is_important: {
126
- type: 'boolean',
127
- description: 'Mark task as important'
128
- },
129
- due_date: {
130
- type: 'string',
131
- description: 'Due date in ISO format (e.g., 2026-04-21T15:00:00+09:00)'
132
- },
133
- due_time: {
134
- type: 'string',
135
- description: 'Time of day in HH:MM (24h). Optional when due_date already carries a time.'
136
- },
137
- start_date: {
138
- type: 'string',
139
- description: 'Start date for multi-day events (ISO format). For single-day tasks, use due_date.'
140
- },
141
- is_all_day: {
142
- type: 'boolean',
143
- description: 'Mark as all-day event — suppresses time-of-day rendering.'
144
- },
145
- category_id: {
146
- type: 'string',
147
- description: 'Category ID. Must be owned by or shared to this user.'
148
- },
149
- notes: {
150
- type: 'string',
151
- description: 'Free-form notes / details attached to the task.'
152
- },
153
- location: {
154
- type: 'string',
155
- description: 'Human-readable location (e.g., "Starbucks Gangnam"). For GPS use location_lat/lng.'
156
- },
157
- location_lat: {
158
- type: 'number',
159
- description: 'GPS latitude. Pair with location_lng.'
160
- },
161
- location_lng: {
162
- type: 'number',
163
- description: 'GPS longitude. Pair with location_lat.'
164
- },
165
- travel_time: {
166
- type: 'number',
167
- description: 'Minutes of travel time before due_date to allow for. Used by reminder scheduling.'
168
- },
169
- repeat_rule: {
170
- type: 'string',
171
- description: 'Recurrence rule. Accepted values depend on server (e.g., "daily", "weekly", "monthly", or RRULE). Creates a recurring series.'
172
- },
173
- notification_minutes_before: {
174
- type: 'number',
175
- description: 'Schedule a reminder N minutes before due_date. Pass null/omit to clear existing MCP reminder on update. Requires due_date.'
176
- }
177
- };
178
-
179
- function createTaskDefinition() {
180
- return {
181
- name: 'create_task',
182
- description: 'Create a new task in AI Note with optional notification, location, recurrence, and details.',
183
- inputSchema: {
184
- type: 'object',
185
- properties: { ...TASK_FIELD_SCHEMA },
186
- required: ['content']
187
- }
188
- };
189
- }
190
-
191
- function updateTaskDefinition() {
192
- return {
193
- name: 'update_task',
194
- description: 'Update an existing task — any subset of fields. Pass notification_minutes_before to reschedule the reminder (or null to clear it).',
195
- inputSchema: {
196
- type: 'object',
197
- properties: {
198
- id: {
199
- type: 'string',
200
- description: 'Task ID'
201
- },
202
- completed_at: {
203
- type: 'string',
204
- description: 'Mark as completed (ISO format) or null to uncomplete'
205
- },
206
- ...TASK_FIELD_SCHEMA
207
- },
208
- required: ['id']
209
- }
210
- };
211
- }
212
-
213
- function deleteTaskDefinition() {
214
- return {
215
- name: 'delete_task',
216
- description: 'Delete a task (soft delete)',
217
- inputSchema: {
218
- type: 'object',
219
- properties: {
220
- id: {
221
- type: 'string',
222
- description: 'Task ID to delete'
223
- }
224
- },
225
- required: ['id']
226
- }
227
- };
228
- }
229
-
230
- function listCategoriesDefinition() {
231
- return {
232
- name: 'list_categories',
233
- description: 'List all categories',
234
- inputSchema: {
235
- type: 'object',
236
- properties: {}
237
- }
238
- };
239
- }
240
-
241
- export function getSharedTools() {
242
- return [
243
- {
244
- definition: listTasksDefinition(),
245
- handler: async (args, { apiClient }) => {
246
- const result = await apiClient.callTool('list_tasks', args);
247
- // Enhance result with parsed structured data
248
- return enhanceWithStructuredData(result);
249
- }
250
- },
251
- {
252
- definition: createTaskDefinition(),
253
- handler: async (args, { apiClient }) => {
254
- const result = await apiClient.callTool('create_task', args);
255
- return result; // Return full result with { content: [...] }
256
- }
257
- },
258
- {
259
- definition: updateTaskDefinition(),
260
- handler: async (args, { apiClient }) => {
261
- const result = await apiClient.callTool('update_task', args);
262
- return result; // Return full result with { content: [...] }
263
- }
264
- },
265
- {
266
- definition: deleteTaskDefinition(),
267
- handler: async (args, { apiClient }) => {
268
- const result = await apiClient.callTool('delete_task', args);
269
- return result; // Return full result with { content: [...] }
270
- }
271
- },
272
- {
273
- definition: listCategoriesDefinition(),
274
- handler: async (_args, { apiClient }) => {
275
- const result = await apiClient.callTool('list_categories', {});
276
- return result; // Return full result with { content: [...] }
277
- }
278
- }
279
- ];
280
- }
1
+ import { toSuccessContent, enhanceWithStructuredData } from './internal/formatters.js';
2
+
3
+ function listTasksDefinition() {
4
+ return {
5
+ name: 'list_tasks',
6
+ description: `List tasks from AI Note with natural language support and advanced filtering.
7
+
8
+ NATURAL LANGUAGE EXAMPLES:
9
+ • Location: "여의도에서", "서울에 있는", "강남 관련"
10
+ • Time: "오늘", "이번 주", "다음 주", "지난달", "1월에"
11
+ • Importance: "중요한", "우선순위 높은", "급한"
12
+ • Status: "완료한", "미완료", "안 끝난"
13
+ • Special: "마감일 지난", "늦어진", "오늘 마감", "알림 설정된"
14
+ • Sort: "마감일 순으로", "최신순으로", "오래된 순으로"
15
+
16
+ QUERY EXAMPLES:
17
+ 1. "여의도에서 이번 주 마감인 중요한 미완료 할일"
18
+ → {location: "여의도", due_date_start: "2025-01-27", due_date_end: "2025-02-02",
19
+ is_important: true, status: "pending"}
20
+
21
+ 2. "지난달 완료한 업무 카테고리 할일들을 완료일 순으로"
22
+ → {category_id: "...", status: "completed",
23
+ completed_date_start: "2024-12-01", completed_date_end: "2024-12-31",
24
+ sort_by: "completed_at", sort_order: "asc"}
25
+
26
+ 3. "마감일 지났는데 아직 안 끝난 할일들 마감일 빠른 순으로"
27
+ → {overdue: true, sort_by: "due_date", sort_order: "asc"}
28
+
29
+ TIME CALCULATIONS (today = 2025-01-27):
30
+ • "오늘" → due_today: true
31
+ • "이번 주" → due_date_start: "2025-01-27", due_date_end: "2025-02-02"
32
+ • "다음 주" → due_date_start: "2025-02-03", due_date_end: "2025-02-09"
33
+ • "이번 달" → due_date_start: "2025-01-01", due_date_end: "2025-01-31"
34
+ • "지난 주" → completed_date_start: "2025-01-20", completed_date_end: "2025-01-26"
35
+ • "지난 달" → completed_date_start: "2024-12-01", completed_date_end: "2024-12-31"
36
+
37
+ Returns structured data with all task fields including location, dates, and categories.`,
38
+ inputSchema: {
39
+ type: 'object',
40
+ properties: {
41
+ status: {
42
+ type: 'string',
43
+ enum: ['pending', 'completed'],
44
+ description: 'Filter by task status'
45
+ },
46
+ is_important: {
47
+ type: 'boolean',
48
+ description: 'Filter by important tasks only'
49
+ },
50
+ limit: {
51
+ type: 'number',
52
+ description: 'Maximum number of tasks to return (default: 25, max: 500)'
53
+ },
54
+ search: {
55
+ type: 'string',
56
+ description: 'Search keyword in task content'
57
+ },
58
+ location: {
59
+ type: 'string',
60
+ description: 'Filter by location (partial match, e.g., "여의도", "서울")'
61
+ },
62
+ category_id: {
63
+ type: 'string',
64
+ description: 'Filter by category UUID'
65
+ },
66
+ due_date_start: {
67
+ type: 'string',
68
+ description: 'Filter tasks with due_date >= this date (ISO 8601 format)'
69
+ },
70
+ due_date_end: {
71
+ type: 'string',
72
+ description: 'Filter tasks with due_date <= this date (ISO 8601 format)'
73
+ },
74
+ completed_date_start: {
75
+ type: 'string',
76
+ description: 'Filter tasks completed >= this date (ISO 8601 format)'
77
+ },
78
+ completed_date_end: {
79
+ type: 'string',
80
+ description: 'Filter tasks completed <= this date (ISO 8601 format)'
81
+ },
82
+ created_date_start: {
83
+ type: 'string',
84
+ description: 'Filter tasks created >= this date (ISO 8601 format)'
85
+ },
86
+ created_date_end: {
87
+ type: 'string',
88
+ description: 'Filter tasks created <= this date (ISO 8601 format)'
89
+ },
90
+ overdue: {
91
+ type: 'boolean',
92
+ description: 'Filter overdue incomplete tasks (due_date < today)'
93
+ },
94
+ due_today: {
95
+ type: 'boolean',
96
+ description: 'Filter tasks due today'
97
+ },
98
+ has_notification: {
99
+ type: 'boolean',
100
+ description: 'Filter by notification enabled status'
101
+ },
102
+ sort_by: {
103
+ type: 'string',
104
+ enum: ['due_date', 'created_at', 'completed_at', 'updated_at', 'is_important'],
105
+ description: 'Sort field (default: created_at)'
106
+ },
107
+ sort_order: {
108
+ type: 'string',
109
+ enum: ['asc', 'desc'],
110
+ description: 'Sort order (default: desc)'
111
+ }
112
+ }
113
+ }
114
+ };
115
+ }
116
+
117
+ // Shared field definitions — keep create and update in sync so MCP exposes
118
+ // the same surface for both operations. Server-side strong params
119
+ // (Api::McpTasksController#task_params) accepts this full set.
120
+ const TASK_FIELD_SCHEMA = {
121
+ content: {
122
+ type: 'string',
123
+ description: 'Task content'
124
+ },
125
+ is_important: {
126
+ type: 'boolean',
127
+ description: 'Mark task as important'
128
+ },
129
+ due_date: {
130
+ type: 'string',
131
+ description: 'Due date in ISO format (e.g., 2026-04-21T15:00:00+09:00)'
132
+ },
133
+ due_time: {
134
+ type: 'string',
135
+ description: 'Time of day in HH:MM (24h). Optional when due_date already carries a time.'
136
+ },
137
+ start_date: {
138
+ type: 'string',
139
+ description: 'Start date for multi-day events (ISO format). For single-day tasks, use due_date.'
140
+ },
141
+ is_all_day: {
142
+ type: 'boolean',
143
+ description: 'Mark as all-day event — suppresses time-of-day rendering.'
144
+ },
145
+ category_id: {
146
+ type: 'string',
147
+ description: 'Category ID. Must be owned by or shared to this user.'
148
+ },
149
+ notes: {
150
+ type: 'string',
151
+ description: 'Free-form notes / details attached to the task.'
152
+ },
153
+ location: {
154
+ type: 'string',
155
+ description: 'Human-readable location (e.g., "Starbucks Gangnam"). For GPS use location_lat/lng.'
156
+ },
157
+ location_lat: {
158
+ type: 'number',
159
+ description: 'GPS latitude. Pair with location_lng.'
160
+ },
161
+ location_lng: {
162
+ type: 'number',
163
+ description: 'GPS longitude. Pair with location_lat.'
164
+ },
165
+ travel_time: {
166
+ type: 'number',
167
+ description: 'Minutes of travel time before due_date to allow for. Used by reminder scheduling.'
168
+ },
169
+ repeat_rule: {
170
+ type: 'string',
171
+ description: 'Recurrence rule. Accepted values depend on server (e.g., "daily", "weekly", "monthly", or RRULE). Creates a recurring series.'
172
+ },
173
+ notification_minutes_before: {
174
+ type: 'number',
175
+ description: 'Schedule a reminder N minutes before due_date. Pass null/omit to clear existing MCP reminder on update. Requires due_date.'
176
+ }
177
+ };
178
+
179
+ function createTaskDefinition() {
180
+ return {
181
+ name: 'create_task',
182
+ description: 'Create a new task in AI Note with optional notification, location, recurrence, and details.',
183
+ inputSchema: {
184
+ type: 'object',
185
+ properties: { ...TASK_FIELD_SCHEMA },
186
+ required: ['content']
187
+ }
188
+ };
189
+ }
190
+
191
+ function updateTaskDefinition() {
192
+ return {
193
+ name: 'update_task',
194
+ description: 'Update an existing task — any subset of fields. Pass notification_minutes_before to reschedule the reminder (or null to clear it).',
195
+ inputSchema: {
196
+ type: 'object',
197
+ properties: {
198
+ id: {
199
+ type: 'string',
200
+ description: 'Task ID'
201
+ },
202
+ completed_at: {
203
+ type: 'string',
204
+ description: 'Mark as completed (ISO format) or null to uncomplete'
205
+ },
206
+ ...TASK_FIELD_SCHEMA
207
+ },
208
+ required: ['id']
209
+ }
210
+ };
211
+ }
212
+
213
+ function deleteTaskDefinition() {
214
+ return {
215
+ name: 'delete_task',
216
+ description: 'Delete a task (soft delete)',
217
+ inputSchema: {
218
+ type: 'object',
219
+ properties: {
220
+ id: {
221
+ type: 'string',
222
+ description: 'Task ID to delete'
223
+ }
224
+ },
225
+ required: ['id']
226
+ }
227
+ };
228
+ }
229
+
230
+ function listCategoriesDefinition() {
231
+ return {
232
+ name: 'list_categories',
233
+ description: 'List all categories',
234
+ inputSchema: {
235
+ type: 'object',
236
+ properties: {}
237
+ }
238
+ };
239
+ }
240
+
241
+ export function getSharedTools() {
242
+ return [
243
+ {
244
+ definition: listTasksDefinition(),
245
+ handler: async (args, { apiClient }) => {
246
+ const result = await apiClient.callTool('list_tasks', args);
247
+ // Enhance result with parsed structured data
248
+ return enhanceWithStructuredData(result);
249
+ }
250
+ },
251
+ {
252
+ definition: createTaskDefinition(),
253
+ handler: async (args, { apiClient }) => {
254
+ const result = await apiClient.callTool('create_task', args);
255
+ return result; // Return full result with { content: [...] }
256
+ }
257
+ },
258
+ {
259
+ definition: updateTaskDefinition(),
260
+ handler: async (args, { apiClient }) => {
261
+ const result = await apiClient.callTool('update_task', args);
262
+ return result; // Return full result with { content: [...] }
263
+ }
264
+ },
265
+ {
266
+ definition: deleteTaskDefinition(),
267
+ handler: async (args, { apiClient }) => {
268
+ const result = await apiClient.callTool('delete_task', args);
269
+ return result; // Return full result with { content: [...] }
270
+ }
271
+ },
272
+ {
273
+ definition: listCategoriesDefinition(),
274
+ handler: async (_args, { apiClient }) => {
275
+ const result = await apiClient.callTool('list_categories', {});
276
+ return result; // Return full result with { content: [...] }
277
+ }
278
+ }
279
+ ];
280
+ }