togello-mcp-server 1.0.25 → 1.0.27
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 +60 -25
- package/build/handlers/tool/completeActivityLogHandler.js +8 -18
- package/build/handlers/tool/createTaskHandler.js +6 -16
- package/build/handlers/tool/getActivityItemListHandler.js +8 -23
- package/build/handlers/tool/getActivityLogListHandler.js +10 -27
- package/build/handlers/tool/getCalendarDateMemoHandler.js +7 -18
- package/build/handlers/tool/getJapanCurrentTimeHandler.js +7 -17
- package/build/handlers/tool/getTodayCalendarHandler.js +15 -47
- package/build/handlers/tool/getTodoCategoryListHandler.js +8 -23
- package/build/handlers/tool/getTodoListHandler.js +17 -37
- package/build/handlers/tool/startActivityLogHandler.js +7 -17
- package/build/handlers/tool/toolResponse.js +28 -0
- package/build/handlers/tool/updateCalendarDateMemoHandler.js +8 -18
- package/build/handlers/tool/updateTaskHandler.js +8 -17
- package/build/index.js +75 -5
- package/build/mcpServer.js +132 -64
- package/build/remoteServer.js +57 -2
- package/package.json +28 -8
- package/build/handlers/tasksHandler.js +0 -36
- package/build/handlers/tool/getTodayMemoHandler.js +0 -27
- package/build/handlers/tool/updateTodayMemoHandler.js +0 -30
package/README.md
CHANGED
|
@@ -1,56 +1,91 @@
|
|
|
1
1
|
# Togello MCP Server
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Togello MCP Server exposes Togello tasks, categories, calendar memos, Google Calendar events, activity items, and activity logs through the Model Context Protocol.
|
|
4
4
|
|
|
5
5
|
https://togello.com/sign
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Requirements
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
- Node.js 22 or later
|
|
10
|
+
- A Togello API token
|
|
11
|
+
|
|
12
|
+
## Local MCP With npm
|
|
13
|
+
|
|
14
|
+
Use this for desktop clients and local developer tools that launch MCP servers over stdio.
|
|
15
|
+
|
|
16
|
+
```json
|
|
10
17
|
{
|
|
11
18
|
"mcpServers": {
|
|
12
19
|
"togello": {
|
|
13
20
|
"command": "npx",
|
|
14
21
|
"args": ["-y", "togello-mcp-server"],
|
|
15
22
|
"env": {
|
|
16
|
-
"TOGELLO_API_TOKEN": "replace_with_your_token"
|
|
23
|
+
"TOGELLO_API_TOKEN": "replace_with_your_token"
|
|
17
24
|
}
|
|
18
25
|
}
|
|
19
26
|
}
|
|
20
27
|
}
|
|
21
28
|
```
|
|
22
29
|
|
|
23
|
-
##
|
|
30
|
+
## Remote MCP
|
|
24
31
|
|
|
25
|
-
|
|
32
|
+
Remote mode exposes an SSE endpoint at `/sse` and a message endpoint at `/message`.
|
|
26
33
|
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
```bash
|
|
35
|
+
TOGELLO_MCP_MODE=remote \
|
|
36
|
+
TOGELLO_MCP_AUTH_MODE=passthrough \
|
|
37
|
+
TOGELLO_MCP_HOST=0.0.0.0 \
|
|
38
|
+
TOGELLO_MCP_PORT=8081 \
|
|
39
|
+
npm start
|
|
40
|
+
```
|
|
29
41
|
|
|
30
|
-
|
|
42
|
+
Connect remote MCP clients to:
|
|
31
43
|
|
|
32
|
-
|
|
33
|
-
-
|
|
34
|
-
|
|
35
|
-
- get-calendar-date-memo: カレンダー日付メモ機能から指定日のメモを取得します。`date` とメモ内容を認識できます。
|
|
36
|
-
- update-calendar-date-memo: カレンダー日付メモ機能の指定日のメモを更新します。`date` と `memo` を指定し、空文字または空白のみを渡すとその日のメモを削除できます。
|
|
37
|
-
- get-todo-category-list: TODO 機能からカテゴリーリストを取得します。カテゴリー名 / カテゴリー UUID を認識できます。
|
|
38
|
-
- get-today-calendar: 連携している Google カレンダーの昨日/今日/明日の予定を取得します。予定名 / 開始日時 / 終了日時 を認識できます。
|
|
39
|
-
- get-activity-item-list: 統合機能からアクティビティ項目のリストを取得します。アクティビティ項目 UUID / 項目名 を認識できます。
|
|
40
|
-
- get-activity-log-list: 統合機能からアクティビティログのリストを取得します。すべてのログの終了日時が入力されている場合、現在何も実行していないことを意味します。終了日時が null のものがある場合(最大で 1 つ)、現在その活動を実行中であることを意味します。アクティビティログ UUID / 開始日時 / 終了日時 / 項目名 を認識できます。
|
|
41
|
-
- start-activity-log: アクティビティログを開始します。`get-activity-item-list` で取得した項目名(`activityItemName`)を指定する必要があります。`get-activity-log-list` で取得したログリストの全ての `endDateTime` に値がある場合(現在実行中のアクティビティがない場合)に呼び出すことができます。
|
|
42
|
-
- complete-activity-log: アクティビティログを完了します。`get-activity-log-list` で取得した、現在実行中のアクティビティログの UUID(`activityLogUUID`)を指定する必要があります。
|
|
43
|
-
- get-japan-current-time: Returns the current time in Japan (JST). No parameters are required.
|
|
44
|
+
```text
|
|
45
|
+
https://your-domain.example/sse
|
|
46
|
+
```
|
|
44
47
|
|
|
45
|
-
|
|
48
|
+
`passthrough` auth expects each remote client request to send its own Togello API token as an `Authorization: Bearer ...` header. Use this mode for published remote MCP servers.
|
|
49
|
+
|
|
50
|
+
`env` auth uses one server-side `TOGELLO_API_TOKEN` for every remote client. It is intended only for trusted local or single-user deployments. When binding to a non-local host, `TOGELLO_MCP_AUTH_MODE=env` also requires `TOGELLO_MCP_ALLOW_ENV_AUTH=true` so public deployments cannot enable shared-token auth by accident.
|
|
51
|
+
|
|
52
|
+
ChatGPT developer mode can add remote MCP servers that use SSE. For production ChatGPT apps or connectors, use `passthrough` auth or a deployment that authenticates each user separately before forwarding requests to Togello.
|
|
46
53
|
|
|
47
|
-
|
|
48
|
-
https://mcpreview.com/mcp-servers/toru-takagi/togello-mcp-server
|
|
54
|
+
## Tools
|
|
49
55
|
|
|
56
|
+
Read-only tools include MCP `readOnlyHint` annotations and return stable JSON in both `structuredContent` and text content.
|
|
50
57
|
|
|
51
|
-
|
|
58
|
+
- `get-tasks-list`: Retrieves incomplete TODO tasks. Optional `categoryUUIDs` filters by category UUID.
|
|
59
|
+
- `get-calendar-date-memo`: Retrieves a calendar date memo for a `YYYY-MM-DD` date.
|
|
60
|
+
- `get-todo-category-list`: Retrieves TODO categories.
|
|
61
|
+
- `get-today-calendar`: Retrieves linked Google Calendar events and scheduled tasks.
|
|
62
|
+
- `get-activity-item-list`: Retrieves enabled activity items.
|
|
63
|
+
- `get-activity-log-list`: Retrieves activity logs.
|
|
64
|
+
- `get-japan-current-time`: Returns the current time in Japan.
|
|
52
65
|
|
|
66
|
+
Write tools return JSON. Failed tool responses also return JSON and are marked with `isError: true`.
|
|
67
|
+
|
|
68
|
+
- `create-task`: Creates a TODO task.
|
|
69
|
+
- `update-task`: Updates a TODO task.
|
|
70
|
+
- `update-calendar-date-memo`: Updates or clears a calendar date memo.
|
|
71
|
+
- `start-activity-log`: Starts an activity log.
|
|
72
|
+
- `complete-activity-log`: Completes an activity log.
|
|
73
|
+
|
|
74
|
+
## Development
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
npm install
|
|
78
|
+
npm run build
|
|
53
79
|
```
|
|
80
|
+
|
|
81
|
+
## MCP Review
|
|
82
|
+
|
|
83
|
+
Certified
|
|
84
|
+
https://mcpreview.com/mcp-servers/toru-takagi/togello-mcp-server
|
|
85
|
+
|
|
86
|
+
## Publish
|
|
87
|
+
|
|
88
|
+
```bash
|
|
54
89
|
npm run build
|
|
55
90
|
npm version patch
|
|
56
91
|
npm publish --access public
|
|
@@ -1,28 +1,18 @@
|
|
|
1
1
|
import { httpClient } from '../../client.js';
|
|
2
|
-
|
|
2
|
+
import { errorToolResponse, jsonToolResponse } from './toolResponse.js';
|
|
3
|
+
export const completeActivityLogHandler = async ({ activityLogUUID, }) => {
|
|
3
4
|
try {
|
|
4
5
|
await httpClient.putJson({
|
|
5
|
-
path: `/v2/integration/activity-logs/${activityLogUUID}/work-complete`,
|
|
6
|
+
path: `/v2/integration/activity-logs/${encodeURIComponent(activityLogUUID)}/work-complete`,
|
|
6
7
|
body: {},
|
|
7
8
|
});
|
|
8
|
-
return {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
text: `Activity log with UUID "${activityLogUUID}" completed successfully.`,
|
|
13
|
-
},
|
|
14
|
-
],
|
|
15
|
-
};
|
|
9
|
+
return jsonToolResponse({
|
|
10
|
+
activityLogUUID,
|
|
11
|
+
completed: true,
|
|
12
|
+
});
|
|
16
13
|
}
|
|
17
14
|
catch (error) {
|
|
18
15
|
console.error('Error completing activity log:', error);
|
|
19
|
-
return
|
|
20
|
-
content: [
|
|
21
|
-
{
|
|
22
|
-
type: 'text',
|
|
23
|
-
text: `Error completing activity log: ${error}`,
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
};
|
|
16
|
+
return errorToolResponse('Error completing activity log');
|
|
27
17
|
}
|
|
28
18
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { httpClient } from '../../client.js';
|
|
2
|
+
import { errorToolResponse, jsonToolResponse } from './toolResponse.js';
|
|
2
3
|
export const createTaskHandler = async ({ taskName, categoryUUID, scheduledStartDate, scheduledEndDate, url, detail, }) => {
|
|
3
4
|
try {
|
|
4
5
|
await httpClient.postJson({
|
|
@@ -12,24 +13,13 @@ export const createTaskHandler = async ({ taskName, categoryUUID, scheduledStart
|
|
|
12
13
|
detail: detail,
|
|
13
14
|
},
|
|
14
15
|
});
|
|
15
|
-
return {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
text: `Task "${taskName}" created successfully.`,
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
};
|
|
16
|
+
return jsonToolResponse({
|
|
17
|
+
taskName,
|
|
18
|
+
created: true,
|
|
19
|
+
});
|
|
23
20
|
}
|
|
24
21
|
catch (error) {
|
|
25
22
|
console.error('Error creating task:', error);
|
|
26
|
-
return
|
|
27
|
-
content: [
|
|
28
|
-
{
|
|
29
|
-
type: 'text',
|
|
30
|
-
text: `Error creating task: ${error}`,
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
};
|
|
23
|
+
return errorToolResponse('Error creating task');
|
|
34
24
|
}
|
|
35
25
|
};
|
|
@@ -1,35 +1,20 @@
|
|
|
1
1
|
import { httpClient } from '../../client.js';
|
|
2
|
+
import { errorToolResponse, jsonToolResponse } from './toolResponse.js';
|
|
2
3
|
export const getActivityItemListHandler = async () => {
|
|
3
4
|
try {
|
|
4
5
|
const activityItemList = await httpClient.fetchURL({
|
|
5
6
|
path: '/v2/integration/activity-items',
|
|
6
7
|
});
|
|
7
8
|
const enabledActivityItemList = activityItemList.filter((item) => item.enabled === 'true');
|
|
8
|
-
return {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
type: 'text',
|
|
17
|
-
text: enabledActivityItemList
|
|
18
|
-
.map((item) => [item.activityItemUUID, item.itemName])
|
|
19
|
-
.join(','),
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
};
|
|
9
|
+
return jsonToolResponse({
|
|
10
|
+
activityItems: enabledActivityItemList.map((item) => ({
|
|
11
|
+
activityItemUUID: item.activityItemUUID,
|
|
12
|
+
itemName: item.itemName,
|
|
13
|
+
})),
|
|
14
|
+
});
|
|
23
15
|
}
|
|
24
16
|
catch (error) {
|
|
25
17
|
console.error('Error in tool handler:', error);
|
|
26
|
-
return
|
|
27
|
-
content: [
|
|
28
|
-
{
|
|
29
|
-
type: 'text',
|
|
30
|
-
text: `Error in tool handler: ${error}`,
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
};
|
|
18
|
+
return errorToolResponse('Error retrieving activity items');
|
|
34
19
|
}
|
|
35
20
|
};
|
|
@@ -1,38 +1,21 @@
|
|
|
1
1
|
import { httpClient } from '../../client.js';
|
|
2
|
+
import { errorToolResponse, jsonToolResponse } from './toolResponse.js';
|
|
2
3
|
export const getActivityLogListHandler = async () => {
|
|
3
4
|
try {
|
|
4
5
|
const activityLogList = await httpClient.fetchURL({
|
|
5
6
|
path: '/v2/integration/activity-logs',
|
|
6
7
|
});
|
|
7
|
-
return {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
text: activityLogList
|
|
16
|
-
.map((log) => [
|
|
17
|
-
log.activityLogUUID,
|
|
18
|
-
log.startDateTime,
|
|
19
|
-
log.endDateTime,
|
|
20
|
-
log.itemName,
|
|
21
|
-
])
|
|
22
|
-
.join('\n'),
|
|
23
|
-
},
|
|
24
|
-
],
|
|
25
|
-
};
|
|
8
|
+
return jsonToolResponse({
|
|
9
|
+
activityLogs: activityLogList.map((log) => ({
|
|
10
|
+
activityLogUUID: log.activityLogUUID,
|
|
11
|
+
startDateTime: log.startDateTime,
|
|
12
|
+
endDateTime: log.endDateTime,
|
|
13
|
+
itemName: log.itemName,
|
|
14
|
+
})),
|
|
15
|
+
});
|
|
26
16
|
}
|
|
27
17
|
catch (error) {
|
|
28
18
|
console.error('Error in activity log list handler:', error);
|
|
29
|
-
return
|
|
30
|
-
content: [
|
|
31
|
-
{
|
|
32
|
-
type: 'text',
|
|
33
|
-
text: `アクティビティログの取得中にエラーが発生しました: ${error}`,
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
};
|
|
19
|
+
return errorToolResponse('Error retrieving activity logs');
|
|
37
20
|
}
|
|
38
21
|
};
|
|
@@ -1,28 +1,17 @@
|
|
|
1
1
|
import { httpClient } from '../../client.js';
|
|
2
|
-
|
|
2
|
+
import { errorToolResponse, jsonToolResponse } from './toolResponse.js';
|
|
3
|
+
export const getCalendarDateMemoHandler = async ({ date, }) => {
|
|
3
4
|
try {
|
|
4
5
|
const calendarDateMemo = await httpClient.fetchURL({
|
|
5
6
|
path: `/v2/integration/calendar-date-memo/${encodeURIComponent(date)}`,
|
|
6
7
|
});
|
|
7
|
-
return {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
text: `targetDate: ${calendarDateMemo.targetDate}\nmemo: ${calendarDateMemo.memo ?? ''}`,
|
|
12
|
-
},
|
|
13
|
-
],
|
|
14
|
-
};
|
|
8
|
+
return jsonToolResponse({
|
|
9
|
+
targetDate: calendarDateMemo.targetDate,
|
|
10
|
+
memo: calendarDateMemo.memo ?? '',
|
|
11
|
+
});
|
|
15
12
|
}
|
|
16
13
|
catch (error) {
|
|
17
14
|
console.error('Error getting calendar date memo:', error);
|
|
18
|
-
return
|
|
19
|
-
isError: true,
|
|
20
|
-
content: [
|
|
21
|
-
{
|
|
22
|
-
type: 'text',
|
|
23
|
-
text: `Error getting calendar date memo: ${error}`,
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
};
|
|
15
|
+
return errorToolResponse('Error getting calendar date memo');
|
|
27
16
|
}
|
|
28
17
|
};
|
|
@@ -1,25 +1,15 @@
|
|
|
1
|
+
import { errorToolResponse, jsonToolResponse } from './toolResponse.js';
|
|
1
2
|
export const getJapanCurrentTimeHandler = async () => {
|
|
2
3
|
try {
|
|
3
4
|
const now = new Date();
|
|
4
|
-
// 日本標準時(JST)でフォーマット
|
|
5
5
|
const jstTime = now.toLocaleString('ja-JP', { timeZone: 'Asia/Tokyo' });
|
|
6
|
-
return {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
text: `現在の日本時刻(JST)は: ${jstTime}`,
|
|
11
|
-
},
|
|
12
|
-
],
|
|
13
|
-
};
|
|
6
|
+
return jsonToolResponse({
|
|
7
|
+
timeZone: 'Asia/Tokyo',
|
|
8
|
+
currentTime: jstTime,
|
|
9
|
+
});
|
|
14
10
|
}
|
|
15
11
|
catch (error) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
{
|
|
19
|
-
type: 'text',
|
|
20
|
-
text: `日本時刻取得中にエラーが発生しました: ${error}`,
|
|
21
|
-
},
|
|
22
|
-
],
|
|
23
|
-
};
|
|
12
|
+
console.error('Error getting Japan current time:', error);
|
|
13
|
+
return errorToolResponse('Error getting Japan current time');
|
|
24
14
|
}
|
|
25
15
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { httpClient } from '../../client.js';
|
|
2
|
+
import { errorToolResponse, jsonToolResponse } from './toolResponse.js';
|
|
2
3
|
export const getTodayCalendarHandler = async () => {
|
|
3
4
|
try {
|
|
4
5
|
const googleEvents = await httpClient.fetchURL({
|
|
@@ -8,62 +9,29 @@ export const getTodayCalendarHandler = async () => {
|
|
|
8
9
|
path: '/v2/integration/todo',
|
|
9
10
|
});
|
|
10
11
|
const filteredTasks = tasks.filter((task) => task.scheduledStartDate != null);
|
|
11
|
-
return {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
formatEventTime(event.start),
|
|
24
|
-
formatEventTime(event.end),
|
|
25
|
-
])
|
|
26
|
-
.join(','),
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
type: 'text',
|
|
30
|
-
text: 'en: The following is a task. The following is the order:[task name, scheduled start date, scheduled end date]',
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
type: 'text',
|
|
34
|
-
text: filteredTasks
|
|
35
|
-
.map((task) => [
|
|
36
|
-
task.label,
|
|
37
|
-
task.scheduledStartDate,
|
|
38
|
-
task.scheduledEndDate,
|
|
39
|
-
])
|
|
40
|
-
.join(','),
|
|
41
|
-
},
|
|
42
|
-
],
|
|
43
|
-
};
|
|
12
|
+
return jsonToolResponse({
|
|
13
|
+
events: (googleEvents.items ?? []).map((event) => ({
|
|
14
|
+
title: event.summary,
|
|
15
|
+
startDateTime: formatEventTime(event.start),
|
|
16
|
+
endDateTime: formatEventTime(event.end),
|
|
17
|
+
})),
|
|
18
|
+
tasks: filteredTasks.map((task) => ({
|
|
19
|
+
taskName: task.label,
|
|
20
|
+
scheduledStartDate: task.scheduledStartDate,
|
|
21
|
+
scheduledEndDate: task.scheduledEndDate,
|
|
22
|
+
})),
|
|
23
|
+
});
|
|
44
24
|
}
|
|
45
25
|
catch (error) {
|
|
46
26
|
console.error('Error in tool handler:', error);
|
|
47
|
-
return
|
|
48
|
-
content: [
|
|
49
|
-
{
|
|
50
|
-
type: 'text',
|
|
51
|
-
text: `Error in tool handler: ${error}`,
|
|
52
|
-
},
|
|
53
|
-
],
|
|
54
|
-
};
|
|
27
|
+
return errorToolResponse('Error retrieving calendar events');
|
|
55
28
|
}
|
|
56
29
|
};
|
|
57
|
-
/**
|
|
58
|
-
* EventDateTime型から表示用の日時文字列を取得する
|
|
59
|
-
*/
|
|
60
30
|
const formatEventTime = (dateTime) => {
|
|
61
|
-
// 全日イベントの場合はdate、そうでない場合はdateTimeを使用
|
|
62
31
|
if (dateTime.date) {
|
|
63
|
-
return dateTime.date;
|
|
32
|
+
return dateTime.date;
|
|
64
33
|
}
|
|
65
34
|
if (dateTime.dateTime) {
|
|
66
|
-
// RFC3339形式の日時をより読みやすい形式に変換
|
|
67
35
|
const dt = new Date(dateTime.dateTime);
|
|
68
36
|
return dt.toLocaleString('ja-JP', {
|
|
69
37
|
year: 'numeric',
|
|
@@ -1,34 +1,19 @@
|
|
|
1
1
|
import { httpClient } from '../../client.js';
|
|
2
|
+
import { errorToolResponse, jsonToolResponse } from './toolResponse.js';
|
|
2
3
|
export const getTodoCategoryListHandler = async () => {
|
|
3
4
|
try {
|
|
4
5
|
const categoryList = await httpClient.fetchURL({
|
|
5
6
|
path: '/v2/integration/categories',
|
|
6
7
|
});
|
|
7
|
-
return {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
type: 'text',
|
|
16
|
-
text: categoryList
|
|
17
|
-
.map((category) => [category.categoryUUID, category.label])
|
|
18
|
-
.join(','),
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
};
|
|
8
|
+
return jsonToolResponse({
|
|
9
|
+
categories: categoryList.map((category) => ({
|
|
10
|
+
categoryUUID: category.categoryUUID,
|
|
11
|
+
label: category.label,
|
|
12
|
+
})),
|
|
13
|
+
});
|
|
22
14
|
}
|
|
23
15
|
catch (error) {
|
|
24
16
|
console.error('Error in tool handler:', error);
|
|
25
|
-
return
|
|
26
|
-
content: [
|
|
27
|
-
{
|
|
28
|
-
type: 'text',
|
|
29
|
-
text: `Error in tool handler: ${error}`,
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
};
|
|
17
|
+
return errorToolResponse('Error retrieving todo categories');
|
|
33
18
|
}
|
|
34
19
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { httpClient } from '../../client.js';
|
|
2
|
-
|
|
2
|
+
import { errorToolResponse, jsonToolResponse } from './toolResponse.js';
|
|
3
|
+
export const getTodoListHandler = async ({ categoryUUIDs, }) => {
|
|
3
4
|
try {
|
|
4
5
|
const categoryUUIDArray = categoryUUIDs ?? [];
|
|
5
6
|
const qs = categoryUUIDArray.length > 0
|
|
@@ -8,44 +9,23 @@ export const getTodoListHandler = async ({ categoryUUIDs }) => {
|
|
|
8
9
|
const tasks = await httpClient.fetchURL({
|
|
9
10
|
path: `/v2/integration/todo${qs}`,
|
|
10
11
|
});
|
|
11
|
-
return {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
.map((todo) => [
|
|
26
|
-
todo.todoUUID,
|
|
27
|
-
todo.label,
|
|
28
|
-
todo.detail,
|
|
29
|
-
todo.scheduledStartDate,
|
|
30
|
-
todo.scheduledEndDate,
|
|
31
|
-
todo.priorityNumber,
|
|
32
|
-
todo.categoryLabel,
|
|
33
|
-
todo.url,
|
|
34
|
-
])
|
|
35
|
-
.join(','),
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
};
|
|
12
|
+
return jsonToolResponse({
|
|
13
|
+
tasks: tasks.map((todo) => ({
|
|
14
|
+
todoUUID: todo.todoUUID,
|
|
15
|
+
label: todo.label,
|
|
16
|
+
detail: todo.detail,
|
|
17
|
+
scheduledStartDate: todo.scheduledStartDate,
|
|
18
|
+
scheduledEndDate: todo.scheduledEndDate,
|
|
19
|
+
priorityNumber: todo.priorityNumber,
|
|
20
|
+
categoryUUID: todo.categoryUUID,
|
|
21
|
+
categoryLabel: todo.categoryLabel,
|
|
22
|
+
url: todo.url,
|
|
23
|
+
})),
|
|
24
|
+
guidance: 'The tasks with scheduled start dates that are today or in the past, and those with a priority of 2, should be addressed as soon as possible.',
|
|
25
|
+
});
|
|
39
26
|
}
|
|
40
27
|
catch (error) {
|
|
41
28
|
console.error('Error in tool handler:', error);
|
|
42
|
-
return
|
|
43
|
-
content: [
|
|
44
|
-
{
|
|
45
|
-
type: 'text',
|
|
46
|
-
text: `Error in tool handler: ${error}`,
|
|
47
|
-
},
|
|
48
|
-
],
|
|
49
|
-
};
|
|
29
|
+
return errorToolResponse('Error retrieving tasks');
|
|
50
30
|
}
|
|
51
31
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { httpClient } from '../../client.js';
|
|
2
|
-
|
|
2
|
+
import { errorToolResponse, jsonToolResponse } from './toolResponse.js';
|
|
3
|
+
export const startActivityLogHandler = async ({ activityItemName, }) => {
|
|
3
4
|
try {
|
|
4
5
|
await httpClient.postJson({
|
|
5
6
|
path: '/v2/integration/activity-logs',
|
|
@@ -7,24 +8,13 @@ export const startActivityLogHandler = async ({ activityItemName }) => {
|
|
|
7
8
|
activityItemName: activityItemName,
|
|
8
9
|
},
|
|
9
10
|
});
|
|
10
|
-
return {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
text: `Activity log for "${activityItemName}" started successfully.`,
|
|
15
|
-
},
|
|
16
|
-
],
|
|
17
|
-
};
|
|
11
|
+
return jsonToolResponse({
|
|
12
|
+
activityItemName,
|
|
13
|
+
started: true,
|
|
14
|
+
});
|
|
18
15
|
}
|
|
19
16
|
catch (error) {
|
|
20
17
|
console.error('Error starting activity log:', error);
|
|
21
|
-
return
|
|
22
|
-
content: [
|
|
23
|
-
{
|
|
24
|
-
type: 'text',
|
|
25
|
-
text: `Error starting activity log: ${error}`,
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
};
|
|
18
|
+
return errorToolResponse('Error starting activity log');
|
|
29
19
|
}
|
|
30
20
|
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export function jsonToolResponse(structuredContent) {
|
|
2
|
+
return {
|
|
3
|
+
structuredContent,
|
|
4
|
+
content: [
|
|
5
|
+
{
|
|
6
|
+
type: 'text',
|
|
7
|
+
text: JSON.stringify(structuredContent, null, 2),
|
|
8
|
+
},
|
|
9
|
+
],
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export function errorToolResponse(message) {
|
|
13
|
+
const structuredContent = {
|
|
14
|
+
error: {
|
|
15
|
+
message,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
return {
|
|
19
|
+
structuredContent,
|
|
20
|
+
isError: true,
|
|
21
|
+
content: [
|
|
22
|
+
{
|
|
23
|
+
type: 'text',
|
|
24
|
+
text: JSON.stringify(structuredContent, null, 2),
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { httpClient } from '../../client.js';
|
|
2
|
-
|
|
2
|
+
import { errorToolResponse, jsonToolResponse } from './toolResponse.js';
|
|
3
|
+
export const updateCalendarDateMemoHandler = async ({ date, memo, }) => {
|
|
3
4
|
try {
|
|
4
5
|
const normalizedMemo = memo.trim();
|
|
5
6
|
await httpClient.putJson({
|
|
@@ -8,25 +9,14 @@ export const updateCalendarDateMemoHandler = async ({ date, memo }) => {
|
|
|
8
9
|
memo: normalizedMemo,
|
|
9
10
|
},
|
|
10
11
|
});
|
|
11
|
-
return {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
|
-
};
|
|
12
|
+
return jsonToolResponse({
|
|
13
|
+
targetDate: date,
|
|
14
|
+
memo: normalizedMemo,
|
|
15
|
+
updated: true,
|
|
16
|
+
});
|
|
19
17
|
}
|
|
20
18
|
catch (error) {
|
|
21
19
|
console.error('Error updating calendar date memo:', error);
|
|
22
|
-
return
|
|
23
|
-
isError: true,
|
|
24
|
-
content: [
|
|
25
|
-
{
|
|
26
|
-
type: 'text',
|
|
27
|
-
text: `Error updating calendar date memo: ${error}`,
|
|
28
|
-
},
|
|
29
|
-
],
|
|
30
|
-
};
|
|
20
|
+
return errorToolResponse('Error updating calendar date memo');
|
|
31
21
|
}
|
|
32
22
|
};
|