owner-clone-ai-mcp 1.2.0 → 1.4.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/index.js +413 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -187,6 +187,240 @@ const TOOLS = [
|
|
|
187
187
|
required: ['id'],
|
|
188
188
|
},
|
|
189
189
|
},
|
|
190
|
+
// スケジュール管理
|
|
191
|
+
{
|
|
192
|
+
name: 'list_schedules',
|
|
193
|
+
description: '指定期間のスケジュール一覧を取得します。from/to を省略すると今日から30日間。',
|
|
194
|
+
annotations: { readOnlyHint: true },
|
|
195
|
+
inputSchema: {
|
|
196
|
+
type: 'object',
|
|
197
|
+
properties: {
|
|
198
|
+
from: { type: 'string', description: '開始日 YYYY-MM-DD(省略時: 今日)' },
|
|
199
|
+
to: { type: 'string', description: '終了日 YYYY-MM-DD(省略時: 今日+30日)' },
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
name: 'create_schedule',
|
|
205
|
+
description: 'スケジュールを新規作成します。【書き込み権限付きキーが必要】',
|
|
206
|
+
annotations: { destructiveHint: false, idempotentHint: false },
|
|
207
|
+
inputSchema: {
|
|
208
|
+
type: 'object',
|
|
209
|
+
properties: {
|
|
210
|
+
title: { type: 'string', description: 'スケジュールのタイトル' },
|
|
211
|
+
start_at: { type: 'string', description: '開始日時 ISO8601(例: 2026-06-01T10:00:00+09:00)' },
|
|
212
|
+
end_at: { type: 'string', description: '終了日時 ISO8601(省略可)' },
|
|
213
|
+
all_day: { type: 'boolean', description: '終日イベントか(デフォルト: false)' },
|
|
214
|
+
description: { type: 'string', description: '詳細・メモ(省略可)' },
|
|
215
|
+
color: { type: 'string', description: 'カラーコード(例: #3b82f6、省略可)' },
|
|
216
|
+
recurrence_type: { type: 'string', description: '繰り返し: none/daily/weekly/monthly/weekdays(デフォルト: none)' },
|
|
217
|
+
recurrence_end_date: { type: 'string', description: '繰り返し終了日 YYYY-MM-DD(省略可)' },
|
|
218
|
+
},
|
|
219
|
+
required: ['title'],
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
name: 'update_schedule',
|
|
224
|
+
description: '既存のスケジュールを更新します。【書き込み権限付きキーが必要】',
|
|
225
|
+
annotations: { destructiveHint: false, idempotentHint: true },
|
|
226
|
+
inputSchema: {
|
|
227
|
+
type: 'object',
|
|
228
|
+
properties: {
|
|
229
|
+
id: { type: 'string', description: 'スケジュールID' },
|
|
230
|
+
title: { type: 'string', description: '新しいタイトル(省略時は変更なし)' },
|
|
231
|
+
start_at: { type: 'string', description: '新しい開始日時(省略時は変更なし)' },
|
|
232
|
+
end_at: { type: 'string', description: '新しい終了日時(省略時は変更なし)' },
|
|
233
|
+
all_day: { type: 'boolean', description: '終日フラグ(省略時は変更なし)' },
|
|
234
|
+
description: { type: 'string', description: '新しい詳細(省略時は変更なし)' },
|
|
235
|
+
color: { type: 'string', description: '新しいカラー(省略時は変更なし)' },
|
|
236
|
+
recurrence_type: { type: 'string', description: '新しい繰り返し設定(省略時は変更なし)' },
|
|
237
|
+
recurrence_end_date: { type: 'string', description: '新しい繰り返し終了日(省略時は変更なし)' },
|
|
238
|
+
},
|
|
239
|
+
required: ['id'],
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
name: 'delete_schedule',
|
|
244
|
+
description: 'スケジュールを削除します。【書き込み権限付きキーが必要】繰り返しの場合は全インスタンスが削除されます。',
|
|
245
|
+
annotations: { destructiveHint: true, idempotentHint: false },
|
|
246
|
+
inputSchema: {
|
|
247
|
+
type: 'object',
|
|
248
|
+
properties: {
|
|
249
|
+
id: { type: 'string', description: '削除するスケジュールID' },
|
|
250
|
+
},
|
|
251
|
+
required: ['id'],
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
// タスク管理
|
|
255
|
+
{
|
|
256
|
+
name: 'list_tasks',
|
|
257
|
+
description: 'タスク一覧を取得します。ステータスやタイプで絞り込み可能。',
|
|
258
|
+
annotations: { readOnlyHint: true },
|
|
259
|
+
inputSchema: {
|
|
260
|
+
type: 'object',
|
|
261
|
+
properties: {
|
|
262
|
+
status: { type: 'string', description: 'ステータス絞り込み: pending/done/dismissed/approved/rejected(省略時: 全件)' },
|
|
263
|
+
type: { type: 'string', description: 'タイプ絞り込み: manual/workflow_approval/workflow_review(省略時: 全件)' },
|
|
264
|
+
limit: { type: 'number', description: '取得件数(デフォルト: 50、最大: 200)' },
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
name: 'get_task',
|
|
270
|
+
description: '指定したタスクの詳細を取得します。',
|
|
271
|
+
annotations: { readOnlyHint: true },
|
|
272
|
+
inputSchema: {
|
|
273
|
+
type: 'object',
|
|
274
|
+
properties: {
|
|
275
|
+
id: { type: 'string', description: 'タスクID' },
|
|
276
|
+
},
|
|
277
|
+
required: ['id'],
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
name: 'create_task',
|
|
282
|
+
description: 'タスクを新規作成します(type=manual)。【書き込み権限付きキーが必要】',
|
|
283
|
+
annotations: { destructiveHint: false, idempotentHint: false },
|
|
284
|
+
inputSchema: {
|
|
285
|
+
type: 'object',
|
|
286
|
+
properties: {
|
|
287
|
+
title: { type: 'string', description: 'タスクタイトル' },
|
|
288
|
+
body: { type: 'string', description: '詳細・内容(省略可)' },
|
|
289
|
+
priority: { type: 'string', description: '優先度: low/normal/high(デフォルト: normal)' },
|
|
290
|
+
due_date: { type: 'string', description: '期限日時 ISO8601(省略可)' },
|
|
291
|
+
},
|
|
292
|
+
required: ['title'],
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
name: 'update_task',
|
|
297
|
+
description: 'タスクを更新します。【書き込み権限付きキーが必要】manual タスクは全フィールド更新可。他タイプはステータス変更のみ可。',
|
|
298
|
+
annotations: { destructiveHint: false, idempotentHint: true },
|
|
299
|
+
inputSchema: {
|
|
300
|
+
type: 'object',
|
|
301
|
+
properties: {
|
|
302
|
+
id: { type: 'string', description: 'タスクID' },
|
|
303
|
+
title: { type: 'string', description: '新しいタイトル(manual のみ、省略時は変更なし)' },
|
|
304
|
+
body: { type: 'string', description: '新しい詳細(manual のみ、省略時は変更なし)' },
|
|
305
|
+
priority: { type: 'string', description: '新しい優先度: low/normal/high(manual のみ)' },
|
|
306
|
+
due_date: { type: 'string', description: '新しい期限(manual のみ、null で期限解除)' },
|
|
307
|
+
status: { type: 'string', description: 'ステータス変更: pending/done/dismissed' },
|
|
308
|
+
},
|
|
309
|
+
required: ['id'],
|
|
310
|
+
},
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
name: 'delete_task',
|
|
314
|
+
description: 'タスクを削除します(manual タイプのみ)。【書き込み権限付きキーが必要】',
|
|
315
|
+
annotations: { destructiveHint: true, idempotentHint: false },
|
|
316
|
+
inputSchema: {
|
|
317
|
+
type: 'object',
|
|
318
|
+
properties: {
|
|
319
|
+
id: { type: 'string', description: '削除するタスクID(manual タイプのみ)' },
|
|
320
|
+
},
|
|
321
|
+
required: ['id'],
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
// ワークフロー書き込み(読み書き可能キーが必要)
|
|
325
|
+
{
|
|
326
|
+
name: 'create_workflow',
|
|
327
|
+
description: 'ワークフローを新規作成します。【書き込み権限付きキーが必要】steps にエージェントタスク・アクションステップを配列で指定します。',
|
|
328
|
+
annotations: { destructiveHint: false, idempotentHint: false },
|
|
329
|
+
inputSchema: {
|
|
330
|
+
type: 'object',
|
|
331
|
+
properties: {
|
|
332
|
+
title: { type: 'string', description: 'ワークフロー名' },
|
|
333
|
+
description: { type: 'string', description: '説明(省略可)' },
|
|
334
|
+
steps: {
|
|
335
|
+
type: 'array',
|
|
336
|
+
description: 'ステップ配列。各ステップは {type:"agent_task"|"action", label, ...} の形式',
|
|
337
|
+
items: { type: 'object' },
|
|
338
|
+
},
|
|
339
|
+
},
|
|
340
|
+
required: ['title'],
|
|
341
|
+
},
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
name: 'update_workflow',
|
|
345
|
+
description: '既存のワークフローを更新します。【書き込み権限付きキーが必要】',
|
|
346
|
+
annotations: { destructiveHint: false, idempotentHint: true },
|
|
347
|
+
inputSchema: {
|
|
348
|
+
type: 'object',
|
|
349
|
+
properties: {
|
|
350
|
+
id: { type: 'string', description: 'ワークフローID' },
|
|
351
|
+
title: { type: 'string', description: '新しいタイトル(省略時は変更なし)' },
|
|
352
|
+
description: { type: 'string', description: '新しい説明(省略時は変更なし)' },
|
|
353
|
+
steps: { type: 'array', description: '新しいステップ配列(省略時は変更なし)', items: { type: 'object' } },
|
|
354
|
+
is_active: { type: 'boolean', description: '有効/無効(省略時は変更なし)' },
|
|
355
|
+
},
|
|
356
|
+
required: ['id'],
|
|
357
|
+
},
|
|
358
|
+
},
|
|
359
|
+
// チャットボット書き込み(読み書き可能キーが必要)
|
|
360
|
+
{
|
|
361
|
+
name: 'create_chatbot',
|
|
362
|
+
description: 'チャットボットを新規作成します。【書き込み権限付きキーが必要】widget_token は自動生成されます。',
|
|
363
|
+
annotations: { destructiveHint: false, idempotentHint: false },
|
|
364
|
+
inputSchema: {
|
|
365
|
+
type: 'object',
|
|
366
|
+
properties: {
|
|
367
|
+
name: { type: 'string', description: 'チャットボット名' },
|
|
368
|
+
system_prompt: { type: 'string', description: 'システムプロンプト(AIの役割・人格定義)' },
|
|
369
|
+
initial_message: { type: 'string', description: '最初のメッセージ(省略可)' },
|
|
370
|
+
rules_allow: { type: 'string', description: '許可ルール(省略可)' },
|
|
371
|
+
rules_deny: { type: 'string', description: '禁止ルール(省略可)' },
|
|
372
|
+
sales_flow: { type: 'string', description: '対話フロー・セールスフロー(省略可)' },
|
|
373
|
+
quick_replies: { type: 'string', description: 'クイック返信ボタン(改行区切り、省略可)' },
|
|
374
|
+
},
|
|
375
|
+
required: ['name'],
|
|
376
|
+
},
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
name: 'update_chatbot',
|
|
380
|
+
description: '既存のチャットボットを更新します。【書き込み権限付きキーが必要】',
|
|
381
|
+
annotations: { destructiveHint: false, idempotentHint: true },
|
|
382
|
+
inputSchema: {
|
|
383
|
+
type: 'object',
|
|
384
|
+
properties: {
|
|
385
|
+
id: { type: 'string', description: 'チャットボットID' },
|
|
386
|
+
name: { type: 'string', description: '新しい名前(省略時は変更なし)' },
|
|
387
|
+
system_prompt: { type: 'string', description: '新しいシステムプロンプト(省略時は変更なし)' },
|
|
388
|
+
initial_message: { type: 'string', description: '新しい最初のメッセージ(省略時は変更なし)' },
|
|
389
|
+
rules_allow: { type: 'string', description: '新しい許可ルール(省略時は変更なし)' },
|
|
390
|
+
rules_deny: { type: 'string', description: '新しい禁止ルール(省略時は変更なし)' },
|
|
391
|
+
sales_flow: { type: 'string', description: '新しい対話フロー(省略時は変更なし)' },
|
|
392
|
+
quick_replies: { type: 'string', description: '新しいクイック返信(改行区切り、省略時は変更なし)' },
|
|
393
|
+
},
|
|
394
|
+
required: ['id'],
|
|
395
|
+
},
|
|
396
|
+
},
|
|
397
|
+
// Claude Code月額でワークフロー実行(読み書き可能キーが必要)
|
|
398
|
+
{
|
|
399
|
+
name: 'get_workflow_plan',
|
|
400
|
+
description: 'ワークフローのステップ定義を全取得します。agent_task ステップは Claude Code が load_agent + ナレッジを使って自力で推論し、action ステップは execute_workflow_action でバックエンドが実行します。',
|
|
401
|
+
annotations: { readOnlyHint: true },
|
|
402
|
+
inputSchema: {
|
|
403
|
+
type: 'object',
|
|
404
|
+
properties: {
|
|
405
|
+
id: { type: 'string', description: 'ワークフローID' },
|
|
406
|
+
},
|
|
407
|
+
required: ['id'],
|
|
408
|
+
},
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
name: 'execute_workflow_action',
|
|
412
|
+
description: 'ワークフローのアクションステップ(send_chatwork / approval)をバックエンドで実行します。【書き込み権限付きキーが必要】Claude Code が AI 推論した結果(previous_output)を渡してください。',
|
|
413
|
+
annotations: { destructiveHint: false, idempotentHint: false },
|
|
414
|
+
inputSchema: {
|
|
415
|
+
type: 'object',
|
|
416
|
+
properties: {
|
|
417
|
+
id: { type: 'string', description: 'ワークフローID' },
|
|
418
|
+
step_index: { type: 'number', description: '実行するステップのインデックス(0始まり)' },
|
|
419
|
+
previous_output: { type: 'string', description: '直前の AI 推論結果(アクションメッセージとして使用)' },
|
|
420
|
+
},
|
|
421
|
+
required: ['id', 'step_index'],
|
|
422
|
+
},
|
|
423
|
+
},
|
|
190
424
|
// 書き込みツール(読み書き可能キーが必要)
|
|
191
425
|
{
|
|
192
426
|
name: 'create_knowledge',
|
|
@@ -412,6 +646,184 @@ async function executeTool(name, args) {
|
|
|
412
646
|
return `✅ ${data.message}\n削除したナレッジ: ${data.deleted.title} (ID: ${data.deleted.id})`;
|
|
413
647
|
}
|
|
414
648
|
|
|
649
|
+
case 'list_schedules': {
|
|
650
|
+
const params = new URLSearchParams();
|
|
651
|
+
if (args.from) params.set('from', args.from);
|
|
652
|
+
if (args.to) params.set('to', args.to);
|
|
653
|
+
const data = await callApi(`/schedules?${params}`);
|
|
654
|
+
if (!data.schedules || data.schedules.length === 0) return `期間内にスケジュールがありません(${data.from} 〜 ${data.to})`;
|
|
655
|
+
const lines = data.schedules.map(s =>
|
|
656
|
+
`- [${s.id}] ${s.title}` +
|
|
657
|
+
(s.start_at ? ` ${new Date(s.start_at).toLocaleString('ja-JP', { timeZone: 'Asia/Tokyo' })}` : '') +
|
|
658
|
+
(s.end_at ? ` 〜 ${new Date(s.end_at).toLocaleString('ja-JP', { timeZone: 'Asia/Tokyo' })}` : '') +
|
|
659
|
+
(s.all_day ? ' (終日)' : '') +
|
|
660
|
+
(s.recurrence_type && s.recurrence_type !== 'none' ? ` [繰り返し: ${s.recurrence_type}]` : '') +
|
|
661
|
+
(s.description ? `\n ${s.description}` : '')
|
|
662
|
+
);
|
|
663
|
+
return `スケジュール一覧(${data.from} 〜 ${data.to}、${data.count}件):\n\n${lines.join('\n')}`;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
case 'create_schedule': {
|
|
667
|
+
const data = await callApi('/schedules', {
|
|
668
|
+
method: 'POST',
|
|
669
|
+
body: JSON.stringify({
|
|
670
|
+
title: args.title, description: args.description,
|
|
671
|
+
start_at: args.start_at, end_at: args.end_at,
|
|
672
|
+
all_day: args.all_day, color: args.color,
|
|
673
|
+
recurrence_type: args.recurrence_type,
|
|
674
|
+
recurrence_end_date: args.recurrence_end_date,
|
|
675
|
+
}),
|
|
676
|
+
});
|
|
677
|
+
return `✅ ${data.message}\nID: ${data.id}\nタイトル: ${data.title}` +
|
|
678
|
+
(data.start_at ? `\n開始: ${data.start_at}` : '');
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
case 'update_schedule': {
|
|
682
|
+
const body = {};
|
|
683
|
+
const sFields = ['title','description','start_at','end_at','all_day','color','recurrence_type','recurrence_end_date'];
|
|
684
|
+
sFields.forEach(f => { if (args[f] !== undefined) body[f] = args[f]; });
|
|
685
|
+
const data = await callApi(`/schedules/${args.id}`, {
|
|
686
|
+
method: 'PATCH',
|
|
687
|
+
body: JSON.stringify(body),
|
|
688
|
+
});
|
|
689
|
+
return `✅ ${data.message}\nID: ${data.id}`;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
case 'delete_schedule': {
|
|
693
|
+
const data = await callApi(`/schedules/${args.id}`, { method: 'DELETE' });
|
|
694
|
+
return `✅ ${data.message}\nID: ${data.id}`;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
case 'list_tasks': {
|
|
698
|
+
const params = new URLSearchParams();
|
|
699
|
+
if (args.status) params.set('status', args.status);
|
|
700
|
+
if (args.type) params.set('type', args.type);
|
|
701
|
+
if (args.limit) params.set('limit', String(args.limit));
|
|
702
|
+
const data = await callApi(`/tasks?${params}`);
|
|
703
|
+
if (!data.tasks || data.tasks.length === 0) return 'タスクがありません。';
|
|
704
|
+
const statusIcon = { pending: '⏳', done: '✅', dismissed: '🚫', approved: '✔', rejected: '✗' };
|
|
705
|
+
const lines = data.tasks.map(t =>
|
|
706
|
+
`${statusIcon[t.status] || '•'} [${t.id}] ${t.title}` +
|
|
707
|
+
` [${t.status}/${t.priority}]` +
|
|
708
|
+
(t.due_date ? ` 期限:${t.due_date.slice(0, 10)}` : '') +
|
|
709
|
+
(t.type !== 'manual' ? ` (${t.type})` : '') +
|
|
710
|
+
(t.body ? `\n ${t.body.slice(0, 60)}${t.body.length > 60 ? '…' : ''}` : '')
|
|
711
|
+
);
|
|
712
|
+
return `タスク一覧(${data.count}件):\n\n${lines.join('\n')}`;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
case 'get_task': {
|
|
716
|
+
const data = await callApi(`/tasks/${args.id}`);
|
|
717
|
+
const parts = [
|
|
718
|
+
`タイトル: ${data.title}`,
|
|
719
|
+
`ステータス: ${data.status}`,
|
|
720
|
+
`優先度: ${data.priority}`,
|
|
721
|
+
`タイプ: ${data.type}`,
|
|
722
|
+
data.due_date ? `期限: ${data.due_date.slice(0, 16)}` : '',
|
|
723
|
+
data.body ? `\n詳細:\n${data.body}` : '',
|
|
724
|
+
data.content ? `\n内容:\n${data.content}` : '',
|
|
725
|
+
`\nID: ${data.id}`,
|
|
726
|
+
`作成: ${data.created_at?.slice(0, 16)}`,
|
|
727
|
+
].filter(Boolean);
|
|
728
|
+
return parts.join('\n');
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
case 'create_task': {
|
|
732
|
+
const data = await callApi('/tasks', {
|
|
733
|
+
method: 'POST',
|
|
734
|
+
body: JSON.stringify({
|
|
735
|
+
title: args.title, body: args.body,
|
|
736
|
+
priority: args.priority, due_date: args.due_date,
|
|
737
|
+
}),
|
|
738
|
+
});
|
|
739
|
+
return `✅ ${data.message}\nID: ${data.id}\nタイトル: ${data.title}` +
|
|
740
|
+
`\n優先度: ${data.priority}` +
|
|
741
|
+
(data.due_date ? `\n期限: ${data.due_date.slice(0, 10)}` : '');
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
case 'update_task': {
|
|
745
|
+
const body = {};
|
|
746
|
+
const tFields = ['title','body','priority','due_date','status'];
|
|
747
|
+
tFields.forEach(f => { if (args[f] !== undefined) body[f] = args[f]; });
|
|
748
|
+
const data = await callApi(`/tasks/${args.id}`, {
|
|
749
|
+
method: 'PATCH',
|
|
750
|
+
body: JSON.stringify(body),
|
|
751
|
+
});
|
|
752
|
+
return `✅ ${data.message}\nID: ${data.id}`;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
case 'delete_task': {
|
|
756
|
+
const data = await callApi(`/tasks/${args.id}`, { method: 'DELETE' });
|
|
757
|
+
return `✅ ${data.message}\nID: ${data.id}`;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
case 'create_workflow': {
|
|
761
|
+
const data = await callApi('/workflows', {
|
|
762
|
+
method: 'POST',
|
|
763
|
+
body: JSON.stringify({ title: args.title, description: args.description, steps: args.steps }),
|
|
764
|
+
});
|
|
765
|
+
return `✅ ${data.message}\nID: ${data.id}\nタイトル: ${data.title}`;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
case 'update_workflow': {
|
|
769
|
+
const body = {};
|
|
770
|
+
const wFields = ['title', 'description', 'steps', 'is_active'];
|
|
771
|
+
wFields.forEach(f => { if (args[f] !== undefined) body[f] = args[f]; });
|
|
772
|
+
const data = await callApi(`/workflows/${args.id}`, {
|
|
773
|
+
method: 'PATCH',
|
|
774
|
+
body: JSON.stringify(body),
|
|
775
|
+
});
|
|
776
|
+
return `✅ ${data.message}\nID: ${data.id}`;
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
case 'create_chatbot': {
|
|
780
|
+
const data = await callApi('/chatbots', {
|
|
781
|
+
method: 'POST',
|
|
782
|
+
body: JSON.stringify({
|
|
783
|
+
name: args.name, system_prompt: args.system_prompt,
|
|
784
|
+
initial_message: args.initial_message, rules_allow: args.rules_allow,
|
|
785
|
+
rules_deny: args.rules_deny, sales_flow: args.sales_flow,
|
|
786
|
+
quick_replies: args.quick_replies,
|
|
787
|
+
}),
|
|
788
|
+
});
|
|
789
|
+
return `✅ ${data.message}\nID: ${data.id}\n名前: ${data.name}\nwidget_token: ${data.widget_token}`;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
case 'update_chatbot': {
|
|
793
|
+
const body = {};
|
|
794
|
+
const cbFields = ['name','system_prompt','initial_message','rules_allow','rules_deny','sales_flow','quick_replies'];
|
|
795
|
+
cbFields.forEach(f => { if (args[f] !== undefined) body[f] = args[f]; });
|
|
796
|
+
const data = await callApi(`/chatbots/${args.id}`, {
|
|
797
|
+
method: 'PATCH',
|
|
798
|
+
body: JSON.stringify(body),
|
|
799
|
+
});
|
|
800
|
+
return `✅ ${data.message}\nID: ${data.id}`;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
case 'get_workflow_plan': {
|
|
804
|
+
const data = await callApi(`/workflows/${args.id}/plan`);
|
|
805
|
+
const stepLines = data.steps.map(s => {
|
|
806
|
+
if (s.type === 'agent_task') {
|
|
807
|
+
return ` [${s.index}] 🤖 AI推論: ${s.label}` +
|
|
808
|
+
(s.preset_id ? `\n → load_agent(${s.preset_id}) で呼び出し` : '') +
|
|
809
|
+
(s.prompt ? `\n → プロンプト: ${s.prompt.slice(0, 80)}...` : '');
|
|
810
|
+
}
|
|
811
|
+
return ` [${s.index}] ⚡ アクション: ${s.label} (${s.action_type})` +
|
|
812
|
+
`\n → execute_workflow_action(step_index=${s.index}) で実行`;
|
|
813
|
+
});
|
|
814
|
+
return `ワークフロー: ${data.title}\n説明: ${data.description || 'なし'}\nステップ数: ${data.total_steps}\n\n${stepLines.join('\n')}`;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
case 'execute_workflow_action': {
|
|
818
|
+
const data = await callApi(`/workflows/${args.id}/execute-action`, {
|
|
819
|
+
method: 'POST',
|
|
820
|
+
body: JSON.stringify({ step_index: args.step_index, previous_output: args.previous_output }),
|
|
821
|
+
});
|
|
822
|
+
if (data.status === 'sent') return `✅ ${data.message}`;
|
|
823
|
+
if (data.status === 'pending_approval') return `⏳ ${data.message}\nタスクID: ${data.task_id}`;
|
|
824
|
+
return `✅ ${data.message || JSON.stringify(data)}`;
|
|
825
|
+
}
|
|
826
|
+
|
|
415
827
|
default:
|
|
416
828
|
throw new Error(`Unknown tool: ${name}`);
|
|
417
829
|
}
|
|
@@ -420,7 +832,7 @@ async function executeTool(name, args) {
|
|
|
420
832
|
// ── MCPサーバー起動 ────────────────────────────────────────────
|
|
421
833
|
async function main() {
|
|
422
834
|
const server = new Server(
|
|
423
|
-
{ name: 'owner-clone-ai', version: '1.
|
|
835
|
+
{ name: 'owner-clone-ai', version: '1.4.0' },
|
|
424
836
|
{ capabilities: { tools: {} } }
|
|
425
837
|
);
|
|
426
838
|
|