owner-clone-ai-mcp 1.4.0 → 1.8.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 +434 -54
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -150,39 +150,81 @@ 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: 'クエリ最適化モード変更(省略時は変更なし)' },
|
|
186
228
|
},
|
|
187
229
|
required: ['id'],
|
|
188
230
|
},
|
|
@@ -324,16 +366,88 @@ const TOOLS = [
|
|
|
324
366
|
// ワークフロー書き込み(読み書き可能キーが必要)
|
|
325
367
|
{
|
|
326
368
|
name: 'create_workflow',
|
|
327
|
-
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
|
+
"row_values": ["__output__"] } ← __output__ は前ステップ出力を自動挿入
|
|
411
|
+
|
|
412
|
+
▸ check_chatwork(ChatWorkの未読メッセージ取得)
|
|
413
|
+
{ "type": "action", "label": "ChatWork受信確認", "action_type": "check_chatwork",
|
|
414
|
+
"chatwork_setting_id": "ChatWork設定ID" }
|
|
415
|
+
→ 取得した本文が次ステップに引き継がれる
|
|
416
|
+
|
|
417
|
+
▸ save_email_draft(メール下書き保存)
|
|
418
|
+
{ "type": "action", "label": "メール下書き作成", "action_type": "save_email_draft",
|
|
419
|
+
"email_setting_id": "メール設定ID",
|
|
420
|
+
"to_email": "宛先(省略時はcheck_emailの差出人)",
|
|
421
|
+
"subject": "件名" }
|
|
422
|
+
|
|
423
|
+
▸ post_sns(SNSへ投稿)
|
|
424
|
+
{ "type": "action", "label": "SNS投稿", "action_type": "post_sns",
|
|
425
|
+
"sns_setting_id": "SNS設定ID",
|
|
426
|
+
"post_title": "投稿タイトル(省略可)" }
|
|
427
|
+
|
|
428
|
+
■ 典型的なワークフロー構成例:
|
|
429
|
+
|
|
430
|
+
【問い合わせ自動返信】
|
|
431
|
+
check_email → agent_task(要約・返信文生成) → send_email
|
|
432
|
+
|
|
433
|
+
【レポート作成→承認→ChatWork通知】
|
|
434
|
+
agent_task(レポート生成) → approval(上長確認) → send_chatwork(通知)
|
|
435
|
+
|
|
436
|
+
【定期レポート】
|
|
437
|
+
agent_task(データ分析) → agent_task(レポート文生成) → send_chatwork
|
|
438
|
+
|
|
439
|
+
■ 注意:
|
|
440
|
+
- chatwork_setting_id / email_setting_id は管理画面「設定 → 外部連携」で確認
|
|
441
|
+
- approval ステップはワークフローを一時停止し、タスクリストから承認操作が必要`,
|
|
328
442
|
annotations: { destructiveHint: false, idempotentHint: false },
|
|
329
443
|
inputSchema: {
|
|
330
444
|
type: 'object',
|
|
331
445
|
properties: {
|
|
332
|
-
title: { type: 'string', description: '
|
|
333
|
-
description: { type: 'string', description: '
|
|
446
|
+
title: { type: 'string', description: 'ワークフロー名(例: 「問い合わせ自動返信」)' },
|
|
447
|
+
description: { type: 'string', description: 'ワークフローの説明(省略可)' },
|
|
334
448
|
steps: {
|
|
335
449
|
type: 'array',
|
|
336
|
-
description: '
|
|
450
|
+
description: 'ステップ配列。agent_task と action を交互に組み合わせる。前ステップ出力が自動で次に引き継がれる。',
|
|
337
451
|
items: { type: 'object' },
|
|
338
452
|
},
|
|
339
453
|
},
|
|
@@ -342,16 +456,19 @@ const TOOLS = [
|
|
|
342
456
|
},
|
|
343
457
|
{
|
|
344
458
|
name: 'update_workflow',
|
|
345
|
-
description:
|
|
459
|
+
description: `既存のワークフローを更新します。【書き込み権限付きキーが必要】
|
|
460
|
+
指定したフィールドのみ更新され、省略したフィールドは現在値を維持します。
|
|
461
|
+
steps を渡すと全ステップが置き換わります(差分更新ではなく全置換)。
|
|
462
|
+
各ステップの形式は create_workflow と同じです。`,
|
|
346
463
|
annotations: { destructiveHint: false, idempotentHint: true },
|
|
347
464
|
inputSchema: {
|
|
348
465
|
type: 'object',
|
|
349
466
|
properties: {
|
|
350
|
-
id: { type: 'string', description: 'ワークフローID' },
|
|
467
|
+
id: { type: 'string', description: 'ワークフローID(list_workflowsで確認)' },
|
|
351
468
|
title: { type: 'string', description: '新しいタイトル(省略時は変更なし)' },
|
|
352
469
|
description: { type: 'string', description: '新しい説明(省略時は変更なし)' },
|
|
353
|
-
steps: { type: 'array', description: '
|
|
354
|
-
is_active: { type: 'boolean', description: '
|
|
470
|
+
steps: { type: 'array', description: '新しいステップ配列(省略時は変更なし。渡すと全ステップ置換)', items: { type: 'object' } },
|
|
471
|
+
is_active: { type: 'boolean', description: 'true=有効 / false=無効(省略時は変更なし)' },
|
|
355
472
|
},
|
|
356
473
|
required: ['id'],
|
|
357
474
|
},
|
|
@@ -359,41 +476,253 @@ const TOOLS = [
|
|
|
359
476
|
// チャットボット書き込み(読み書き可能キーが必要)
|
|
360
477
|
{
|
|
361
478
|
name: 'create_chatbot',
|
|
362
|
-
description:
|
|
479
|
+
description: `Webサイト埋め込み型のチャットボットを新規作成します。【書き込み権限付きキーが必要】
|
|
480
|
+
widget_token は自動生成され、埋め込みコードに使用されます。
|
|
481
|
+
|
|
482
|
+
■ 各フィールドの役割と動作:
|
|
483
|
+
• system_prompt(システムプロンプト)
|
|
484
|
+
チャット時にAIへ毎回注入される人格・役割定義。
|
|
485
|
+
「あなたは○○のサポートスタッフです。丁寧な敬語で回答してください」形式で記述。
|
|
486
|
+
AIパートナーの base_prompt に相当するフィールド。
|
|
487
|
+
|
|
488
|
+
• initial_message(最初のメッセージ)
|
|
489
|
+
ユーザーがチャットを開いたときに最初に表示されるAIからの挨拶文。
|
|
490
|
+
例: "こんにちは!○○サポートです。何でもお気軽にご相談ください😊"
|
|
491
|
+
|
|
492
|
+
• rules_allow / rules_deny(許可・禁止ルール)
|
|
493
|
+
system_promptを補強するルール定義。改行区切りの箇条書き推奨。
|
|
494
|
+
rules_allow: AIが積極的に行うこと(例: "製品説明を行う\n無料相談を案内する")
|
|
495
|
+
rules_deny: 絶対に行わないこと(例: "個人情報を収集しない\n他社製品を推薦しない")
|
|
496
|
+
|
|
497
|
+
• sales_flow(対話フロー)
|
|
498
|
+
顧客との会話ステップを定義。ヒアリング→提案→CTA誘導の流れをStep形式で記述。省略可。
|
|
499
|
+
|
|
500
|
+
• quick_replies(クイック返信ボタン)
|
|
501
|
+
チャット画面に表示されるボタンラベル。改行区切りで最大5〜6個推奨。
|
|
502
|
+
例: "料金を知りたい\n導入事例を見たい\n資料請求したい\n担当者に相談したい"
|
|
503
|
+
|
|
504
|
+
• ai_provider(AIエンジン)
|
|
505
|
+
claude(デフォルト・推奨)/ openai / gemini / openrouter / groq
|
|
506
|
+
|
|
507
|
+
• ai_model(AIモデル)
|
|
508
|
+
claudeの場合: claude-haiku-4-5-20251001(高速・低コスト), claude-sonnet-4-6(バランス), claude-opus-4-7(高精度)
|
|
509
|
+
省略時はアカウントのデフォルトモデルを使用。
|
|
510
|
+
|
|
511
|
+
■ ナレッジ連携(推奨手順):
|
|
512
|
+
1. list_knowledge_items または search_knowledge でナレッジIDを確認する
|
|
513
|
+
2. knowledge_item_ids に対象IDの配列を渡す(create時に一括紐付け)
|
|
514
|
+
3. 後から追加する場合は link_chatbot_knowledge ツールを使う
|
|
515
|
+
|
|
516
|
+
■ ナレッジ検索モード(4択から1つだけ選ぶ。下が優先度高):
|
|
517
|
+
【デフォルト推奨】全フラグfalse: semantic モード — 質問に意味的に近いチャンクのみ返す。ナレッジが多い場合に最適。
|
|
518
|
+
【knowledge_smart_full_text=true】: 意味スコアで関連ナレッジを選別→そのナレッジ全文返す。精度と網羅性のバランス型。中規模向け。
|
|
519
|
+
【knowledge_query_rewrite=true (smart_full_text=false)】: ユーザー質問をAI最適化→セマンティック検索。曖昧な質問が多い場合に有効。
|
|
520
|
+
【knowledge_semantic_search=false (設定はupdate_chatbotで変更)】: 全ナレッジを全文返す。ナレッジ件数が少ない(5件以下)場合のみ推奨。
|
|
521
|
+
|
|
522
|
+
■ 診断フロー(diagnostic_mode=true にすると有効):
|
|
523
|
+
チャットボットに「診断・アンケート機能」を追加する。質問を順番に出してユーザーの悩みやタイプを診断し、
|
|
524
|
+
最後に結果ページを表示する機能。製品選定診断・タイプ診断・相性診断・課題ヒアリングなどに使用。
|
|
525
|
+
|
|
526
|
+
diagnostic_mode=true の場合、必ず diagnostic_result_mode も指定する:
|
|
527
|
+
• "ai"(デフォルト): AIが回答内容を総合的に解釈して判定。自由記述・定性的な質問に最適。
|
|
528
|
+
ユーザーが曖昧な回答をしても文脈を理解して適切な結果を返す。
|
|
529
|
+
→ おすすめ: パーソナリティ診断・悩み相談・ヒアリングフロー
|
|
530
|
+
|
|
531
|
+
• "count": 各選択肢に番号を振り、最多選択番号で結果を判定。選択肢が明確なアンケート向き。
|
|
532
|
+
AIを使わずバックエンドで集計するため高速。
|
|
533
|
+
→ おすすめ: 製品選定・タイプ判定・属性診断
|
|
534
|
+
|
|
535
|
+
• "score": 各選択肢にポイント(点数)を設定し、合計スコアで結果を判定。
|
|
536
|
+
「Aを選んだら3点」「Bを選んだら1点」のように重み付け可能。
|
|
537
|
+
→ おすすめ: 成熟度診断・スコア可視化・段階別ランク分け
|
|
538
|
+
|
|
539
|
+
• "branch": Yes/No(または2〜4択)で分岐しながら進む決定木型。
|
|
540
|
+
各質問が前の回答によって変わる。ルート数が多い複雑な診断に向く。
|
|
541
|
+
→ おすすめ: 課題特定フロー・商品レコメンド・お悩み分岐診断
|
|
542
|
+
|
|
543
|
+
diagnostic_strict_result=true: 結果が確定した瞬間に即表示(全問回答を待たない)。
|
|
544
|
+
diagnostic_ai_text_enabled=false: 質問間のAI会話文を省略してフォーム形式に(count/scoreモードで高速化したい場合)。
|
|
545
|
+
|
|
546
|
+
■ 診断の質問・結果データ(diagnostic_questions / diagnostic_results):
|
|
547
|
+
|
|
548
|
+
diagnostic_questions — 質問の配列。各要素のフォーマット:
|
|
549
|
+
ai/count/scoreモード:
|
|
550
|
+
{ "id": "q1", "question": "質問文", "survey_type": "choices",
|
|
551
|
+
"choices": ["選択肢A", "選択肢B", "選択肢C"] }
|
|
552
|
+
※ scoreモードの場合は choice_scores を追加:
|
|
553
|
+
"choice_scores": { "0": {"result-id": 3}, "1": {"result-id": 1} }
|
|
554
|
+
(choices配列インデックス → { 結果ID: 点数 } のマッピング)
|
|
555
|
+
|
|
556
|
+
branchモード(各選択肢が次の質問/結果へリンク):
|
|
557
|
+
{ "id": "q1", "question": "質問文", "survey_type": "choices",
|
|
558
|
+
"choices": [
|
|
559
|
+
{ "id": "c1", "text": "はい", "next": "q2" },
|
|
560
|
+
{ "id": "c2", "text": "いいえ", "next": "result-A" }
|
|
561
|
+
] }
|
|
562
|
+
|
|
563
|
+
diagnostic_results — 結果の配列。各要素のフォーマット:
|
|
564
|
+
{ "id": "result-A", "label": "結果タイトル",
|
|
565
|
+
"condition_hint": "このユーザーはどんな人か(ai/countモードでAIが判定するヒント)",
|
|
566
|
+
"badge": "#3b82f6", "bg": "#3b82f618", "text": "#3b82f6",
|
|
567
|
+
"blocks": [] }
|
|
568
|
+
|
|
569
|
+
■ 診断後のCTA(行動喚起)設定:
|
|
570
|
+
diagnostic_goal_cta: ボタンに表示するテキスト(例: "無料相談に申し込む")
|
|
571
|
+
diagnostic_goal_url: ボタンのリンク先URL
|
|
572
|
+
diagnostic_goal_button_text: ボタン上のメインラベル(cta より具体的な文言)
|
|
573
|
+
|
|
574
|
+
■ エスカレーション(有人対応への切り替え):
|
|
575
|
+
特定のキーワードが出たとき、または「担当者につないでほしい」などのリクエストで、
|
|
576
|
+
チャットの対応を人に切り替える機能。
|
|
577
|
+
escalation_enabled=true で有効化。
|
|
578
|
+
escalation_trigger: "user_request"(ユーザーが明示的に要求したとき)または "keyword"(キーワード検出)
|
|
579
|
+
escalation_email: 通知先メールアドレス
|
|
580
|
+
escalation_chatwork_room_id: 通知先ChatWorkルームID
|
|
581
|
+
escalation_message: エスカレーション時にユーザーへ表示するメッセージ
|
|
582
|
+
escalation_keywords: 検出するキーワード(改行区切り)
|
|
583
|
+
|
|
584
|
+
■ ヘッダー:
|
|
585
|
+
header_title: チャットウィンドウ上部に表示するタイトル(例: "○○サポート")。省略時はチャットボット名。
|
|
586
|
+
|
|
587
|
+
■ Branchモードのボタンラベル:
|
|
588
|
+
branch_yes_label: Yesボタンの表示テキスト(デフォルト: "はい")
|
|
589
|
+
branch_no_label: Noボタンの表示テキスト(デフォルト: "いいえ")`,
|
|
363
590
|
annotations: { destructiveHint: false, idempotentHint: false },
|
|
364
591
|
inputSchema: {
|
|
365
592
|
type: 'object',
|
|
366
593
|
properties: {
|
|
367
|
-
name:
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
594
|
+
name: { type: 'string', description: 'チャットボット名(例: 「ECサイト問い合わせBot」)' },
|
|
595
|
+
header_title: { type: 'string', description: 'チャットウィンドウ上部のヘッダータイトル。省略時はname(チャットボット名)を使用。' },
|
|
596
|
+
system_prompt: { type: 'string', description: 'AIの人格・役割・回答スタイルを定義するメインプロンプト。チャット時に毎回注入される。' },
|
|
597
|
+
initial_message: { type: 'string', description: 'チャット開始時にAIが最初に表示するメッセージ。ユーザーへの歓迎・誘導文。' },
|
|
598
|
+
rules_allow: { type: 'string', description: '許可ルール。改行区切り箇条書き。AIが積極的に行うべきこと。' },
|
|
599
|
+
rules_deny: { type: 'string', description: '禁止ルール。改行区切り箇条書き。AIが絶対に行ってはいけないこと。' },
|
|
600
|
+
sales_flow: { type: 'string', description: '対話フロー定義。Step形式で会話の進め方を記述。省略可。' },
|
|
601
|
+
quick_replies: { type: 'string', description: 'クイック返信ボタンラベル。改行区切りで5〜6個まで。例: "料金を知りたい\n資料請求したい"' },
|
|
602
|
+
ai_provider: { type: 'string', description: 'AIエンジン: claude(デフォルト・推奨)/ openai / gemini / openrouter / groq', enum: ['claude', 'openai', 'gemini', 'openrouter', 'groq'] },
|
|
603
|
+
ai_model: { type: 'string', description: 'モデル指定。claudeの場合: claude-haiku-4-5-20251001(高速)/ claude-sonnet-4-6(推奨)/ claude-opus-4-7(高精度)' },
|
|
604
|
+
knowledge_query_rewrite: { type: 'boolean', description: 'true=ユーザー質問をAIが最適化してから検索(曖昧な質問に強い)。デフォルト: false' },
|
|
605
|
+
knowledge_smart_full_text: { type: 'boolean', description: 'true=意味スコアで選別→全文取得(精度と網羅性のバランス型)。デフォルト: false' },
|
|
606
|
+
knowledge_item_ids: { type: 'array', items: { type: 'string' }, description: '紐付けるナレッジのID配列。list_knowledge_items / search_knowledge でIDを確認してから渡すこと。省略可(後からlink_chatbot_knowledgeでも追加可)。' },
|
|
607
|
+
diagnostic_mode: { type: 'boolean', description: 'true=診断フロー機能を有効化。質問→判定→結果表示の診断型チャットボットになる。デフォルト: false' },
|
|
608
|
+
diagnostic_result_mode: {
|
|
609
|
+
type: 'string',
|
|
610
|
+
enum: ['ai', 'count', 'score', 'branch'],
|
|
611
|
+
description: '診断判定ロジック。ai=AI総合判断(自由記述向き)/ count=最多選択番号判定(選択式向き)/ score=ポイント合計(重み付け向き)/ branch=Yes/No分岐型(決定木向き)',
|
|
612
|
+
},
|
|
613
|
+
diagnostic_strict_result: { type: 'boolean', description: 'true=結果確定時に即表示(全問回答を待たない)。デフォルト: false' },
|
|
614
|
+
diagnostic_ai_text_enabled: { type: 'boolean', description: 'false=質問間のAI会話文を省略してフォーム形式に高速化(count/scoreモード推奨)。デフォルト: true' },
|
|
615
|
+
diagnostic_questions: {
|
|
616
|
+
type: 'array',
|
|
617
|
+
description: '診断の質問配列。各要素: {id, question, survey_type:"choices", choices:[...]}。branchモードはchoices内に{id,text,next}を使用。',
|
|
618
|
+
items: { type: 'object' },
|
|
619
|
+
},
|
|
620
|
+
diagnostic_results: {
|
|
621
|
+
type: 'array',
|
|
622
|
+
description: '診断の結果配列。各要素: {id, label, condition_hint, badge:"#色", bg:"#色18", text:"#色", blocks:[]}。',
|
|
623
|
+
items: { type: 'object' },
|
|
624
|
+
},
|
|
625
|
+
diagnostic_goal_cta: { type: 'string', description: '診断結果後のCTAボタンテキスト(例: "無料相談に申し込む")' },
|
|
626
|
+
diagnostic_goal_url: { type: 'string', description: '診断結果後のCTAボタンリンク先URL' },
|
|
627
|
+
diagnostic_goal_button_text: { type: 'string', description: '診断結果後のボタン表示テキスト' },
|
|
628
|
+
escalation_enabled: { type: 'boolean', description: 'true=有人対応切り替え機能を有効化。デフォルト: false' },
|
|
629
|
+
escalation_trigger: { type: 'string', description: 'エスカレーション発動条件: "user_request"(ユーザーが要求した時)/ "keyword"(キーワード検出時)', enum: ['user_request', 'keyword'] },
|
|
630
|
+
escalation_email: { type: 'string', description: 'エスカレーション通知先メールアドレス(省略可)' },
|
|
631
|
+
escalation_chatwork_room_id: { type: 'string', description: 'エスカレーション通知先ChatWorkルームID(省略可)' },
|
|
632
|
+
escalation_message: { type: 'string', description: 'エスカレーション時にユーザーへ表示するメッセージ。デフォルト: "担当者に繋ぎます…"' },
|
|
633
|
+
escalation_keywords: { type: 'string', description: 'keyword triggerの場合のキーワードリスト。改行区切り。' },
|
|
634
|
+
branch_yes_label: { type: 'string', description: 'branchモードのYesボタン表示テキスト(デフォルト: "はい")' },
|
|
635
|
+
branch_no_label: { type: 'string', description: 'branchモードのNoボタン表示テキスト(デフォルト: "いいえ")' },
|
|
374
636
|
},
|
|
375
637
|
required: ['name'],
|
|
376
638
|
},
|
|
377
639
|
},
|
|
378
640
|
{
|
|
379
641
|
name: 'update_chatbot',
|
|
380
|
-
description:
|
|
642
|
+
description: `既存のチャットボットを更新します。【書き込み権限付きキーが必要】
|
|
643
|
+
指定したフィールドのみ更新され、省略したフィールドは現在値を維持します。
|
|
644
|
+
diagnostic_questions / diagnostic_results を渡すと全データが置換されます(差分更新ではない)。
|
|
645
|
+
各フィールドの意味は create_chatbot と同じです。`,
|
|
381
646
|
annotations: { destructiveHint: false, idempotentHint: true },
|
|
382
647
|
inputSchema: {
|
|
383
648
|
type: 'object',
|
|
384
649
|
properties: {
|
|
385
|
-
id:
|
|
386
|
-
name:
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
650
|
+
id: { type: 'string', description: 'チャットボットID(list_chatbotsで確認)' },
|
|
651
|
+
name: { type: 'string', description: '新しい名前(省略時は変更なし)' },
|
|
652
|
+
header_title: { type: 'string', description: '新しいヘッダータイトル(省略時は変更なし)' },
|
|
653
|
+
system_prompt: { type: 'string', description: '新しいシステムプロンプト(省略時は変更なし)' },
|
|
654
|
+
initial_message: { type: 'string', description: '新しい最初のメッセージ(省略時は変更なし)' },
|
|
655
|
+
rules_allow: { type: 'string', description: '新しい許可ルール・改行区切り(省略時は変更なし)' },
|
|
656
|
+
rules_deny: { type: 'string', description: '新しい禁止ルール・改行区切り(省略時は変更なし)' },
|
|
657
|
+
sales_flow: { type: 'string', description: '新しい対話フロー(省略時は変更なし)' },
|
|
658
|
+
quick_replies: { type: 'string', description: '新しいクイック返信・改行区切り(省略時は変更なし)' },
|
|
659
|
+
ai_provider: { type: 'string', description: '新しいAIエンジン(省略時は変更なし)', enum: ['claude', 'openai', 'gemini', 'openrouter', 'groq'] },
|
|
660
|
+
ai_model: { type: 'string', description: '新しいモデル(省略時は変更なし)' },
|
|
661
|
+
knowledge_semantic_search: { type: 'boolean', description: 'ナレッジ検索モード変更(省略時は変更なし)' },
|
|
662
|
+
knowledge_query_rewrite: { type: 'boolean', description: 'クエリ最適化モード変更(省略時は変更なし)' },
|
|
663
|
+
knowledge_smart_full_text: { type: 'boolean', description: 'スマート全文取得モード変更(省略時は変更なし)' },
|
|
664
|
+
diagnostic_mode: { type: 'boolean', description: '診断フロー有効/無効(省略時は変更なし)' },
|
|
665
|
+
diagnostic_result_mode: { type: 'string', description: '診断判定ロジック変更: ai / count / score / branch(省略時は変更なし)', enum: ['ai', 'count', 'score', 'branch'] },
|
|
666
|
+
diagnostic_strict_result: { type: 'boolean', description: '即時結果表示の変更(省略時は変更なし)' },
|
|
667
|
+
diagnostic_ai_text_enabled: { type: 'boolean', description: '質問間のAI会話文生成の変更(省略時は変更なし)' },
|
|
668
|
+
diagnostic_questions: { type: 'array', description: '診断質問を全置換(省略時は変更なし)', items: { type: 'object' } },
|
|
669
|
+
diagnostic_results: { type: 'array', description: '診断結果を全置換(省略時は変更なし)', items: { type: 'object' } },
|
|
670
|
+
diagnostic_goal_cta: { type: 'string', description: '診断後CTAボタンテキスト(省略時は変更なし)' },
|
|
671
|
+
diagnostic_goal_url: { type: 'string', description: '診断後CTAリンク先(省略時は変更なし)' },
|
|
672
|
+
diagnostic_goal_button_text: { type: 'string', description: '診断後ボタンテキスト(省略時は変更なし)' },
|
|
673
|
+
escalation_enabled: { type: 'boolean', description: 'エスカレーション有効/無効(省略時は変更なし)' },
|
|
674
|
+
escalation_trigger: { type: 'string', description: 'エスカレーション発動条件変更(省略時は変更なし)', enum: ['user_request', 'keyword'] },
|
|
675
|
+
escalation_email: { type: 'string', description: 'エスカレーション通知メール(省略時は変更なし)' },
|
|
676
|
+
escalation_chatwork_room_id: { type: 'string', description: 'エスカレーション通知ChatWorkルームID(省略時は変更なし)' },
|
|
677
|
+
escalation_message: { type: 'string', description: 'エスカレーション時のメッセージ(省略時は変更なし)' },
|
|
678
|
+
escalation_keywords: { type: 'string', description: 'エスカレーションキーワード改行区切り(省略時は変更なし)' },
|
|
679
|
+
branch_yes_label: { type: 'string', description: 'branchモードYesボタンテキスト(省略時は変更なし)' },
|
|
680
|
+
branch_no_label: { type: 'string', description: 'branchモードNoボタンテキスト(省略時は変更なし)' },
|
|
393
681
|
},
|
|
394
682
|
required: ['id'],
|
|
395
683
|
},
|
|
396
684
|
},
|
|
685
|
+
// チャットボット ↔ ナレッジ 紐付け管理
|
|
686
|
+
{
|
|
687
|
+
name: 'list_chatbot_knowledge',
|
|
688
|
+
description: 'チャットボットに現在紐付けられているナレッジの一覧を取得します。',
|
|
689
|
+
annotations: { readOnlyHint: true },
|
|
690
|
+
inputSchema: {
|
|
691
|
+
type: 'object',
|
|
692
|
+
properties: {
|
|
693
|
+
chatbot_id: { type: 'string', description: 'チャットボットID(list_chatbotsで確認)' },
|
|
694
|
+
},
|
|
695
|
+
required: ['chatbot_id'],
|
|
696
|
+
},
|
|
697
|
+
},
|
|
698
|
+
{
|
|
699
|
+
name: 'link_chatbot_knowledge',
|
|
700
|
+
description: `チャットボットにナレッジを紐付けます(一括追加)。【書き込み権限付きキーが必要】
|
|
701
|
+
手順: 1) list_knowledge_items または search_knowledge でナレッジIDを確認 → 2) このツールで紐付け。
|
|
702
|
+
既に紐付け済みのIDは無視されます(重複エラーなし)。`,
|
|
703
|
+
annotations: { destructiveHint: false, idempotentHint: true },
|
|
704
|
+
inputSchema: {
|
|
705
|
+
type: 'object',
|
|
706
|
+
properties: {
|
|
707
|
+
chatbot_id: { type: 'string', description: 'チャットボットID' },
|
|
708
|
+
knowledge_item_ids: { type: 'array', items: { type: 'string' }, description: '紐付けるナレッジIDの配列' },
|
|
709
|
+
},
|
|
710
|
+
required: ['chatbot_id', 'knowledge_item_ids'],
|
|
711
|
+
},
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
name: 'unlink_chatbot_knowledge',
|
|
715
|
+
description: 'チャットボットからナレッジの紐付けを解除します。【書き込み権限付きキーが必要】ナレッジ自体は削除されません。',
|
|
716
|
+
annotations: { destructiveHint: false, idempotentHint: true },
|
|
717
|
+
inputSchema: {
|
|
718
|
+
type: 'object',
|
|
719
|
+
properties: {
|
|
720
|
+
chatbot_id: { type: 'string', description: 'チャットボットID' },
|
|
721
|
+
knowledge_item_id: { type: 'string', description: '解除するナレッジID' },
|
|
722
|
+
},
|
|
723
|
+
required: ['chatbot_id', 'knowledge_item_id'],
|
|
724
|
+
},
|
|
725
|
+
},
|
|
397
726
|
// Claude Code月額でワークフロー実行(読み書き可能キーが必要)
|
|
398
727
|
{
|
|
399
728
|
name: 'get_workflow_plan',
|
|
@@ -607,7 +936,9 @@ async function executeTool(name, args) {
|
|
|
607
936
|
|
|
608
937
|
case 'update_agent_preset': {
|
|
609
938
|
const body = {};
|
|
610
|
-
const fields = ['name','description','base_prompt','rules_allow','rules_deny','sales_flow',
|
|
939
|
+
const fields = ['name','description','base_prompt','rules_allow','rules_deny','sales_flow',
|
|
940
|
+
'knowledge','knowledge_item_ids',
|
|
941
|
+
'knowledge_semantic_search','knowledge_smart_full_text','knowledge_query_rewrite'];
|
|
611
942
|
fields.forEach(f => { if (args[f] !== undefined) body[f] = args[f]; });
|
|
612
943
|
const data = await callApi(`/agent-presets/${args.id}`, {
|
|
613
944
|
method: 'PATCH',
|
|
@@ -777,22 +1108,47 @@ async function executeTool(name, args) {
|
|
|
777
1108
|
}
|
|
778
1109
|
|
|
779
1110
|
case 'create_chatbot': {
|
|
1111
|
+
const cbCreate = {};
|
|
1112
|
+
const cbAllFields = [
|
|
1113
|
+
'name','header_title','system_prompt','initial_message','rules_allow','rules_deny',
|
|
1114
|
+
'sales_flow','quick_replies','ai_provider','ai_model',
|
|
1115
|
+
'knowledge_query_rewrite','knowledge_smart_full_text',
|
|
1116
|
+
'diagnostic_mode','diagnostic_result_mode','diagnostic_strict_result','diagnostic_ai_text_enabled',
|
|
1117
|
+
'diagnostic_goal_cta','diagnostic_goal_url','diagnostic_goal_button_text',
|
|
1118
|
+
'escalation_enabled','escalation_trigger','escalation_email',
|
|
1119
|
+
'escalation_chatwork_room_id','escalation_message','escalation_keywords',
|
|
1120
|
+
'branch_yes_label','branch_no_label',
|
|
1121
|
+
];
|
|
1122
|
+
cbAllFields.forEach(f => { if (args[f] !== undefined) cbCreate[f] = args[f]; });
|
|
1123
|
+
if (Array.isArray(args.knowledge_item_ids)) cbCreate.knowledge_item_ids = args.knowledge_item_ids;
|
|
1124
|
+
if (Array.isArray(args.diagnostic_questions)) cbCreate.diagnostic_questions = args.diagnostic_questions;
|
|
1125
|
+
if (Array.isArray(args.diagnostic_results)) cbCreate.diagnostic_results = args.diagnostic_results;
|
|
780
1126
|
const data = await callApi('/chatbots', {
|
|
781
1127
|
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
|
-
}),
|
|
1128
|
+
body: JSON.stringify(cbCreate),
|
|
788
1129
|
});
|
|
789
|
-
|
|
1130
|
+
const diagInfo = cbCreate.diagnostic_mode
|
|
1131
|
+
? `\n診断モード: ON (${cbCreate.diagnostic_result_mode || 'ai'}) / 質問数: ${(cbCreate.diagnostic_questions || []).length} / 結果数: ${(cbCreate.diagnostic_results || []).length}`
|
|
1132
|
+
: '';
|
|
1133
|
+
const escInfo = cbCreate.escalation_enabled ? '\nエスカレーション: ON' : '';
|
|
1134
|
+
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}${escInfo}`;
|
|
790
1135
|
}
|
|
791
1136
|
|
|
792
1137
|
case 'update_chatbot': {
|
|
793
1138
|
const body = {};
|
|
794
|
-
const cbFields = [
|
|
1139
|
+
const cbFields = [
|
|
1140
|
+
'name','header_title','system_prompt','initial_message','rules_allow','rules_deny',
|
|
1141
|
+
'sales_flow','quick_replies','ai_provider','ai_model',
|
|
1142
|
+
'knowledge_semantic_search','knowledge_query_rewrite','knowledge_smart_full_text',
|
|
1143
|
+
'diagnostic_mode','diagnostic_result_mode','diagnostic_strict_result','diagnostic_ai_text_enabled',
|
|
1144
|
+
'diagnostic_goal_cta','diagnostic_goal_url','diagnostic_goal_button_text',
|
|
1145
|
+
'escalation_enabled','escalation_trigger','escalation_email',
|
|
1146
|
+
'escalation_chatwork_room_id','escalation_message','escalation_keywords',
|
|
1147
|
+
'branch_yes_label','branch_no_label',
|
|
1148
|
+
];
|
|
795
1149
|
cbFields.forEach(f => { if (args[f] !== undefined) body[f] = args[f]; });
|
|
1150
|
+
if (Array.isArray(args.diagnostic_questions)) body.diagnostic_questions = args.diagnostic_questions;
|
|
1151
|
+
if (Array.isArray(args.diagnostic_results)) body.diagnostic_results = args.diagnostic_results;
|
|
796
1152
|
const data = await callApi(`/chatbots/${args.id}`, {
|
|
797
1153
|
method: 'PATCH',
|
|
798
1154
|
body: JSON.stringify(body),
|
|
@@ -800,6 +1156,30 @@ async function executeTool(name, args) {
|
|
|
800
1156
|
return `✅ ${data.message}\nID: ${data.id}`;
|
|
801
1157
|
}
|
|
802
1158
|
|
|
1159
|
+
case 'list_chatbot_knowledge': {
|
|
1160
|
+
const data = await callApi(`/chatbots/${args.chatbot_id}/knowledge`);
|
|
1161
|
+
if (!data.knowledge_items || data.knowledge_items.length === 0) {
|
|
1162
|
+
return `チャットボット ${args.chatbot_id} にはナレッジが紐付けられていません。`;
|
|
1163
|
+
}
|
|
1164
|
+
const lines = data.knowledge_items.map(k => `- [${k.id}] ${k.title} (${k.category || 'other'})`);
|
|
1165
|
+
return `チャットボット ${args.chatbot_id} の紐付けナレッジ(${data.knowledge_items.length}件):\n\n${lines.join('\n')}`;
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
case 'link_chatbot_knowledge': {
|
|
1169
|
+
const data = await callApi(`/chatbots/${args.chatbot_id}/knowledge`, {
|
|
1170
|
+
method: 'POST',
|
|
1171
|
+
body: JSON.stringify({ knowledge_item_ids: args.knowledge_item_ids }),
|
|
1172
|
+
});
|
|
1173
|
+
return `✅ ${data.message}`;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
case 'unlink_chatbot_knowledge': {
|
|
1177
|
+
const data = await callApi(`/chatbots/${args.chatbot_id}/knowledge/${args.knowledge_item_id}`, {
|
|
1178
|
+
method: 'DELETE',
|
|
1179
|
+
});
|
|
1180
|
+
return `✅ ${data.message}`;
|
|
1181
|
+
}
|
|
1182
|
+
|
|
803
1183
|
case 'get_workflow_plan': {
|
|
804
1184
|
const data = await callApi(`/workflows/${args.id}/plan`);
|
|
805
1185
|
const stepLines = data.steps.map(s => {
|
|
@@ -832,7 +1212,7 @@ async function executeTool(name, args) {
|
|
|
832
1212
|
// ── MCPサーバー起動 ────────────────────────────────────────────
|
|
833
1213
|
async function main() {
|
|
834
1214
|
const server = new Server(
|
|
835
|
-
{ name: 'owner-clone-ai', version: '1.
|
|
1215
|
+
{ name: 'owner-clone-ai', version: '1.8.0' },
|
|
836
1216
|
{ capabilities: { tools: {} } }
|
|
837
1217
|
);
|
|
838
1218
|
|