owner-clone-ai-mcp 1.3.0 → 1.7.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 +561 -54
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -150,39 +150,215 @@ const TOOLS = [
|
|
|
150
150
|
// AIパートナー書き込み(読み書き可能キーが必要)
|
|
151
151
|
{
|
|
152
152
|
name: 'create_agent_preset',
|
|
153
|
-
description:
|
|
153
|
+
description: `AIパートナー(エージェントプリセット)を新規作成します。【書き込み権限付きキーが必要】
|
|
154
|
+
|
|
155
|
+
■ 各フィールドの役割と動作:
|
|
156
|
+
• base_prompt(メインシステムプロンプト)
|
|
157
|
+
チャット・ワークフロー実行時に毎回AIに注入される人格定義。
|
|
158
|
+
「あなたは○○社の顧客サポート専門AIです。〜のトーンで回答してください」形式で記述。
|
|
159
|
+
ペルソナ・専門領域・回答スタイル・禁止事項・優先事項を含める。詳細なほど一貫した応答になる。
|
|
160
|
+
|
|
161
|
+
• rules_allow(許可ルール)
|
|
162
|
+
AIが明示的に行ってよいことを列挙。改行区切り箇条書き推奨。
|
|
163
|
+
例: "製品の価格・仕様を答える\n無料トライアルを案内する\n他社比較を客観的に説明する"
|
|
164
|
+
|
|
165
|
+
• rules_deny(禁止ルール)
|
|
166
|
+
AIが絶対に行ってはいけないことを列挙。改行区切り箇条書き推奨。
|
|
167
|
+
例: "個人情報・クレジットカード番号を収集しない\n根拠のない保証・約束をしない\n競合他社を誹謗中傷しない"
|
|
168
|
+
|
|
169
|
+
• sales_flow(対話フロー)
|
|
170
|
+
顧客との会話の進め方を段階的に定義。セールス・ヒアリング・サポートの流れをスクリプト形式で記述。
|
|
171
|
+
例: "Step1: まず課題をヒアリング → Step2: 該当製品を提案 → Step3: デモ・資料を案内 → Step4: 問い合わせへ誘導"
|
|
172
|
+
対話型サポートでない場合は省略可。
|
|
173
|
+
|
|
174
|
+
• knowledge(直接埋め込みナレッジ)
|
|
175
|
+
FAQ・製品仕様・会社概要など、毎回参照させたい短い情報を直接テキストで記述(推奨3000文字以内)。
|
|
176
|
+
ナレッジベース(knowledge_item_ids)と併用可。
|
|
177
|
+
|
|
178
|
+
• knowledge_item_ids(ナレッジベース連携)
|
|
179
|
+
list_knowledge_items で取得したIDを指定。ユーザーの質問に応じて動的に検索して参照する。
|
|
180
|
+
大量の情報がある場合はこちらを推奨。
|
|
181
|
+
|
|
182
|
+
■ ナレッジ検索モード(knowledge_item_ids 使用時のみ有効):
|
|
183
|
+
• knowledge_semantic_search=true(デフォルト): 質問に意味的に近いチャンクのみ返す。大量ナレッジ向け。精度高。
|
|
184
|
+
• knowledge_semantic_search=false: 紐づく全ナレッジを全文返す。小規模ナレッジや漏れなく参照したい場合向け。
|
|
185
|
+
• knowledge_smart_full_text=true: 意味スコアで関連ナレッジを選別→選んだものを全文返す。精度と網羅性のバランス型。
|
|
186
|
+
• knowledge_query_rewrite=true: ユーザーの質問をAIが最適化してから検索。曖昧・間接的な質問に強い。`,
|
|
154
187
|
annotations: { destructiveHint: false, idempotentHint: false },
|
|
155
188
|
inputSchema: {
|
|
156
189
|
type: 'object',
|
|
157
190
|
properties: {
|
|
158
|
-
name:
|
|
159
|
-
description:
|
|
160
|
-
base_prompt:
|
|
161
|
-
rules_allow:
|
|
162
|
-
rules_deny:
|
|
163
|
-
sales_flow:
|
|
164
|
-
knowledge:
|
|
165
|
-
knowledge_item_ids:
|
|
191
|
+
name: { type: 'string', description: 'AIパートナー名(例: 「ECサイト顧客サポートAI」)' },
|
|
192
|
+
description: { type: 'string', description: '用途・目的の説明(管理用メモ、省略可)' },
|
|
193
|
+
base_prompt: { type: 'string', description: 'メインシステムプロンプト。AIの人格・役割・回答スタイルを定義。チャット時に毎回注入される。' },
|
|
194
|
+
rules_allow: { type: 'string', description: '許可ルール。改行区切りで箇条書き推奨。AIが明示的に行ってよいこと。' },
|
|
195
|
+
rules_deny: { type: 'string', description: '禁止ルール。改行区切りで箇条書き推奨。AIが絶対に行ってはいけないこと。' },
|
|
196
|
+
sales_flow: { type: 'string', description: '対話フロー定義。Step形式で顧客との会話の進め方を記述。省略可。' },
|
|
197
|
+
knowledge: { type: 'string', description: 'FAQ・仕様・会社情報などを直接テキストで埋め込む(〜3000文字推奨)。省略可。' },
|
|
198
|
+
knowledge_item_ids: { type: 'array', items: { type: 'string' }, description: '紐づけるナレッジベースのIDリスト(list_knowledge_itemsで取得)。省略可。' },
|
|
199
|
+
knowledge_semantic_search: { type: 'boolean', description: 'true=意味的に関連するチャンクのみ取得(デフォルト・推奨), false=全ナレッジ全文取得(小規模向け)' },
|
|
200
|
+
knowledge_smart_full_text: { type: 'boolean', description: 'true=意味スコアで選別→全文取得(精度と網羅性のバランス型)。デフォルト: false' },
|
|
201
|
+
knowledge_query_rewrite: { type: 'boolean', description: 'true=ユーザー質問をAIが最適化してから検索(曖昧な質問に強い)。デフォルト: false' },
|
|
166
202
|
},
|
|
167
203
|
required: ['name'],
|
|
168
204
|
},
|
|
169
205
|
},
|
|
170
206
|
{
|
|
171
207
|
name: 'update_agent_preset',
|
|
172
|
-
description:
|
|
208
|
+
description: `既存のAIパートナーを更新します。【書き込み権限付きキーが必要】
|
|
209
|
+
システムプリセット(is_system=true)は編集不可。
|
|
210
|
+
指定したフィールドのみ更新され、省略したフィールドは現在値を維持します。
|
|
211
|
+
各フィールドの意味は create_agent_preset と同じです。`,
|
|
173
212
|
annotations: { destructiveHint: false, idempotentHint: true },
|
|
174
213
|
inputSchema: {
|
|
175
214
|
type: 'object',
|
|
176
215
|
properties: {
|
|
177
|
-
id:
|
|
178
|
-
name:
|
|
179
|
-
description:
|
|
180
|
-
base_prompt:
|
|
181
|
-
rules_allow:
|
|
182
|
-
rules_deny:
|
|
183
|
-
sales_flow:
|
|
184
|
-
knowledge:
|
|
185
|
-
knowledge_item_ids:
|
|
216
|
+
id: { type: 'string', description: '更新するAIパートナーのID(list_agent_presetsで確認)' },
|
|
217
|
+
name: { type: 'string', description: '新しい名前(省略時は変更なし)' },
|
|
218
|
+
description: { type: 'string', description: '新しい説明(省略時は変更なし)' },
|
|
219
|
+
base_prompt: { type: 'string', description: '新しいシステムプロンプト(省略時は変更なし)' },
|
|
220
|
+
rules_allow: { type: 'string', description: '新しい許可ルール・改行区切り(省略時は変更なし)' },
|
|
221
|
+
rules_deny: { type: 'string', description: '新しい禁止ルール・改行区切り(省略時は変更なし)' },
|
|
222
|
+
sales_flow: { type: 'string', description: '新しい対話フロー(省略時は変更なし)' },
|
|
223
|
+
knowledge: { type: 'string', description: '新しい直接記述ナレッジ(省略時は変更なし)' },
|
|
224
|
+
knowledge_item_ids: { type: 'array', items: { type: 'string' }, description: '新しいナレッジIDリスト(省略時は変更なし)' },
|
|
225
|
+
knowledge_semantic_search: { type: 'boolean', description: 'ナレッジ検索モード変更(省略時は変更なし)' },
|
|
226
|
+
knowledge_smart_full_text: { type: 'boolean', description: 'スマート全文取得モード変更(省略時は変更なし)' },
|
|
227
|
+
knowledge_query_rewrite: { type: 'boolean', description: 'クエリ最適化モード変更(省略時は変更なし)' },
|
|
228
|
+
},
|
|
229
|
+
required: ['id'],
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
// スケジュール管理
|
|
233
|
+
{
|
|
234
|
+
name: 'list_schedules',
|
|
235
|
+
description: '指定期間のスケジュール一覧を取得します。from/to を省略すると今日から30日間。',
|
|
236
|
+
annotations: { readOnlyHint: true },
|
|
237
|
+
inputSchema: {
|
|
238
|
+
type: 'object',
|
|
239
|
+
properties: {
|
|
240
|
+
from: { type: 'string', description: '開始日 YYYY-MM-DD(省略時: 今日)' },
|
|
241
|
+
to: { type: 'string', description: '終了日 YYYY-MM-DD(省略時: 今日+30日)' },
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
name: 'create_schedule',
|
|
247
|
+
description: 'スケジュールを新規作成します。【書き込み権限付きキーが必要】',
|
|
248
|
+
annotations: { destructiveHint: false, idempotentHint: false },
|
|
249
|
+
inputSchema: {
|
|
250
|
+
type: 'object',
|
|
251
|
+
properties: {
|
|
252
|
+
title: { type: 'string', description: 'スケジュールのタイトル' },
|
|
253
|
+
start_at: { type: 'string', description: '開始日時 ISO8601(例: 2026-06-01T10:00:00+09:00)' },
|
|
254
|
+
end_at: { type: 'string', description: '終了日時 ISO8601(省略可)' },
|
|
255
|
+
all_day: { type: 'boolean', description: '終日イベントか(デフォルト: false)' },
|
|
256
|
+
description: { type: 'string', description: '詳細・メモ(省略可)' },
|
|
257
|
+
color: { type: 'string', description: 'カラーコード(例: #3b82f6、省略可)' },
|
|
258
|
+
recurrence_type: { type: 'string', description: '繰り返し: none/daily/weekly/monthly/weekdays(デフォルト: none)' },
|
|
259
|
+
recurrence_end_date: { type: 'string', description: '繰り返し終了日 YYYY-MM-DD(省略可)' },
|
|
260
|
+
},
|
|
261
|
+
required: ['title'],
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
name: 'update_schedule',
|
|
266
|
+
description: '既存のスケジュールを更新します。【書き込み権限付きキーが必要】',
|
|
267
|
+
annotations: { destructiveHint: false, idempotentHint: true },
|
|
268
|
+
inputSchema: {
|
|
269
|
+
type: 'object',
|
|
270
|
+
properties: {
|
|
271
|
+
id: { type: 'string', description: 'スケジュールID' },
|
|
272
|
+
title: { type: 'string', description: '新しいタイトル(省略時は変更なし)' },
|
|
273
|
+
start_at: { type: 'string', description: '新しい開始日時(省略時は変更なし)' },
|
|
274
|
+
end_at: { type: 'string', description: '新しい終了日時(省略時は変更なし)' },
|
|
275
|
+
all_day: { type: 'boolean', description: '終日フラグ(省略時は変更なし)' },
|
|
276
|
+
description: { type: 'string', description: '新しい詳細(省略時は変更なし)' },
|
|
277
|
+
color: { type: 'string', description: '新しいカラー(省略時は変更なし)' },
|
|
278
|
+
recurrence_type: { type: 'string', description: '新しい繰り返し設定(省略時は変更なし)' },
|
|
279
|
+
recurrence_end_date: { type: 'string', description: '新しい繰り返し終了日(省略時は変更なし)' },
|
|
280
|
+
},
|
|
281
|
+
required: ['id'],
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
name: 'delete_schedule',
|
|
286
|
+
description: 'スケジュールを削除します。【書き込み権限付きキーが必要】繰り返しの場合は全インスタンスが削除されます。',
|
|
287
|
+
annotations: { destructiveHint: true, idempotentHint: false },
|
|
288
|
+
inputSchema: {
|
|
289
|
+
type: 'object',
|
|
290
|
+
properties: {
|
|
291
|
+
id: { type: 'string', description: '削除するスケジュールID' },
|
|
292
|
+
},
|
|
293
|
+
required: ['id'],
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
// タスク管理
|
|
297
|
+
{
|
|
298
|
+
name: 'list_tasks',
|
|
299
|
+
description: 'タスク一覧を取得します。ステータスやタイプで絞り込み可能。',
|
|
300
|
+
annotations: { readOnlyHint: true },
|
|
301
|
+
inputSchema: {
|
|
302
|
+
type: 'object',
|
|
303
|
+
properties: {
|
|
304
|
+
status: { type: 'string', description: 'ステータス絞り込み: pending/done/dismissed/approved/rejected(省略時: 全件)' },
|
|
305
|
+
type: { type: 'string', description: 'タイプ絞り込み: manual/workflow_approval/workflow_review(省略時: 全件)' },
|
|
306
|
+
limit: { type: 'number', description: '取得件数(デフォルト: 50、最大: 200)' },
|
|
307
|
+
},
|
|
308
|
+
},
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
name: 'get_task',
|
|
312
|
+
description: '指定したタスクの詳細を取得します。',
|
|
313
|
+
annotations: { readOnlyHint: true },
|
|
314
|
+
inputSchema: {
|
|
315
|
+
type: 'object',
|
|
316
|
+
properties: {
|
|
317
|
+
id: { type: 'string', description: 'タスクID' },
|
|
318
|
+
},
|
|
319
|
+
required: ['id'],
|
|
320
|
+
},
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
name: 'create_task',
|
|
324
|
+
description: 'タスクを新規作成します(type=manual)。【書き込み権限付きキーが必要】',
|
|
325
|
+
annotations: { destructiveHint: false, idempotentHint: false },
|
|
326
|
+
inputSchema: {
|
|
327
|
+
type: 'object',
|
|
328
|
+
properties: {
|
|
329
|
+
title: { type: 'string', description: 'タスクタイトル' },
|
|
330
|
+
body: { type: 'string', description: '詳細・内容(省略可)' },
|
|
331
|
+
priority: { type: 'string', description: '優先度: low/normal/high(デフォルト: normal)' },
|
|
332
|
+
due_date: { type: 'string', description: '期限日時 ISO8601(省略可)' },
|
|
333
|
+
},
|
|
334
|
+
required: ['title'],
|
|
335
|
+
},
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
name: 'update_task',
|
|
339
|
+
description: 'タスクを更新します。【書き込み権限付きキーが必要】manual タスクは全フィールド更新可。他タイプはステータス変更のみ可。',
|
|
340
|
+
annotations: { destructiveHint: false, idempotentHint: true },
|
|
341
|
+
inputSchema: {
|
|
342
|
+
type: 'object',
|
|
343
|
+
properties: {
|
|
344
|
+
id: { type: 'string', description: 'タスクID' },
|
|
345
|
+
title: { type: 'string', description: '新しいタイトル(manual のみ、省略時は変更なし)' },
|
|
346
|
+
body: { type: 'string', description: '新しい詳細(manual のみ、省略時は変更なし)' },
|
|
347
|
+
priority: { type: 'string', description: '新しい優先度: low/normal/high(manual のみ)' },
|
|
348
|
+
due_date: { type: 'string', description: '新しい期限(manual のみ、null で期限解除)' },
|
|
349
|
+
status: { type: 'string', description: 'ステータス変更: pending/done/dismissed' },
|
|
350
|
+
},
|
|
351
|
+
required: ['id'],
|
|
352
|
+
},
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
name: 'delete_task',
|
|
356
|
+
description: 'タスクを削除します(manual タイプのみ)。【書き込み権限付きキーが必要】',
|
|
357
|
+
annotations: { destructiveHint: true, idempotentHint: false },
|
|
358
|
+
inputSchema: {
|
|
359
|
+
type: 'object',
|
|
360
|
+
properties: {
|
|
361
|
+
id: { type: 'string', description: '削除するタスクID(manual タイプのみ)' },
|
|
186
362
|
},
|
|
187
363
|
required: ['id'],
|
|
188
364
|
},
|
|
@@ -190,16 +366,71 @@ const TOOLS = [
|
|
|
190
366
|
// ワークフロー書き込み(読み書き可能キーが必要)
|
|
191
367
|
{
|
|
192
368
|
name: 'create_workflow',
|
|
193
|
-
description:
|
|
369
|
+
description: `自動化ワークフローを新規作成します。【書き込み権限付きキーが必要】
|
|
370
|
+
ワークフローは「AI推論ステップ」と「アクションステップ」を順番に配列で定義します。
|
|
371
|
+
前ステップの出力が次ステップに自動で引き継がれます。
|
|
372
|
+
|
|
373
|
+
■ ステップの種類と必須フィールド:
|
|
374
|
+
|
|
375
|
+
【agent_task — AI推論ステップ】
|
|
376
|
+
{
|
|
377
|
+
"type": "agent_task",
|
|
378
|
+
"label": "ステップ名(例: 問い合わせ内容を要約)",
|
|
379
|
+
"prompt": "このステップでAIに何をさせるか。前ステップの出力を参照する場合はそのまま書けばOK。",
|
|
380
|
+
"preset_id": "AIパートナーID(省略可)— list_agent_presets で確認",
|
|
381
|
+
"system_prompt": "preset_idなしの場合のインラインプロンプト(省略可)",
|
|
382
|
+
"knowledge_ids": ["ナレッジID", ...](省略可)— list_knowledge_items で確認
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
【action — アクションステップ】
|
|
386
|
+
action_type に応じて必要フィールドが異なる:
|
|
387
|
+
|
|
388
|
+
▸ send_chatwork(ChatWorkにメッセージ送信)
|
|
389
|
+
{ "type": "action", "label": "担当者へ通知", "action_type": "send_chatwork",
|
|
390
|
+
"chatwork_setting_id": "ChatWork設定ID" }
|
|
391
|
+
|
|
392
|
+
▸ approval(承認タスクを作成してワークフローを一時停止)
|
|
393
|
+
{ "type": "action", "label": "上長承認", "action_type": "approval",
|
|
394
|
+
"action_message": "承認依頼メッセージ",
|
|
395
|
+
"notify_chatwork": true, "chatwork_setting_id": "ChatWork設定ID" }
|
|
396
|
+
|
|
397
|
+
▸ send_email(メール送信)
|
|
398
|
+
{ "type": "action", "label": "顧客へ返信", "action_type": "send_email",
|
|
399
|
+
"email_setting_id": "メール設定ID",
|
|
400
|
+
"to_email": "宛先(省略時はcheck_emailステップの送信者へ)",
|
|
401
|
+
"subject": "件名(省略時はRe: 元件名)" }
|
|
402
|
+
|
|
403
|
+
▸ check_email(メール受信確認 → 本文を次ステップへ渡す)
|
|
404
|
+
{ "type": "action", "label": "受信メール取得", "action_type": "check_email",
|
|
405
|
+
"email_setting_id": "メール設定ID" }
|
|
406
|
+
|
|
407
|
+
▸ google_sheets_write(スプレッドシートに書き込み)
|
|
408
|
+
{ "type": "action", "label": "スプレッドシートに保存", "action_type": "google_sheets_write",
|
|
409
|
+
"spreadsheet_id": "スプレッドシートID", "sheet_range": "Sheet1!A:A" }
|
|
410
|
+
|
|
411
|
+
■ 典型的なワークフロー構成例:
|
|
412
|
+
|
|
413
|
+
【問い合わせ自動返信】
|
|
414
|
+
check_email → agent_task(要約・返信文生成) → send_email
|
|
415
|
+
|
|
416
|
+
【レポート作成→承認→ChatWork通知】
|
|
417
|
+
agent_task(レポート生成) → approval(上長確認) → send_chatwork(通知)
|
|
418
|
+
|
|
419
|
+
【定期レポート】
|
|
420
|
+
agent_task(データ分析) → agent_task(レポート文生成) → send_chatwork
|
|
421
|
+
|
|
422
|
+
■ 注意:
|
|
423
|
+
- chatwork_setting_id / email_setting_id は管理画面「設定 → 外部連携」で確認
|
|
424
|
+
- approval ステップはワークフローを一時停止し、タスクリストから承認操作が必要`,
|
|
194
425
|
annotations: { destructiveHint: false, idempotentHint: false },
|
|
195
426
|
inputSchema: {
|
|
196
427
|
type: 'object',
|
|
197
428
|
properties: {
|
|
198
|
-
title: { type: 'string', description: '
|
|
199
|
-
description: { type: 'string', description: '
|
|
429
|
+
title: { type: 'string', description: 'ワークフロー名(例: 「問い合わせ自動返信」)' },
|
|
430
|
+
description: { type: 'string', description: 'ワークフローの説明(省略可)' },
|
|
200
431
|
steps: {
|
|
201
432
|
type: 'array',
|
|
202
|
-
description: '
|
|
433
|
+
description: 'ステップ配列。agent_task と action を交互に組み合わせる。前ステップ出力が自動で次に引き継がれる。',
|
|
203
434
|
items: { type: 'object' },
|
|
204
435
|
},
|
|
205
436
|
},
|
|
@@ -208,16 +439,19 @@ const TOOLS = [
|
|
|
208
439
|
},
|
|
209
440
|
{
|
|
210
441
|
name: 'update_workflow',
|
|
211
|
-
description:
|
|
442
|
+
description: `既存のワークフローを更新します。【書き込み権限付きキーが必要】
|
|
443
|
+
指定したフィールドのみ更新され、省略したフィールドは現在値を維持します。
|
|
444
|
+
steps を渡すと全ステップが置き換わります(差分更新ではなく全置換)。
|
|
445
|
+
各ステップの形式は create_workflow と同じです。`,
|
|
212
446
|
annotations: { destructiveHint: false, idempotentHint: true },
|
|
213
447
|
inputSchema: {
|
|
214
448
|
type: 'object',
|
|
215
449
|
properties: {
|
|
216
|
-
id: { type: 'string', description: 'ワークフローID' },
|
|
450
|
+
id: { type: 'string', description: 'ワークフローID(list_workflowsで確認)' },
|
|
217
451
|
title: { type: 'string', description: '新しいタイトル(省略時は変更なし)' },
|
|
218
452
|
description: { type: 'string', description: '新しい説明(省略時は変更なし)' },
|
|
219
|
-
steps: { type: 'array', description: '
|
|
220
|
-
is_active: { type: 'boolean', description: '
|
|
453
|
+
steps: { type: 'array', description: '新しいステップ配列(省略時は変更なし。渡すと全ステップ置換)', items: { type: 'object' } },
|
|
454
|
+
is_active: { type: 'boolean', description: 'true=有効 / false=無効(省略時は変更なし)' },
|
|
221
455
|
},
|
|
222
456
|
required: ['id'],
|
|
223
457
|
},
|
|
@@ -225,41 +459,171 @@ const TOOLS = [
|
|
|
225
459
|
// チャットボット書き込み(読み書き可能キーが必要)
|
|
226
460
|
{
|
|
227
461
|
name: 'create_chatbot',
|
|
228
|
-
description:
|
|
462
|
+
description: `Webサイト埋め込み型のチャットボットを新規作成します。【書き込み権限付きキーが必要】
|
|
463
|
+
widget_token は自動生成され、埋め込みコードに使用されます。
|
|
464
|
+
|
|
465
|
+
■ 各フィールドの役割と動作:
|
|
466
|
+
• system_prompt(システムプロンプト)
|
|
467
|
+
チャット時にAIへ毎回注入される人格・役割定義。
|
|
468
|
+
「あなたは○○のサポートスタッフです。丁寧な敬語で回答してください」形式で記述。
|
|
469
|
+
AIパートナーの base_prompt に相当するフィールド。
|
|
470
|
+
|
|
471
|
+
• initial_message(最初のメッセージ)
|
|
472
|
+
ユーザーがチャットを開いたときに最初に表示されるAIからの挨拶文。
|
|
473
|
+
例: "こんにちは!○○サポートです。何でもお気軽にご相談ください😊"
|
|
474
|
+
|
|
475
|
+
• rules_allow / rules_deny(許可・禁止ルール)
|
|
476
|
+
system_promptを補強するルール定義。改行区切りの箇条書き推奨。
|
|
477
|
+
rules_allow: AIが積極的に行うこと(例: "製品説明を行う\n無料相談を案内する")
|
|
478
|
+
rules_deny: 絶対に行わないこと(例: "個人情報を収集しない\n他社製品を推薦しない")
|
|
479
|
+
|
|
480
|
+
• sales_flow(対話フロー)
|
|
481
|
+
顧客との会話ステップを定義。ヒアリング→提案→CTA誘導の流れをStep形式で記述。省略可。
|
|
482
|
+
|
|
483
|
+
• quick_replies(クイック返信ボタン)
|
|
484
|
+
チャット画面に表示されるボタンラベル。改行区切りで最大5〜6個推奨。
|
|
485
|
+
例: "料金を知りたい\n導入事例を見たい\n資料請求したい\n担当者に相談したい"
|
|
486
|
+
|
|
487
|
+
• ai_provider(AIエンジン)
|
|
488
|
+
claude(デフォルト・推奨)/ openai / gemini / openrouter / groq
|
|
489
|
+
|
|
490
|
+
• ai_model(AIモデル)
|
|
491
|
+
claudeの場合: claude-haiku-4-5-20251001(高速・低コスト), claude-sonnet-4-6(バランス), claude-opus-4-7(高精度)
|
|
492
|
+
省略時はアカウントのデフォルトモデルを使用。
|
|
493
|
+
|
|
494
|
+
■ ナレッジ連携(推奨手順):
|
|
495
|
+
1. list_knowledge_items または search_knowledge でナレッジIDを確認する
|
|
496
|
+
2. knowledge_item_ids に対象IDの配列を渡す(create時に一括紐付け)
|
|
497
|
+
3. 後から追加する場合は link_chatbot_knowledge ツールを使う
|
|
498
|
+
|
|
499
|
+
■ ナレッジ検索モード(4択から1つだけ選ぶ。下が優先度高):
|
|
500
|
+
【デフォルト推奨】全フラグfalse: semantic モード — 質問に意味的に近いチャンクのみ返す。ナレッジが多い場合に最適。
|
|
501
|
+
【knowledge_smart_full_text=true】: 意味スコアで関連ナレッジを選別→そのナレッジ全文返す。精度と網羅性のバランス型。中規模向け。
|
|
502
|
+
【knowledge_query_rewrite=true (smart_full_text=false)】: ユーザー質問をAI最適化→セマンティック検索。曖昧な質問が多い場合に有効。
|
|
503
|
+
【knowledge_semantic_search=false (設定はupdate_chatbotで変更)】: 全ナレッジを全文返す。ナレッジ件数が少ない(5件以下)場合のみ推奨。
|
|
504
|
+
|
|
505
|
+
■ 診断フロー(diagnostic_mode=true にすると有効):
|
|
506
|
+
チャットボットに「診断・アンケート機能」を追加する。質問を順番に出してユーザーの悩みやタイプを診断し、
|
|
507
|
+
最後に結果ページを表示する機能。製品選定診断・タイプ診断・相性診断・課題ヒアリングなどに使用。
|
|
508
|
+
|
|
509
|
+
diagnostic_mode=true の場合、必ず diagnostic_result_mode も指定する:
|
|
510
|
+
• "ai"(デフォルト): AIが回答内容を総合的に解釈して判定。自由記述・定性的な質問に最適。
|
|
511
|
+
ユーザーが曖昧な回答をしても文脈を理解して適切な結果を返す。
|
|
512
|
+
→ おすすめ: パーソナリティ診断・悩み相談・ヒアリングフロー
|
|
513
|
+
|
|
514
|
+
• "count": 各選択肢に番号を振り、最多選択番号で結果を判定。選択肢が明確なアンケート向き。
|
|
515
|
+
AIを使わずバックエンドで集計するため高速。
|
|
516
|
+
→ おすすめ: 製品選定・タイプ判定・属性診断
|
|
517
|
+
|
|
518
|
+
• "score": 各選択肢にポイント(点数)を設定し、合計スコアで結果を判定。
|
|
519
|
+
「Aを選んだら3点」「Bを選んだら1点」のように重み付け可能。
|
|
520
|
+
→ おすすめ: 成熟度診断・スコア可視化・段階別ランク分け
|
|
521
|
+
|
|
522
|
+
• "branch": Yes/No(または2〜4択)で分岐しながら進む決定木型。
|
|
523
|
+
各質問が前の回答によって変わる。ルート数が多い複雑な診断に向く。
|
|
524
|
+
→ おすすめ: 課題特定フロー・商品レコメンド・お悩み分岐診断
|
|
525
|
+
|
|
526
|
+
diagnostic_strict_result=true: 結果が確定した瞬間に即表示(全問回答を待たない)。
|
|
527
|
+
diagnostic_ai_text_enabled=false: 質問間のAI会話文を省略してフォーム形式に(count/scoreモードで高速化したい場合)。`,
|
|
229
528
|
annotations: { destructiveHint: false, idempotentHint: false },
|
|
230
529
|
inputSchema: {
|
|
231
530
|
type: 'object',
|
|
232
531
|
properties: {
|
|
233
|
-
name:
|
|
234
|
-
system_prompt:
|
|
235
|
-
initial_message:
|
|
236
|
-
rules_allow:
|
|
237
|
-
rules_deny:
|
|
238
|
-
sales_flow:
|
|
239
|
-
quick_replies:
|
|
532
|
+
name: { type: 'string', description: 'チャットボット名(例: 「ECサイト問い合わせBot」)' },
|
|
533
|
+
system_prompt: { type: 'string', description: 'AIの人格・役割・回答スタイルを定義するメインプロンプト。チャット時に毎回注入される。' },
|
|
534
|
+
initial_message: { type: 'string', description: 'チャット開始時にAIが最初に表示するメッセージ。ユーザーへの歓迎・誘導文。' },
|
|
535
|
+
rules_allow: { type: 'string', description: '許可ルール。改行区切り箇条書き。AIが積極的に行うべきこと。' },
|
|
536
|
+
rules_deny: { type: 'string', description: '禁止ルール。改行区切り箇条書き。AIが絶対に行ってはいけないこと。' },
|
|
537
|
+
sales_flow: { type: 'string', description: '対話フロー定義。Step形式で会話の進め方を記述。省略可。' },
|
|
538
|
+
quick_replies: { type: 'string', description: 'クイック返信ボタンラベル。改行区切りで5〜6個まで。例: "料金を知りたい\n資料請求したい"' },
|
|
539
|
+
ai_provider: { type: 'string', description: 'AIエンジン: claude(デフォルト・推奨)/ openai / gemini / openrouter / groq', enum: ['claude', 'openai', 'gemini', 'openrouter', 'groq'] },
|
|
540
|
+
ai_model: { type: 'string', description: 'モデル指定。claudeの場合: claude-haiku-4-5-20251001(高速)/ claude-sonnet-4-6(推奨)/ claude-opus-4-7(高精度)' },
|
|
541
|
+
knowledge_query_rewrite: { type: 'boolean', description: 'true=ユーザー質問をAIが最適化してから検索(曖昧な質問に強い)。デフォルト: false' },
|
|
542
|
+
knowledge_smart_full_text: { type: 'boolean', description: 'true=意味スコアで選別→全文取得(精度と網羅性のバランス型)。デフォルト: false' },
|
|
543
|
+
knowledge_item_ids: { type: 'array', items: { type: 'string' }, description: '紐付けるナレッジのID配列。list_knowledge_items / search_knowledge でIDを確認してから渡すこと。省略可(後からlink_chatbot_knowledgeでも追加可)。' },
|
|
544
|
+
diagnostic_mode: { type: 'boolean', description: 'true=診断フロー機能を有効化。質問→判定→結果表示の診断型チャットボットになる。デフォルト: false' },
|
|
545
|
+
diagnostic_result_mode: {
|
|
546
|
+
type: 'string',
|
|
547
|
+
enum: ['ai', 'count', 'score', 'branch'],
|
|
548
|
+
description: '診断判定ロジック。diagnostic_mode=trueの場合必須。ai=AI総合判断(自由記述向き)/ count=最多選択番号で判定(選択式向き)/ score=ポイント合計で判定(重み付け向き)/ branch=Yes/No分岐型(決定木向き)',
|
|
549
|
+
},
|
|
550
|
+
diagnostic_strict_result: { type: 'boolean', description: 'true=結果確定時に即表示(全問回答を待たない)。デフォルト: false' },
|
|
551
|
+
diagnostic_ai_text_enabled: { type: 'boolean', description: 'false=質問間のAI会話文を省略してフォーム形式に高速化(count/scoreモード推奨)。デフォルト: true' },
|
|
240
552
|
},
|
|
241
553
|
required: ['name'],
|
|
242
554
|
},
|
|
243
555
|
},
|
|
244
556
|
{
|
|
245
557
|
name: 'update_chatbot',
|
|
246
|
-
description:
|
|
558
|
+
description: `既存のチャットボットを更新します。【書き込み権限付きキーが必要】
|
|
559
|
+
指定したフィールドのみ更新され、省略したフィールドは現在値を維持します。
|
|
560
|
+
各フィールドの意味は create_chatbot と同じです。`,
|
|
247
561
|
annotations: { destructiveHint: false, idempotentHint: true },
|
|
248
562
|
inputSchema: {
|
|
249
563
|
type: 'object',
|
|
250
564
|
properties: {
|
|
251
|
-
id:
|
|
252
|
-
name:
|
|
253
|
-
system_prompt:
|
|
254
|
-
initial_message:
|
|
255
|
-
rules_allow:
|
|
256
|
-
rules_deny:
|
|
257
|
-
sales_flow:
|
|
258
|
-
quick_replies:
|
|
565
|
+
id: { type: 'string', description: 'チャットボットID(list_chatbotsで確認)' },
|
|
566
|
+
name: { type: 'string', description: '新しい名前(省略時は変更なし)' },
|
|
567
|
+
system_prompt: { type: 'string', description: '新しいシステムプロンプト(省略時は変更なし)' },
|
|
568
|
+
initial_message: { type: 'string', description: '新しい最初のメッセージ(省略時は変更なし)' },
|
|
569
|
+
rules_allow: { type: 'string', description: '新しい許可ルール・改行区切り(省略時は変更なし)' },
|
|
570
|
+
rules_deny: { type: 'string', description: '新しい禁止ルール・改行区切り(省略時は変更なし)' },
|
|
571
|
+
sales_flow: { type: 'string', description: '新しい対話フロー(省略時は変更なし)' },
|
|
572
|
+
quick_replies: { type: 'string', description: '新しいクイック返信・改行区切り(省略時は変更なし)' },
|
|
573
|
+
ai_provider: { type: 'string', description: '新しいAIエンジン(省略時は変更なし)', enum: ['claude', 'openai', 'gemini', 'openrouter', 'groq'] },
|
|
574
|
+
ai_model: { type: 'string', description: '新しいモデル(省略時は変更なし)' },
|
|
575
|
+
knowledge_semantic_search: { type: 'boolean', description: 'ナレッジ検索モード変更(省略時は変更なし)' },
|
|
576
|
+
knowledge_query_rewrite: { type: 'boolean', description: 'クエリ最適化モード変更(省略時は変更なし)' },
|
|
577
|
+
knowledge_smart_full_text: { type: 'boolean', description: 'スマート全文取得モード変更(省略時は変更なし)' },
|
|
578
|
+
diagnostic_mode: { type: 'boolean', description: '診断フロー有効/無効(省略時は変更なし)' },
|
|
579
|
+
diagnostic_result_mode: { type: 'string', description: '診断判定ロジック変更: ai / count / score / branch(省略時は変更なし)', enum: ['ai', 'count', 'score', 'branch'] },
|
|
580
|
+
diagnostic_strict_result: { type: 'boolean', description: '即時結果表示の変更(省略時は変更なし)' },
|
|
581
|
+
diagnostic_ai_text_enabled:{ type: 'boolean', description: '質問間のAI会話文生成の変更(省略時は変更なし)' },
|
|
259
582
|
},
|
|
260
583
|
required: ['id'],
|
|
261
584
|
},
|
|
262
585
|
},
|
|
586
|
+
// チャットボット ↔ ナレッジ 紐付け管理
|
|
587
|
+
{
|
|
588
|
+
name: 'list_chatbot_knowledge',
|
|
589
|
+
description: 'チャットボットに現在紐付けられているナレッジの一覧を取得します。',
|
|
590
|
+
annotations: { readOnlyHint: true },
|
|
591
|
+
inputSchema: {
|
|
592
|
+
type: 'object',
|
|
593
|
+
properties: {
|
|
594
|
+
chatbot_id: { type: 'string', description: 'チャットボットID(list_chatbotsで確認)' },
|
|
595
|
+
},
|
|
596
|
+
required: ['chatbot_id'],
|
|
597
|
+
},
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
name: 'link_chatbot_knowledge',
|
|
601
|
+
description: `チャットボットにナレッジを紐付けます(一括追加)。【書き込み権限付きキーが必要】
|
|
602
|
+
手順: 1) list_knowledge_items または search_knowledge でナレッジIDを確認 → 2) このツールで紐付け。
|
|
603
|
+
既に紐付け済みのIDは無視されます(重複エラーなし)。`,
|
|
604
|
+
annotations: { destructiveHint: false, idempotentHint: true },
|
|
605
|
+
inputSchema: {
|
|
606
|
+
type: 'object',
|
|
607
|
+
properties: {
|
|
608
|
+
chatbot_id: { type: 'string', description: 'チャットボットID' },
|
|
609
|
+
knowledge_item_ids: { type: 'array', items: { type: 'string' }, description: '紐付けるナレッジIDの配列' },
|
|
610
|
+
},
|
|
611
|
+
required: ['chatbot_id', 'knowledge_item_ids'],
|
|
612
|
+
},
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
name: 'unlink_chatbot_knowledge',
|
|
616
|
+
description: 'チャットボットからナレッジの紐付けを解除します。【書き込み権限付きキーが必要】ナレッジ自体は削除されません。',
|
|
617
|
+
annotations: { destructiveHint: false, idempotentHint: true },
|
|
618
|
+
inputSchema: {
|
|
619
|
+
type: 'object',
|
|
620
|
+
properties: {
|
|
621
|
+
chatbot_id: { type: 'string', description: 'チャットボットID' },
|
|
622
|
+
knowledge_item_id: { type: 'string', description: '解除するナレッジID' },
|
|
623
|
+
},
|
|
624
|
+
required: ['chatbot_id', 'knowledge_item_id'],
|
|
625
|
+
},
|
|
626
|
+
},
|
|
263
627
|
// Claude Code月額でワークフロー実行(読み書き可能キーが必要)
|
|
264
628
|
{
|
|
265
629
|
name: 'get_workflow_plan',
|
|
@@ -473,7 +837,9 @@ async function executeTool(name, args) {
|
|
|
473
837
|
|
|
474
838
|
case 'update_agent_preset': {
|
|
475
839
|
const body = {};
|
|
476
|
-
const fields = ['name','description','base_prompt','rules_allow','rules_deny','sales_flow',
|
|
840
|
+
const fields = ['name','description','base_prompt','rules_allow','rules_deny','sales_flow',
|
|
841
|
+
'knowledge','knowledge_item_ids',
|
|
842
|
+
'knowledge_semantic_search','knowledge_smart_full_text','knowledge_query_rewrite'];
|
|
477
843
|
fields.forEach(f => { if (args[f] !== undefined) body[f] = args[f]; });
|
|
478
844
|
const data = await callApi(`/agent-presets/${args.id}`, {
|
|
479
845
|
method: 'PATCH',
|
|
@@ -512,6 +878,117 @@ async function executeTool(name, args) {
|
|
|
512
878
|
return `✅ ${data.message}\n削除したナレッジ: ${data.deleted.title} (ID: ${data.deleted.id})`;
|
|
513
879
|
}
|
|
514
880
|
|
|
881
|
+
case 'list_schedules': {
|
|
882
|
+
const params = new URLSearchParams();
|
|
883
|
+
if (args.from) params.set('from', args.from);
|
|
884
|
+
if (args.to) params.set('to', args.to);
|
|
885
|
+
const data = await callApi(`/schedules?${params}`);
|
|
886
|
+
if (!data.schedules || data.schedules.length === 0) return `期間内にスケジュールがありません(${data.from} 〜 ${data.to})`;
|
|
887
|
+
const lines = data.schedules.map(s =>
|
|
888
|
+
`- [${s.id}] ${s.title}` +
|
|
889
|
+
(s.start_at ? ` ${new Date(s.start_at).toLocaleString('ja-JP', { timeZone: 'Asia/Tokyo' })}` : '') +
|
|
890
|
+
(s.end_at ? ` 〜 ${new Date(s.end_at).toLocaleString('ja-JP', { timeZone: 'Asia/Tokyo' })}` : '') +
|
|
891
|
+
(s.all_day ? ' (終日)' : '') +
|
|
892
|
+
(s.recurrence_type && s.recurrence_type !== 'none' ? ` [繰り返し: ${s.recurrence_type}]` : '') +
|
|
893
|
+
(s.description ? `\n ${s.description}` : '')
|
|
894
|
+
);
|
|
895
|
+
return `スケジュール一覧(${data.from} 〜 ${data.to}、${data.count}件):\n\n${lines.join('\n')}`;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
case 'create_schedule': {
|
|
899
|
+
const data = await callApi('/schedules', {
|
|
900
|
+
method: 'POST',
|
|
901
|
+
body: JSON.stringify({
|
|
902
|
+
title: args.title, description: args.description,
|
|
903
|
+
start_at: args.start_at, end_at: args.end_at,
|
|
904
|
+
all_day: args.all_day, color: args.color,
|
|
905
|
+
recurrence_type: args.recurrence_type,
|
|
906
|
+
recurrence_end_date: args.recurrence_end_date,
|
|
907
|
+
}),
|
|
908
|
+
});
|
|
909
|
+
return `✅ ${data.message}\nID: ${data.id}\nタイトル: ${data.title}` +
|
|
910
|
+
(data.start_at ? `\n開始: ${data.start_at}` : '');
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
case 'update_schedule': {
|
|
914
|
+
const body = {};
|
|
915
|
+
const sFields = ['title','description','start_at','end_at','all_day','color','recurrence_type','recurrence_end_date'];
|
|
916
|
+
sFields.forEach(f => { if (args[f] !== undefined) body[f] = args[f]; });
|
|
917
|
+
const data = await callApi(`/schedules/${args.id}`, {
|
|
918
|
+
method: 'PATCH',
|
|
919
|
+
body: JSON.stringify(body),
|
|
920
|
+
});
|
|
921
|
+
return `✅ ${data.message}\nID: ${data.id}`;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
case 'delete_schedule': {
|
|
925
|
+
const data = await callApi(`/schedules/${args.id}`, { method: 'DELETE' });
|
|
926
|
+
return `✅ ${data.message}\nID: ${data.id}`;
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
case 'list_tasks': {
|
|
930
|
+
const params = new URLSearchParams();
|
|
931
|
+
if (args.status) params.set('status', args.status);
|
|
932
|
+
if (args.type) params.set('type', args.type);
|
|
933
|
+
if (args.limit) params.set('limit', String(args.limit));
|
|
934
|
+
const data = await callApi(`/tasks?${params}`);
|
|
935
|
+
if (!data.tasks || data.tasks.length === 0) return 'タスクがありません。';
|
|
936
|
+
const statusIcon = { pending: '⏳', done: '✅', dismissed: '🚫', approved: '✔', rejected: '✗' };
|
|
937
|
+
const lines = data.tasks.map(t =>
|
|
938
|
+
`${statusIcon[t.status] || '•'} [${t.id}] ${t.title}` +
|
|
939
|
+
` [${t.status}/${t.priority}]` +
|
|
940
|
+
(t.due_date ? ` 期限:${t.due_date.slice(0, 10)}` : '') +
|
|
941
|
+
(t.type !== 'manual' ? ` (${t.type})` : '') +
|
|
942
|
+
(t.body ? `\n ${t.body.slice(0, 60)}${t.body.length > 60 ? '…' : ''}` : '')
|
|
943
|
+
);
|
|
944
|
+
return `タスク一覧(${data.count}件):\n\n${lines.join('\n')}`;
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
case 'get_task': {
|
|
948
|
+
const data = await callApi(`/tasks/${args.id}`);
|
|
949
|
+
const parts = [
|
|
950
|
+
`タイトル: ${data.title}`,
|
|
951
|
+
`ステータス: ${data.status}`,
|
|
952
|
+
`優先度: ${data.priority}`,
|
|
953
|
+
`タイプ: ${data.type}`,
|
|
954
|
+
data.due_date ? `期限: ${data.due_date.slice(0, 16)}` : '',
|
|
955
|
+
data.body ? `\n詳細:\n${data.body}` : '',
|
|
956
|
+
data.content ? `\n内容:\n${data.content}` : '',
|
|
957
|
+
`\nID: ${data.id}`,
|
|
958
|
+
`作成: ${data.created_at?.slice(0, 16)}`,
|
|
959
|
+
].filter(Boolean);
|
|
960
|
+
return parts.join('\n');
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
case 'create_task': {
|
|
964
|
+
const data = await callApi('/tasks', {
|
|
965
|
+
method: 'POST',
|
|
966
|
+
body: JSON.stringify({
|
|
967
|
+
title: args.title, body: args.body,
|
|
968
|
+
priority: args.priority, due_date: args.due_date,
|
|
969
|
+
}),
|
|
970
|
+
});
|
|
971
|
+
return `✅ ${data.message}\nID: ${data.id}\nタイトル: ${data.title}` +
|
|
972
|
+
`\n優先度: ${data.priority}` +
|
|
973
|
+
(data.due_date ? `\n期限: ${data.due_date.slice(0, 10)}` : '');
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
case 'update_task': {
|
|
977
|
+
const body = {};
|
|
978
|
+
const tFields = ['title','body','priority','due_date','status'];
|
|
979
|
+
tFields.forEach(f => { if (args[f] !== undefined) body[f] = args[f]; });
|
|
980
|
+
const data = await callApi(`/tasks/${args.id}`, {
|
|
981
|
+
method: 'PATCH',
|
|
982
|
+
body: JSON.stringify(body),
|
|
983
|
+
});
|
|
984
|
+
return `✅ ${data.message}\nID: ${data.id}`;
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
case 'delete_task': {
|
|
988
|
+
const data = await callApi(`/tasks/${args.id}`, { method: 'DELETE' });
|
|
989
|
+
return `✅ ${data.message}\nID: ${data.id}`;
|
|
990
|
+
}
|
|
991
|
+
|
|
515
992
|
case 'create_workflow': {
|
|
516
993
|
const data = await callApi('/workflows', {
|
|
517
994
|
method: 'POST',
|
|
@@ -532,21 +1009,27 @@ async function executeTool(name, args) {
|
|
|
532
1009
|
}
|
|
533
1010
|
|
|
534
1011
|
case 'create_chatbot': {
|
|
1012
|
+
const cbCreate = {};
|
|
1013
|
+
const cbAllFields = ['name','system_prompt','initial_message','rules_allow','rules_deny',
|
|
1014
|
+
'sales_flow','quick_replies','ai_provider','ai_model',
|
|
1015
|
+
'knowledge_query_rewrite','knowledge_smart_full_text',
|
|
1016
|
+
'diagnostic_mode','diagnostic_result_mode','diagnostic_strict_result','diagnostic_ai_text_enabled'];
|
|
1017
|
+
cbAllFields.forEach(f => { if (args[f] !== undefined) cbCreate[f] = args[f]; });
|
|
1018
|
+
if (Array.isArray(args.knowledge_item_ids)) cbCreate.knowledge_item_ids = args.knowledge_item_ids;
|
|
535
1019
|
const data = await callApi('/chatbots', {
|
|
536
1020
|
method: 'POST',
|
|
537
|
-
body: JSON.stringify(
|
|
538
|
-
name: args.name, system_prompt: args.system_prompt,
|
|
539
|
-
initial_message: args.initial_message, rules_allow: args.rules_allow,
|
|
540
|
-
rules_deny: args.rules_deny, sales_flow: args.sales_flow,
|
|
541
|
-
quick_replies: args.quick_replies,
|
|
542
|
-
}),
|
|
1021
|
+
body: JSON.stringify(cbCreate),
|
|
543
1022
|
});
|
|
544
|
-
|
|
1023
|
+
const diagInfo = cbCreate.diagnostic_mode ? `\n診断モード: ON (${cbCreate.diagnostic_result_mode || 'ai'})` : '';
|
|
1024
|
+
return `✅ ${data.message}\nID: ${data.id}\n名前: ${data.name}\nAI: ${data.ai_provider || 'claude'}\nwidget_token: ${data.widget_token}\n紐付けナレッジ: ${data.linked_knowledge_count ?? 0}件${diagInfo}`;
|
|
545
1025
|
}
|
|
546
1026
|
|
|
547
1027
|
case 'update_chatbot': {
|
|
548
1028
|
const body = {};
|
|
549
|
-
const cbFields = ['name','system_prompt','initial_message','rules_allow','rules_deny',
|
|
1029
|
+
const cbFields = ['name','system_prompt','initial_message','rules_allow','rules_deny',
|
|
1030
|
+
'sales_flow','quick_replies','ai_provider','ai_model',
|
|
1031
|
+
'knowledge_semantic_search','knowledge_query_rewrite','knowledge_smart_full_text',
|
|
1032
|
+
'diagnostic_mode','diagnostic_result_mode','diagnostic_strict_result','diagnostic_ai_text_enabled'];
|
|
550
1033
|
cbFields.forEach(f => { if (args[f] !== undefined) body[f] = args[f]; });
|
|
551
1034
|
const data = await callApi(`/chatbots/${args.id}`, {
|
|
552
1035
|
method: 'PATCH',
|
|
@@ -555,6 +1038,30 @@ async function executeTool(name, args) {
|
|
|
555
1038
|
return `✅ ${data.message}\nID: ${data.id}`;
|
|
556
1039
|
}
|
|
557
1040
|
|
|
1041
|
+
case 'list_chatbot_knowledge': {
|
|
1042
|
+
const data = await callApi(`/chatbots/${args.chatbot_id}/knowledge`);
|
|
1043
|
+
if (!data.knowledge_items || data.knowledge_items.length === 0) {
|
|
1044
|
+
return `チャットボット ${args.chatbot_id} にはナレッジが紐付けられていません。`;
|
|
1045
|
+
}
|
|
1046
|
+
const lines = data.knowledge_items.map(k => `- [${k.id}] ${k.title} (${k.category || 'other'})`);
|
|
1047
|
+
return `チャットボット ${args.chatbot_id} の紐付けナレッジ(${data.knowledge_items.length}件):\n\n${lines.join('\n')}`;
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
case 'link_chatbot_knowledge': {
|
|
1051
|
+
const data = await callApi(`/chatbots/${args.chatbot_id}/knowledge`, {
|
|
1052
|
+
method: 'POST',
|
|
1053
|
+
body: JSON.stringify({ knowledge_item_ids: args.knowledge_item_ids }),
|
|
1054
|
+
});
|
|
1055
|
+
return `✅ ${data.message}`;
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
case 'unlink_chatbot_knowledge': {
|
|
1059
|
+
const data = await callApi(`/chatbots/${args.chatbot_id}/knowledge/${args.knowledge_item_id}`, {
|
|
1060
|
+
method: 'DELETE',
|
|
1061
|
+
});
|
|
1062
|
+
return `✅ ${data.message}`;
|
|
1063
|
+
}
|
|
1064
|
+
|
|
558
1065
|
case 'get_workflow_plan': {
|
|
559
1066
|
const data = await callApi(`/workflows/${args.id}/plan`);
|
|
560
1067
|
const stepLines = data.steps.map(s => {
|
|
@@ -587,7 +1094,7 @@ async function executeTool(name, args) {
|
|
|
587
1094
|
// ── MCPサーバー起動 ────────────────────────────────────────────
|
|
588
1095
|
async function main() {
|
|
589
1096
|
const server = new Server(
|
|
590
|
-
{ name: 'owner-clone-ai', version: '1.
|
|
1097
|
+
{ name: 'owner-clone-ai', version: '1.7.0' },
|
|
591
1098
|
{ capabilities: { tools: {} } }
|
|
592
1099
|
);
|
|
593
1100
|
|