@argosvix/mcp-server 0.14.0-alpha.1 → 0.20.0-alpha.1
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/dist/tools.d.ts +2 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +727 -1
- package/dist/tools.js.map +1 -1
- package/dist/tools.test.js +462 -1
- package/dist/tools.test.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +50 -50
package/dist/tools.js
CHANGED
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
* write tools:
|
|
15
15
|
* - silence_alert / unsilence_alert = alert のミュート操作 (= Phase 2)
|
|
16
16
|
* - create_alert = 新規 alert ルール作成 (= Phase 3)
|
|
17
|
+
* - update_alert / delete_alert = alert lifecycle 完結 (= v1.6 #13-4)
|
|
18
|
+
* - create_annotation / update_annotation / delete_annotation = annotation CRUD (= v1.6 #13-3)
|
|
17
19
|
*
|
|
18
20
|
* 残 (= acknowledge_alert / HTTP transport / resources・prompts) は後続 phase。
|
|
19
21
|
*/
|
|
@@ -48,6 +50,24 @@ const TOOL_ARG_ALLOWLIST = {
|
|
|
48
50
|
"enabled",
|
|
49
51
|
"conditions",
|
|
50
52
|
],
|
|
53
|
+
// 2026-06-03 v1.6 #13-4 = update_alert / delete_alert tools (= axis 1 強化)。
|
|
54
|
+
// backend PATCH/DELETE /v1/alerts/:id の wrap。 alertType は immutable (= backend
|
|
55
|
+
// validateUpdate で 400)、 schema 側にも入れない。 alertId は path 直前置換、
|
|
56
|
+
// body field のみ allowlist。
|
|
57
|
+
update_alert: [
|
|
58
|
+
"alertId",
|
|
59
|
+
"name",
|
|
60
|
+
"thresholdValue",
|
|
61
|
+
"windowMinutes",
|
|
62
|
+
"filterProvider",
|
|
63
|
+
"filterModel",
|
|
64
|
+
"channelKinds",
|
|
65
|
+
"channelTargets",
|
|
66
|
+
"sleepMinutes",
|
|
67
|
+
"enabled",
|
|
68
|
+
"conditions",
|
|
69
|
+
],
|
|
70
|
+
delete_alert: ["alertId"],
|
|
51
71
|
// Phase 3 read tools = alertId は path 直前置換 (= GET /v1/alerts/:id)。
|
|
52
72
|
// list_alert_events は query param (limit / alertId) のみ allowlist。
|
|
53
73
|
get_alert: ["alertId"],
|
|
@@ -61,15 +81,46 @@ const TOOL_ARG_ALLOWLIST = {
|
|
|
61
81
|
list_annotations_for_call: ["callId"],
|
|
62
82
|
list_annotations_by_label: ["label", "limit"],
|
|
63
83
|
get_annotation: ["annotationId"],
|
|
84
|
+
// 2026-06-03 v1.6 #13-3 = annotation CRUD write tools (= axis 1 強化、
|
|
85
|
+
// 全社未対応領域での 新規優位)。 backend POST/PATCH/DELETE /v1/annotations を
|
|
86
|
+
// allowlist 経由で wrap。 annotation_text / label / quality_score の値域は
|
|
87
|
+
// backend で 最終 validation (= 2000 char / 50 char + 英数 _ - / 1-5 integer)。
|
|
88
|
+
create_annotation: ["callId", "annotationText", "label", "qualityScore"],
|
|
89
|
+
update_annotation: ["annotationId", "annotationText", "label", "qualityScore"],
|
|
90
|
+
delete_annotation: ["annotationId"],
|
|
64
91
|
// 2026-06-02 v1.5 = eval criteria read tools。 global default + 自 account custom
|
|
65
92
|
// の両方を visible。 criterionId は AUTOINCREMENT integer、 dispatch 側で validate。
|
|
66
93
|
list_eval_criteria: [],
|
|
67
94
|
get_eval_criterion: ["criterionId"],
|
|
95
|
+
// 2026-06-03 v1.6 #13-2 = eval criteria write tools (= axis 1 強化、 Langfuse 未対応領域)。
|
|
96
|
+
// Pro+ 専用。 create + update = full replace (= name + rubric + scaleMin + scaleMax 全
|
|
97
|
+
// 必須)、 delete = 自 account 内 only (= global default は 構造防御で対象外)。
|
|
98
|
+
create_eval_criterion: ["name", "rubric", "scaleMin", "scaleMax"],
|
|
99
|
+
update_eval_criterion: ["criterionId", "name", "rubric", "scaleMin", "scaleMax"],
|
|
100
|
+
delete_eval_criterion: ["criterionId"],
|
|
101
|
+
// 2026-06-03 v1.6 #13-5 = test_webhook tool (= alert webhook 試送 path)。
|
|
102
|
+
// backend POST /v1/alerts/test-webhook を allowlist 経由で wrap。 URL は SSRF
|
|
103
|
+
// 防御 (= validateWebhookTarget)、 secret は HMAC 署名用、 rate limit 5/分。
|
|
104
|
+
test_webhook: ["url", "secret", "alertName"],
|
|
105
|
+
// 2026-06-03 v1.6 #13-7 = LLM feature budget tools (= safety classifier +
|
|
106
|
+
// PII audit + eval baseline runner の 月予算 cap)。 get は Free / Pro+ 共通、
|
|
107
|
+
// raise は Pro+ 専用、 $5-$500 hard cap。 default $5 で 月跨ぎ で 自動 reset。
|
|
108
|
+
get_llm_budget: [],
|
|
109
|
+
raise_llm_budget: ["budgetUsd"],
|
|
68
110
|
// 2026-06-02 v1.5 Round F = prompt registry read tools。 user の保存 prompt
|
|
69
111
|
// template を tap で取得、 AI agent が template + variables + labels を context
|
|
70
112
|
// に取り込む path。 name / label / limit は query param、 promptId は path 直前置換。
|
|
71
113
|
list_prompts: ["label", "name", "limit"],
|
|
72
114
|
get_prompt: ["promptId"],
|
|
115
|
+
// 2026-06-03 v1.6 #13-1 = prompt registry write tools (= axis 1 強化、 Langfuse
|
|
116
|
+
// 比較で同等領域)。 Pro+ 専用。 create = 新 version 作成、 update = template /
|
|
117
|
+
// variables / labels / description の部分更新、 rename = name + version 変更
|
|
118
|
+
// (= typo 修正軸、 UNIQUE 衝突 → 409)、 delete = 削除 (= 204)。 backend が field
|
|
119
|
+
// validation + plan gate + Origin/Referer CSRF 防御を carry する path に乗る。
|
|
120
|
+
create_prompt: ["name", "version", "template", "variables", "labels", "description"],
|
|
121
|
+
update_prompt: ["promptId", "template", "variables", "labels", "description"],
|
|
122
|
+
rename_prompt: ["promptId", "name", "version"],
|
|
123
|
+
delete_prompt: ["promptId"],
|
|
73
124
|
// 2026-06-02 v1.5 closure = safety classifier read tools。 OpenAI Moderation
|
|
74
125
|
// cron が書き込んだ assessment を AI agent から閲覧する path。 callId は
|
|
75
126
|
// /v1/safety-assessments?call_id= query param、 assessmentId は path 直前置換。
|
|
@@ -79,7 +130,9 @@ const TOOL_ARG_ALLOWLIST = {
|
|
|
79
130
|
// は scores 同梱、 run は POST (= Pro+ で startEvalRun に渡す軸)。
|
|
80
131
|
list_eval_runs: ["limit"],
|
|
81
132
|
get_eval_run: ["runId"],
|
|
82
|
-
|
|
133
|
+
// 2026-06-02 Codex round 2 🔴 fix = idempotencyKey 必須 path (= AI agent が
|
|
134
|
+
// retry した時に backend で dedup)、 client が opaque string 64 char で carry。
|
|
135
|
+
run_eval: ["name", "recentCount", "label", "promptRegistryId", "idempotencyKey"],
|
|
83
136
|
};
|
|
84
137
|
export const tools = [
|
|
85
138
|
{
|
|
@@ -353,6 +406,126 @@ export const tools = [
|
|
|
353
406
|
},
|
|
354
407
|
},
|
|
355
408
|
},
|
|
409
|
+
{
|
|
410
|
+
name: "update_alert",
|
|
411
|
+
description: "既存 alert の設定を更新する (= PATCH /v1/alerts/:id)。 alertType (= 監視タイプ) は immutable で、 " +
|
|
412
|
+
"変更したい場合は新規 alert を作成してから旧 alert を delete する (= alert lifecycle 完結)。 " +
|
|
413
|
+
"閾値 / 評価窓 / 通知チャンネル / 名前 / 有効化フラグ / 複合条件 を 部分 update 可能 (= 全フィールド optional)。 " +
|
|
414
|
+
"例: 「月予算 alert の threshold を $100 → $50 に下げて」 / 「通知チャンネルを Slack に追加」。",
|
|
415
|
+
inputSchema: {
|
|
416
|
+
type: "object",
|
|
417
|
+
additionalProperties: false,
|
|
418
|
+
required: ["alertId"],
|
|
419
|
+
properties: {
|
|
420
|
+
alertId: {
|
|
421
|
+
type: "string",
|
|
422
|
+
description: "対象 alert の ID (= list_alerts で取得)",
|
|
423
|
+
pattern: "^[A-Za-z0-9-]{1,64}$",
|
|
424
|
+
},
|
|
425
|
+
name: {
|
|
426
|
+
type: "string",
|
|
427
|
+
description: "alert の表示名 (1-100 文字、 改行不可)。 省略で 既存値維持",
|
|
428
|
+
minLength: 1,
|
|
429
|
+
maxLength: 100,
|
|
430
|
+
pattern: "^[^\\r\\n]{1,100}$",
|
|
431
|
+
},
|
|
432
|
+
thresholdValue: {
|
|
433
|
+
type: "number",
|
|
434
|
+
description: "閾値 (= 0 以上)。 省略で 既存値維持",
|
|
435
|
+
minimum: 0,
|
|
436
|
+
},
|
|
437
|
+
windowMinutes: {
|
|
438
|
+
type: "integer",
|
|
439
|
+
description: "集計時間窓 (分、 5-43200)。 省略で 既存値維持",
|
|
440
|
+
minimum: 5,
|
|
441
|
+
maximum: 43200,
|
|
442
|
+
},
|
|
443
|
+
filterProvider: {
|
|
444
|
+
type: "string",
|
|
445
|
+
description: "対象 provider。 省略で 既存値維持、 明示 null で 全 provider に解除",
|
|
446
|
+
enum: ["openai", "anthropic", "gemini", "mistral"],
|
|
447
|
+
},
|
|
448
|
+
filterModel: {
|
|
449
|
+
type: "string",
|
|
450
|
+
description: "対象 model (部分一致)。 省略で 既存値維持、 明示 null で 全 model に解除",
|
|
451
|
+
maxLength: 128,
|
|
452
|
+
},
|
|
453
|
+
channelKinds: {
|
|
454
|
+
type: "array",
|
|
455
|
+
description: "有効化する通知チャンネル種別。 省略で 既存値維持。 channelTargets と同時更新推奨",
|
|
456
|
+
minItems: 1,
|
|
457
|
+
items: { type: "string", enum: ["email", "slack", "webhook", "discord", "teams"] },
|
|
458
|
+
},
|
|
459
|
+
channelTargets: {
|
|
460
|
+
type: "object",
|
|
461
|
+
description: "channelKinds に挙げた各 kind の宛先 object。 省略で 既存値維持",
|
|
462
|
+
additionalProperties: false,
|
|
463
|
+
properties: {
|
|
464
|
+
email: { type: "string", description: "通知先メールアドレス" },
|
|
465
|
+
slack: { type: "string", description: "Slack Incoming Webhook URL" },
|
|
466
|
+
webhook: { type: "string", description: "汎用 webhook URL (https)" },
|
|
467
|
+
discord: { type: "string", description: "Discord webhook URL" },
|
|
468
|
+
teams: { type: "string", description: "Microsoft Teams Incoming Webhook URL" },
|
|
469
|
+
},
|
|
470
|
+
},
|
|
471
|
+
sleepMinutes: {
|
|
472
|
+
type: "integer",
|
|
473
|
+
description: "連続通知の抑制時間 (分、 5-10080)。 省略で 既存値維持",
|
|
474
|
+
minimum: 5,
|
|
475
|
+
maximum: 10080,
|
|
476
|
+
},
|
|
477
|
+
enabled: {
|
|
478
|
+
type: "boolean",
|
|
479
|
+
description: "alert の有効化フラグ。 false で 一時的に評価を止める (= silence と違い再 enable には PATCH 必要)",
|
|
480
|
+
},
|
|
481
|
+
conditions: {
|
|
482
|
+
type: "object",
|
|
483
|
+
description: "v1.5 multi-condition alert の更新。 指定すると 単 metric path を ignore し " +
|
|
484
|
+
"AND/OR 集約 path に switch。 既存の 単 metric / multi-condition の どちらにも上書き可能。",
|
|
485
|
+
required: ["operator", "conditions"],
|
|
486
|
+
additionalProperties: false,
|
|
487
|
+
properties: {
|
|
488
|
+
operator: { type: "string", enum: ["AND", "OR"] },
|
|
489
|
+
conditions: {
|
|
490
|
+
type: "array",
|
|
491
|
+
minItems: 1,
|
|
492
|
+
maxItems: 8,
|
|
493
|
+
items: {
|
|
494
|
+
type: "object",
|
|
495
|
+
additionalProperties: false,
|
|
496
|
+
required: ["metric", "threshold", "windowMinutes", "comparator"],
|
|
497
|
+
properties: {
|
|
498
|
+
metric: { type: "string" },
|
|
499
|
+
threshold: { type: "number" },
|
|
500
|
+
windowMinutes: { type: "integer", minimum: 5, maximum: 43200 },
|
|
501
|
+
comparator: { type: "string", enum: [">", "<", ">=", "<="] },
|
|
502
|
+
},
|
|
503
|
+
},
|
|
504
|
+
},
|
|
505
|
+
},
|
|
506
|
+
},
|
|
507
|
+
},
|
|
508
|
+
},
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
name: "delete_alert",
|
|
512
|
+
description: "alert を 削除する (= DELETE /v1/alerts/:id)。 関連する alert_events も CASCADE 削除される。 " +
|
|
513
|
+
"誤削除防御のため、 必要に応じて事前に get_alert で 詳細確認を推奨。 " +
|
|
514
|
+
"alert を一時停止したいだけなら delete でなく silence_alert (= ミュート) または update_alert で " +
|
|
515
|
+
"enabled=false を 推奨 (= 復活可能)。",
|
|
516
|
+
inputSchema: {
|
|
517
|
+
type: "object",
|
|
518
|
+
additionalProperties: false,
|
|
519
|
+
required: ["alertId"],
|
|
520
|
+
properties: {
|
|
521
|
+
alertId: {
|
|
522
|
+
type: "string",
|
|
523
|
+
description: "対象 alert の ID (= list_alerts で取得)",
|
|
524
|
+
pattern: "^[A-Za-z0-9-]{1,64}$",
|
|
525
|
+
},
|
|
526
|
+
},
|
|
527
|
+
},
|
|
528
|
+
},
|
|
356
529
|
{
|
|
357
530
|
name: "get_alert",
|
|
358
531
|
description: "指定 alert の詳細設定と直近の trigger 履歴を返す。 list_alerts で得た alertId を渡す。 " +
|
|
@@ -478,6 +651,95 @@ export const tools = [
|
|
|
478
651
|
},
|
|
479
652
|
},
|
|
480
653
|
},
|
|
654
|
+
{
|
|
655
|
+
name: "create_annotation",
|
|
656
|
+
description: "LLM call に対する新規 annotation (= human review / ラベル付け) を作成する。 " +
|
|
657
|
+
"annotationText / label / qualityScore のうち少なくとも 1 つを指定する (= 「空 annotation」 は backend で 400)。 " +
|
|
658
|
+
"用例: 「Claude、 この call を 『badly-summarized』 ラベルで quality 2 にして」、 " +
|
|
659
|
+
"「eval ループ用に positive / negative の 二極ラベルを 大量付与する」。 " +
|
|
660
|
+
"eval baseline runner (= run_eval) と 組み合わせると、 annotation を ground truth として 評価軸 を 校正できる。",
|
|
661
|
+
inputSchema: {
|
|
662
|
+
type: "object",
|
|
663
|
+
additionalProperties: false,
|
|
664
|
+
required: ["callId"],
|
|
665
|
+
properties: {
|
|
666
|
+
callId: {
|
|
667
|
+
type: "string",
|
|
668
|
+
description: "対象 call の id (= query_calls.records[].id)",
|
|
669
|
+
pattern: "^[A-Za-z0-9_-]{1,128}$",
|
|
670
|
+
},
|
|
671
|
+
annotationText: {
|
|
672
|
+
type: "string",
|
|
673
|
+
description: "自由記述コメント (0-2000 文字)。 backend で長さ validation",
|
|
674
|
+
maxLength: 2000,
|
|
675
|
+
},
|
|
676
|
+
label: {
|
|
677
|
+
type: "string",
|
|
678
|
+
description: "ラベル (0-50 文字、 英数 + _ - のみ)。 dashboard filter で 使える",
|
|
679
|
+
maxLength: 50,
|
|
680
|
+
pattern: "^[A-Za-z0-9_-]{0,50}$",
|
|
681
|
+
},
|
|
682
|
+
qualityScore: {
|
|
683
|
+
type: "integer",
|
|
684
|
+
description: "品質スコア (= 1-5 integer)。 省略で NULL",
|
|
685
|
+
minimum: 1,
|
|
686
|
+
maximum: 5,
|
|
687
|
+
},
|
|
688
|
+
},
|
|
689
|
+
},
|
|
690
|
+
},
|
|
691
|
+
{
|
|
692
|
+
name: "update_annotation",
|
|
693
|
+
description: "既存 annotation の annotationText / label / qualityScore を 部分更新する (= PATCH /v1/annotations/:id)。 " +
|
|
694
|
+
"callId は immutable。 「ラベルを 修正したい」 「qualityScore を 再評価して 4 → 5 に上げる」 用途。 " +
|
|
695
|
+
"annotation_id は list_annotations_for_call で取得した annotations[].id を渡す。",
|
|
696
|
+
inputSchema: {
|
|
697
|
+
type: "object",
|
|
698
|
+
additionalProperties: false,
|
|
699
|
+
required: ["annotationId"],
|
|
700
|
+
properties: {
|
|
701
|
+
annotationId: {
|
|
702
|
+
type: "integer",
|
|
703
|
+
description: "対象 annotation の id (= AUTOINCREMENT 数値)",
|
|
704
|
+
minimum: 1,
|
|
705
|
+
},
|
|
706
|
+
annotationText: {
|
|
707
|
+
type: "string",
|
|
708
|
+
description: "新しいコメント (0-2000 文字)。 省略で 既存値維持",
|
|
709
|
+
maxLength: 2000,
|
|
710
|
+
},
|
|
711
|
+
label: {
|
|
712
|
+
type: "string",
|
|
713
|
+
description: "新しいラベル (0-50 文字、 英数 + _ - のみ)。 省略で 既存値維持",
|
|
714
|
+
maxLength: 50,
|
|
715
|
+
pattern: "^[A-Za-z0-9_-]{0,50}$",
|
|
716
|
+
},
|
|
717
|
+
qualityScore: {
|
|
718
|
+
type: "integer",
|
|
719
|
+
description: "新しい品質スコア (= 1-5)。 省略で 既存値維持",
|
|
720
|
+
minimum: 1,
|
|
721
|
+
maximum: 5,
|
|
722
|
+
},
|
|
723
|
+
},
|
|
724
|
+
},
|
|
725
|
+
},
|
|
726
|
+
{
|
|
727
|
+
name: "delete_annotation",
|
|
728
|
+
description: "annotation を 削除する (= DELETE /v1/annotations/:id)。 関連 row は他に存在しないので CASCADE 影響なし。 " +
|
|
729
|
+
"誤削除防御のため、 必要に応じて事前に get_annotation で 詳細確認を推奨。",
|
|
730
|
+
inputSchema: {
|
|
731
|
+
type: "object",
|
|
732
|
+
additionalProperties: false,
|
|
733
|
+
required: ["annotationId"],
|
|
734
|
+
properties: {
|
|
735
|
+
annotationId: {
|
|
736
|
+
type: "integer",
|
|
737
|
+
description: "対象 annotation の id (= AUTOINCREMENT 数値)",
|
|
738
|
+
minimum: 1,
|
|
739
|
+
},
|
|
740
|
+
},
|
|
741
|
+
},
|
|
742
|
+
},
|
|
481
743
|
{
|
|
482
744
|
name: "list_eval_criteria",
|
|
483
745
|
description: "LLM-as-judge の評価軸 (criteria) 一覧を返す。 global default 5 軸 " +
|
|
@@ -510,6 +772,177 @@ export const tools = [
|
|
|
510
772
|
},
|
|
511
773
|
},
|
|
512
774
|
},
|
|
775
|
+
{
|
|
776
|
+
name: "create_eval_criterion",
|
|
777
|
+
description: "自 account custom eval criterion を 1 件作成する (= Pro+ 専用、 v1.6 #13-2)。 " +
|
|
778
|
+
"name + rubric + scaleMin + scaleMax の 4 field 全部必須。 同 account 内で 同 name 既存 = 409。 " +
|
|
779
|
+
"global default と同 name は 構造的に重複可 (= UNIQUE (account_id, name) で account_id IS NULL と分離)。 " +
|
|
780
|
+
"AI agent が dogfood eval で 「この基準を追加」 と判断した時の axis 1 path。",
|
|
781
|
+
inputSchema: {
|
|
782
|
+
type: "object",
|
|
783
|
+
additionalProperties: false,
|
|
784
|
+
required: ["name", "rubric", "scaleMin", "scaleMax"],
|
|
785
|
+
properties: {
|
|
786
|
+
name: {
|
|
787
|
+
type: "string",
|
|
788
|
+
description: "criterion 名 (= 1-50 文字、 英数始まり、 [A-Za-z0-9 _\\-.] のみ)。 例 'helpfulness' / 'concise'",
|
|
789
|
+
pattern: "^[A-Za-z0-9][A-Za-z0-9 _\\-.]{0,49}$",
|
|
790
|
+
minLength: 1,
|
|
791
|
+
maxLength: 50,
|
|
792
|
+
},
|
|
793
|
+
rubric: {
|
|
794
|
+
type: "string",
|
|
795
|
+
description: "scoring rubric 本文 (= 10-2000 文字、 judge LLM が score の根拠とする narrative)",
|
|
796
|
+
minLength: 10,
|
|
797
|
+
maxLength: 2000,
|
|
798
|
+
},
|
|
799
|
+
scaleMin: {
|
|
800
|
+
type: "integer",
|
|
801
|
+
description: "score 下限 (= 1-100 範囲、 scaleMax より小さい)",
|
|
802
|
+
minimum: 1,
|
|
803
|
+
maximum: 100,
|
|
804
|
+
},
|
|
805
|
+
scaleMax: {
|
|
806
|
+
type: "integer",
|
|
807
|
+
description: "score 上限 (= 1-100 範囲、 scaleMin より大きい)",
|
|
808
|
+
minimum: 1,
|
|
809
|
+
maximum: 100,
|
|
810
|
+
},
|
|
811
|
+
},
|
|
812
|
+
},
|
|
813
|
+
},
|
|
814
|
+
{
|
|
815
|
+
name: "update_eval_criterion",
|
|
816
|
+
description: "自 account custom criterion を full replace で更新する (= Pro+ 専用、 PATCH /v1/eval-criteria/:id)。 " +
|
|
817
|
+
"name + rubric + scaleMin + scaleMax の 4 field 全部必須 (= 部分更新ではない、 全 field 上書き)。 " +
|
|
818
|
+
"global default (= account_id IS NULL) は 構造的に対象外 (= 404)、 他 account の custom も 404。 " +
|
|
819
|
+
"同 account 内 で 同 name 衝突 = 409。",
|
|
820
|
+
inputSchema: {
|
|
821
|
+
type: "object",
|
|
822
|
+
additionalProperties: false,
|
|
823
|
+
required: ["criterionId", "name", "rubric", "scaleMin", "scaleMax"],
|
|
824
|
+
properties: {
|
|
825
|
+
criterionId: {
|
|
826
|
+
type: "integer",
|
|
827
|
+
description: "対象 criterion の id (= list_eval_criteria.criteria[].id)",
|
|
828
|
+
minimum: 1,
|
|
829
|
+
},
|
|
830
|
+
name: {
|
|
831
|
+
type: "string",
|
|
832
|
+
description: "新 name (= 1-50 文字、 英数始まり、 [A-Za-z0-9 _\\-.] のみ)",
|
|
833
|
+
pattern: "^[A-Za-z0-9][A-Za-z0-9 _\\-.]{0,49}$",
|
|
834
|
+
minLength: 1,
|
|
835
|
+
maxLength: 50,
|
|
836
|
+
},
|
|
837
|
+
rubric: {
|
|
838
|
+
type: "string",
|
|
839
|
+
description: "新 rubric (= 10-2000 文字)",
|
|
840
|
+
minLength: 10,
|
|
841
|
+
maxLength: 2000,
|
|
842
|
+
},
|
|
843
|
+
scaleMin: {
|
|
844
|
+
type: "integer",
|
|
845
|
+
description: "新 scaleMin (= 1-100、 scaleMax より小さい)",
|
|
846
|
+
minimum: 1,
|
|
847
|
+
maximum: 100,
|
|
848
|
+
},
|
|
849
|
+
scaleMax: {
|
|
850
|
+
type: "integer",
|
|
851
|
+
description: "新 scaleMax (= 1-100、 scaleMin より大きい)",
|
|
852
|
+
minimum: 1,
|
|
853
|
+
maximum: 100,
|
|
854
|
+
},
|
|
855
|
+
},
|
|
856
|
+
},
|
|
857
|
+
},
|
|
858
|
+
{
|
|
859
|
+
name: "get_llm_budget",
|
|
860
|
+
description: "現在の LLM feature 月予算 (= safety classifier + PII 二次 audit + eval baseline runner の 3 軸 LLM cost cap) を取得する (= v1.6 #13-7)。 " +
|
|
861
|
+
"response = { budgetUsd, spentUsd, remainingUsd, periodStart, defaultBudgetUsd, minBudgetUsd, maxBudgetUsd }。 " +
|
|
862
|
+
"Free / Pro+ 共通で読み取り可能、 「予算 80% 到達したか?」 「raise すべきか?」 を AI agent が 判断する path で使う。 " +
|
|
863
|
+
"default = $5/月、 月跨ぎ (= YYYY-MM 単位) で 自動 reset。",
|
|
864
|
+
inputSchema: {
|
|
865
|
+
type: "object",
|
|
866
|
+
additionalProperties: false,
|
|
867
|
+
properties: {},
|
|
868
|
+
},
|
|
869
|
+
},
|
|
870
|
+
{
|
|
871
|
+
name: "raise_llm_budget",
|
|
872
|
+
description: "LLM feature 月予算 を 引き上げる / 引き下げる (= Pro+ 専用、 v1.6 #13-7)。 " +
|
|
873
|
+
"range = $5 - $500 (= hard cap で runaway 防御)、 0.01 USD 単位。 既存 spent は そのまま carry、 月跨ぎ で 自動 reset。 " +
|
|
874
|
+
"用例: 「予算が 80% 到達した、 今月だけ $30 に上げて」 / 「使いすぎたから来月は $10 に下げて」。 " +
|
|
875
|
+
"新規 値 < 現 spent でも accept (= remaining が 0 になるだけ、 月跨ぎで 0 から計上 carry)。",
|
|
876
|
+
inputSchema: {
|
|
877
|
+
type: "object",
|
|
878
|
+
additionalProperties: false,
|
|
879
|
+
required: ["budgetUsd"],
|
|
880
|
+
properties: {
|
|
881
|
+
budgetUsd: {
|
|
882
|
+
type: "number",
|
|
883
|
+
description: "新 月予算 USD (= 5-500、 0.01 単位)。 例 30 / 50.5 / 100",
|
|
884
|
+
minimum: 5,
|
|
885
|
+
maximum: 500,
|
|
886
|
+
},
|
|
887
|
+
},
|
|
888
|
+
},
|
|
889
|
+
},
|
|
890
|
+
{
|
|
891
|
+
name: "test_webhook",
|
|
892
|
+
description: "指定 URL に 1 件 fabricated alert を 試送する (= Pro+ 専用、 v1.6 #13-5)。 " +
|
|
893
|
+
"user が webhook URL を 登録する 前 に 「届くか」 を 確認する 主用途。 " +
|
|
894
|
+
"SSRF 防御で https 必須 + private / loopback / cloud metadata IP は reject。 " +
|
|
895
|
+
"secret 指定時は HMAC-SHA256 署名 (= X-Argosvix-Signature) を 添付。 " +
|
|
896
|
+
"rate limit = account 単位 5/分 (= 60s sliding window、 worker instance 越境で 超過余地あり)。 " +
|
|
897
|
+
"response.delivered = receiver が 5s 以内に 2xx 返した か。 false の場合は 「URL 不正 / timeout / 5xx / network error」 のいずれか。",
|
|
898
|
+
inputSchema: {
|
|
899
|
+
type: "object",
|
|
900
|
+
additionalProperties: false,
|
|
901
|
+
required: ["url"],
|
|
902
|
+
properties: {
|
|
903
|
+
url: {
|
|
904
|
+
type: "string",
|
|
905
|
+
description: "送信先 webhook URL (= https、 SSRF 防御済、 1-500 chars)",
|
|
906
|
+
minLength: 1,
|
|
907
|
+
maxLength: 500,
|
|
908
|
+
},
|
|
909
|
+
secret: {
|
|
910
|
+
type: "string",
|
|
911
|
+
description: "HMAC-SHA256 署名用 secret (= 任意、 1-256 chars、 receiver 側で X-Argosvix-Signature 検証)",
|
|
912
|
+
minLength: 1,
|
|
913
|
+
maxLength: 256,
|
|
914
|
+
},
|
|
915
|
+
alertName: {
|
|
916
|
+
type: "string",
|
|
917
|
+
description: "fabricated alert の name (= 任意、 1-64 chars、 [A-Za-z0-9 _\\-.] のみ)。 省略時は 'argosvix test alert'",
|
|
918
|
+
pattern: "^[A-Za-z0-9][A-Za-z0-9 _\\-.]{0,63}$",
|
|
919
|
+
minLength: 1,
|
|
920
|
+
maxLength: 64,
|
|
921
|
+
},
|
|
922
|
+
},
|
|
923
|
+
},
|
|
924
|
+
},
|
|
925
|
+
{
|
|
926
|
+
name: "delete_eval_criterion",
|
|
927
|
+
description: "自 account custom criterion を 削除する (= Pro+ 専用、 DELETE /v1/eval-criteria/:id、 204)。 " +
|
|
928
|
+
"global default (= account_id IS NULL) は 構造防御で対象外 = 404、 他 account も 404。 " +
|
|
929
|
+
"⚠ 過去全 eval_run の 該当 criterion score 行 (= eval_scores) も ON DELETE CASCADE で 同時に物理削除される、 " +
|
|
930
|
+
"履歴比較や score 推移分析が 永久に不可になる。 " +
|
|
931
|
+
"AI agent が 「criterion 整理」 で 軽い気持ちで 呼ぶ tool ではない、 過去 run の 該当 score が要らないと user が明示確認した時のみ carry。 " +
|
|
932
|
+
"rename したい だけ なら update_eval_criterion (= full replace) で name + rubric + scaleMin + scaleMax を carry する 方が 履歴を 失わずに 済む。",
|
|
933
|
+
inputSchema: {
|
|
934
|
+
type: "object",
|
|
935
|
+
additionalProperties: false,
|
|
936
|
+
required: ["criterionId"],
|
|
937
|
+
properties: {
|
|
938
|
+
criterionId: {
|
|
939
|
+
type: "integer",
|
|
940
|
+
description: "対象 criterion の id (= list_eval_criteria.criteria[].id)",
|
|
941
|
+
minimum: 1,
|
|
942
|
+
},
|
|
943
|
+
},
|
|
944
|
+
},
|
|
945
|
+
},
|
|
513
946
|
{
|
|
514
947
|
name: "list_prompts",
|
|
515
948
|
description: "user が登録した prompt template の一覧を返す (= migration 0038 prompt_registry、 v1.5 Round F)。 " +
|
|
@@ -559,6 +992,139 @@ export const tools = [
|
|
|
559
992
|
},
|
|
560
993
|
},
|
|
561
994
|
},
|
|
995
|
+
{
|
|
996
|
+
name: "create_prompt",
|
|
997
|
+
description: "新 prompt template を 1 件登録する (= Pro+ 専用、 v1.6 #13-1)。 name + version + template が 必須、 " +
|
|
998
|
+
"variables / labels / description は 任意。 同 (name, version) が 既存 = 409 を 返す (= UNIQUE 制約)。 " +
|
|
999
|
+
"AI agent が dogfood eval / experiment 用に template を 自動登録する path で 使う。",
|
|
1000
|
+
inputSchema: {
|
|
1001
|
+
type: "object",
|
|
1002
|
+
additionalProperties: false,
|
|
1003
|
+
required: ["name", "version", "template"],
|
|
1004
|
+
properties: {
|
|
1005
|
+
name: {
|
|
1006
|
+
type: "string",
|
|
1007
|
+
description: "prompt 名 (= 同 series 識別子、 [A-Za-z0-9][A-Za-z0-9_-]{0,63})。 例 'customer_support'",
|
|
1008
|
+
pattern: "^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$",
|
|
1009
|
+
},
|
|
1010
|
+
version: {
|
|
1011
|
+
type: "string",
|
|
1012
|
+
description: "version 識別子 (= [A-Za-z0-9][A-Za-z0-9._-]{0,63})。 例 'v1' / '1.0.2' / '2026-06-03'",
|
|
1013
|
+
pattern: "^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$",
|
|
1014
|
+
},
|
|
1015
|
+
template: {
|
|
1016
|
+
type: "string",
|
|
1017
|
+
description: "prompt body 本文 (= 非空、 最大 50000 文字)。 {{var}} で variables 補完。",
|
|
1018
|
+
minLength: 1,
|
|
1019
|
+
maxLength: 50000,
|
|
1020
|
+
},
|
|
1021
|
+
variables: {
|
|
1022
|
+
type: "object",
|
|
1023
|
+
description: "template 内 {{var}} の default 値 (= plain object、 JSON 化後 4096 bytes 上限)。 任意。",
|
|
1024
|
+
additionalProperties: true,
|
|
1025
|
+
},
|
|
1026
|
+
labels: {
|
|
1027
|
+
type: "array",
|
|
1028
|
+
description: "label 配列 (= 最大 8 件、 各 [A-Za-z0-9][A-Za-z0-9_-]{0,31})。 例 ['production', 'staging']。",
|
|
1029
|
+
items: { type: "string", pattern: "^[A-Za-z0-9][A-Za-z0-9_-]{0,31}$" },
|
|
1030
|
+
maxItems: 8,
|
|
1031
|
+
},
|
|
1032
|
+
description: {
|
|
1033
|
+
type: "string",
|
|
1034
|
+
description: "説明文 (= 最大 500 文字)。 任意。",
|
|
1035
|
+
maxLength: 500,
|
|
1036
|
+
},
|
|
1037
|
+
},
|
|
1038
|
+
},
|
|
1039
|
+
},
|
|
1040
|
+
{
|
|
1041
|
+
name: "update_prompt",
|
|
1042
|
+
description: "既存 prompt の template / variables / labels / description を 部分更新する (= Pro+ 専用、 PATCH /v1/prompts/:id)。 " +
|
|
1043
|
+
"name + version は immutable (= 変更は rename_prompt 経由)。 promptId 必須、 残 field は 指定 した もの のみ 更新。 " +
|
|
1044
|
+
"AI agent が label の付け替え (= 'staging' → 'production' 昇格) や 微修正 patch path で 使う。",
|
|
1045
|
+
inputSchema: {
|
|
1046
|
+
type: "object",
|
|
1047
|
+
additionalProperties: false,
|
|
1048
|
+
required: ["promptId"],
|
|
1049
|
+
properties: {
|
|
1050
|
+
promptId: {
|
|
1051
|
+
type: "integer",
|
|
1052
|
+
description: "対象 prompt の id (= list_prompts.prompts[].id)",
|
|
1053
|
+
minimum: 1,
|
|
1054
|
+
},
|
|
1055
|
+
template: {
|
|
1056
|
+
type: "string",
|
|
1057
|
+
description: "新 template 本文 (= 非空、 最大 50000 文字)。",
|
|
1058
|
+
minLength: 1,
|
|
1059
|
+
maxLength: 50000,
|
|
1060
|
+
},
|
|
1061
|
+
variables: {
|
|
1062
|
+
type: "object",
|
|
1063
|
+
description: "新 variables (= plain object、 null で 全消し)。",
|
|
1064
|
+
additionalProperties: true,
|
|
1065
|
+
},
|
|
1066
|
+
labels: {
|
|
1067
|
+
type: "array",
|
|
1068
|
+
description: "新 labels (= 完全置換、 最大 8 件、 各 [A-Za-z0-9][A-Za-z0-9_-]{0,31})。",
|
|
1069
|
+
items: { type: "string", pattern: "^[A-Za-z0-9][A-Za-z0-9_-]{0,31}$" },
|
|
1070
|
+
maxItems: 8,
|
|
1071
|
+
},
|
|
1072
|
+
description: {
|
|
1073
|
+
type: "string",
|
|
1074
|
+
description: "新 description (= 1-500 文字)。 既存 description を 明示的に clear したい場合は この field を 渡さずに 他 field のみ で PATCH する (= 空文字 '' は schema 拒否、 LLM の hallucination で 既存 description が 消える 事故防止)。",
|
|
1075
|
+
minLength: 1,
|
|
1076
|
+
maxLength: 500,
|
|
1077
|
+
},
|
|
1078
|
+
},
|
|
1079
|
+
},
|
|
1080
|
+
},
|
|
1081
|
+
{
|
|
1082
|
+
name: "rename_prompt",
|
|
1083
|
+
description: "既存 prompt の name + version を 変更する (= Pro+ 専用、 POST /v1/prompts/:id/rename)。 " +
|
|
1084
|
+
"typo 修正軸 (= 'customer_supprt' → 'customer_support') が 主用途。 同 account 内で 既存 (name, version) と 衝突 = 409。 " +
|
|
1085
|
+
"update_prompt が name/version を 変えない 規約な ので、 rename は 別 tool で 意味的分離。",
|
|
1086
|
+
inputSchema: {
|
|
1087
|
+
type: "object",
|
|
1088
|
+
additionalProperties: false,
|
|
1089
|
+
required: ["promptId", "name", "version"],
|
|
1090
|
+
properties: {
|
|
1091
|
+
promptId: {
|
|
1092
|
+
type: "integer",
|
|
1093
|
+
description: "対象 prompt の id (= list_prompts.prompts[].id)",
|
|
1094
|
+
minimum: 1,
|
|
1095
|
+
},
|
|
1096
|
+
name: {
|
|
1097
|
+
type: "string",
|
|
1098
|
+
description: "新 name (= [A-Za-z0-9][A-Za-z0-9_-]{0,63})",
|
|
1099
|
+
pattern: "^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$",
|
|
1100
|
+
},
|
|
1101
|
+
version: {
|
|
1102
|
+
type: "string",
|
|
1103
|
+
description: "新 version (= [A-Za-z0-9][A-Za-z0-9._-]{0,63})",
|
|
1104
|
+
pattern: "^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$",
|
|
1105
|
+
},
|
|
1106
|
+
},
|
|
1107
|
+
},
|
|
1108
|
+
},
|
|
1109
|
+
{
|
|
1110
|
+
name: "delete_prompt",
|
|
1111
|
+
description: "既存 prompt を 削除する (= Pro+ 専用、 DELETE /v1/prompts/:id、 204 No Content)。 " +
|
|
1112
|
+
"自 account scope (= 他 account の id は 404)。 ⚠ 物理削除な ので 復元不可、 " +
|
|
1113
|
+
"過去の eval_runs の prompt_registry_id は SET NULL になり 「どの prompt template で run したか」 の trace が失われる (= 履歴比較で 紐付き 不可)。 " +
|
|
1114
|
+
"AI agent は 「rotation で 旧 version を sunset」 で 使う 場合 でも、 過去 run trace が 残っている うちは update_prompt で labels を 'sunset' 等に carry して論理 sunset する 方が安全。",
|
|
1115
|
+
inputSchema: {
|
|
1116
|
+
type: "object",
|
|
1117
|
+
additionalProperties: false,
|
|
1118
|
+
required: ["promptId"],
|
|
1119
|
+
properties: {
|
|
1120
|
+
promptId: {
|
|
1121
|
+
type: "integer",
|
|
1122
|
+
description: "対象 prompt の id (= list_prompts.prompts[].id)",
|
|
1123
|
+
minimum: 1,
|
|
1124
|
+
},
|
|
1125
|
+
},
|
|
1126
|
+
},
|
|
1127
|
+
},
|
|
562
1128
|
{
|
|
563
1129
|
name: "list_safety_assessments",
|
|
564
1130
|
description: "safety classifier (= OpenAI Moderation cron) が 書き込んだ assessment を 一覧取得する。 " +
|
|
@@ -672,6 +1238,12 @@ export const tools = [
|
|
|
672
1238
|
description: "対象 prompt registry の id (= list_prompts.prompts[].id)。 省略 = ad-hoc run。",
|
|
673
1239
|
minimum: 1,
|
|
674
1240
|
},
|
|
1241
|
+
idempotencyKey: {
|
|
1242
|
+
type: "string",
|
|
1243
|
+
description: "retry dedup 用の opaque key (= UUID 推奨、 64 char cap)。 同 key で 60 分以内に再 POST すると 既存 run を そのまま返す。",
|
|
1244
|
+
minLength: 1,
|
|
1245
|
+
maxLength: 64,
|
|
1246
|
+
},
|
|
675
1247
|
},
|
|
676
1248
|
},
|
|
677
1249
|
},
|
|
@@ -774,6 +1346,29 @@ export async function dispatchTool(input) {
|
|
|
774
1346
|
jsonBody: safeArgs,
|
|
775
1347
|
});
|
|
776
1348
|
}
|
|
1349
|
+
case "update_alert": {
|
|
1350
|
+
// 2026-06-03 v1.6 #13-4 = PATCH /v1/alerts/:id 経由で 既存 alert を partial update。
|
|
1351
|
+
// alertId は path 直前置換、 body は残りの allowlist 済 field (= name /
|
|
1352
|
+
// thresholdValue / windowMinutes / filterProvider / filterModel /
|
|
1353
|
+
// channelKinds / channelTargets / sleepMinutes / enabled / conditions)。
|
|
1354
|
+
// alertType は schema にも入れていない (= immutable)。 backend validateUpdate が
|
|
1355
|
+
// 二重防御で最終 validation。
|
|
1356
|
+
const alertId = validateAlertId(safeArgs["alertId"]);
|
|
1357
|
+
if (!alertId) {
|
|
1358
|
+
return errorResponse("alertId required (pattern: [A-Za-z0-9-]{1,64})");
|
|
1359
|
+
}
|
|
1360
|
+
const { alertId: _ignore, ...body } = safeArgs;
|
|
1361
|
+
return await callApi(apiBase, `/v1/alerts/${encodeURIComponent(alertId)}`, {}, apiKey, { method: "PATCH", jsonBody: body });
|
|
1362
|
+
}
|
|
1363
|
+
case "delete_alert": {
|
|
1364
|
+
// 2026-06-03 v1.6 #13-4 = DELETE /v1/alerts/:id。 関連 alert_events も backend
|
|
1365
|
+
// 側で CASCADE 削除される。 body なし、 alertId のみ path 直前置換。
|
|
1366
|
+
const alertId = validateAlertId(safeArgs["alertId"]);
|
|
1367
|
+
if (!alertId) {
|
|
1368
|
+
return errorResponse("alertId required (pattern: [A-Za-z0-9-]{1,64})");
|
|
1369
|
+
}
|
|
1370
|
+
return await callApi(apiBase, `/v1/alerts/${encodeURIComponent(alertId)}`, {}, apiKey, { method: "DELETE" });
|
|
1371
|
+
}
|
|
777
1372
|
case "get_alert": {
|
|
778
1373
|
const alertId = validateAlertId(safeArgs["alertId"]);
|
|
779
1374
|
if (!alertId) {
|
|
@@ -822,6 +1417,38 @@ export async function dispatchTool(input) {
|
|
|
822
1417
|
}
|
|
823
1418
|
return await callApi(apiBase, `/v1/annotations/${encodeURIComponent(annotationId)}`, {}, apiKey);
|
|
824
1419
|
}
|
|
1420
|
+
case "create_annotation": {
|
|
1421
|
+
// 2026-06-03 v1.6 #13-3 = POST /v1/annotations。 callId は body 必須、
|
|
1422
|
+
// annotationText / label / qualityScore のうち少なくとも 1 つは backend で
|
|
1423
|
+
// validate される (= 「空 annotation」 を 400)。 safeArgs は allowlist 済。
|
|
1424
|
+
const callId = validateCallId(safeArgs["callId"]);
|
|
1425
|
+
if (!callId) {
|
|
1426
|
+
return errorResponse("callId required (pattern: [A-Za-z0-9_-]{1,128})");
|
|
1427
|
+
}
|
|
1428
|
+
return await callApi(apiBase, "/v1/annotations", {}, apiKey, {
|
|
1429
|
+
method: "POST",
|
|
1430
|
+
jsonBody: safeArgs,
|
|
1431
|
+
});
|
|
1432
|
+
}
|
|
1433
|
+
case "update_annotation": {
|
|
1434
|
+
// 2026-06-03 v1.6 #13-3 = PATCH /v1/annotations/:id with allowlisted body。
|
|
1435
|
+
// annotationId は path 直前置換、 body は残りの 3 field (= annotationText /
|
|
1436
|
+
// label / qualityScore)。 callId は immutable (= schema 不在で 二重防御)。
|
|
1437
|
+
const annotationId = validateAnnotationId(safeArgs["annotationId"]);
|
|
1438
|
+
if (!annotationId) {
|
|
1439
|
+
return errorResponse("annotationId required (positive integer up to 10 digits)");
|
|
1440
|
+
}
|
|
1441
|
+
const { annotationId: _ignore, ...body } = safeArgs;
|
|
1442
|
+
return await callApi(apiBase, `/v1/annotations/${encodeURIComponent(annotationId)}`, {}, apiKey, { method: "PATCH", jsonBody: body });
|
|
1443
|
+
}
|
|
1444
|
+
case "delete_annotation": {
|
|
1445
|
+
// 2026-06-03 v1.6 #13-3 = DELETE /v1/annotations/:id。 body なし。
|
|
1446
|
+
const annotationId = validateAnnotationId(safeArgs["annotationId"]);
|
|
1447
|
+
if (!annotationId) {
|
|
1448
|
+
return errorResponse("annotationId required (positive integer up to 10 digits)");
|
|
1449
|
+
}
|
|
1450
|
+
return await callApi(apiBase, `/v1/annotations/${encodeURIComponent(annotationId)}`, {}, apiKey, { method: "DELETE" });
|
|
1451
|
+
}
|
|
825
1452
|
case "list_eval_criteria": {
|
|
826
1453
|
return await callApi(apiBase, "/v1/eval-criteria", {}, apiKey);
|
|
827
1454
|
}
|
|
@@ -832,6 +1459,63 @@ export async function dispatchTool(input) {
|
|
|
832
1459
|
}
|
|
833
1460
|
return await callApi(apiBase, `/v1/eval-criteria/${encodeURIComponent(criterionId)}`, {}, apiKey);
|
|
834
1461
|
}
|
|
1462
|
+
case "create_eval_criterion": {
|
|
1463
|
+
if (typeof safeArgs["name"] !== "string" ||
|
|
1464
|
+
typeof safeArgs["rubric"] !== "string" ||
|
|
1465
|
+
typeof safeArgs["scaleMin"] !== "number" ||
|
|
1466
|
+
typeof safeArgs["scaleMax"] !== "number") {
|
|
1467
|
+
return errorResponse("name + rubric + scaleMin + scaleMax required");
|
|
1468
|
+
}
|
|
1469
|
+
return await callApi(apiBase, "/v1/eval-criteria", {}, apiKey, {
|
|
1470
|
+
method: "POST",
|
|
1471
|
+
jsonBody: safeArgs,
|
|
1472
|
+
});
|
|
1473
|
+
}
|
|
1474
|
+
case "update_eval_criterion": {
|
|
1475
|
+
const criterionId = validateAnnotationId(safeArgs["criterionId"]);
|
|
1476
|
+
if (!criterionId) {
|
|
1477
|
+
return errorResponse("criterionId required (positive integer up to 10 digits)");
|
|
1478
|
+
}
|
|
1479
|
+
if (typeof safeArgs["name"] !== "string" ||
|
|
1480
|
+
typeof safeArgs["rubric"] !== "string" ||
|
|
1481
|
+
typeof safeArgs["scaleMin"] !== "number" ||
|
|
1482
|
+
typeof safeArgs["scaleMax"] !== "number") {
|
|
1483
|
+
return errorResponse("name + rubric + scaleMin + scaleMax required");
|
|
1484
|
+
}
|
|
1485
|
+
const { criterionId: _ignore, ...body } = safeArgs;
|
|
1486
|
+
return await callApi(apiBase, `/v1/eval-criteria/${encodeURIComponent(criterionId)}`, {}, apiKey, {
|
|
1487
|
+
method: "PATCH",
|
|
1488
|
+
jsonBody: body,
|
|
1489
|
+
});
|
|
1490
|
+
}
|
|
1491
|
+
case "delete_eval_criterion": {
|
|
1492
|
+
const criterionId = validateAnnotationId(safeArgs["criterionId"]);
|
|
1493
|
+
if (!criterionId) {
|
|
1494
|
+
return errorResponse("criterionId required (positive integer up to 10 digits)");
|
|
1495
|
+
}
|
|
1496
|
+
return await callApi(apiBase, `/v1/eval-criteria/${encodeURIComponent(criterionId)}`, {}, apiKey, { method: "DELETE" });
|
|
1497
|
+
}
|
|
1498
|
+
case "test_webhook": {
|
|
1499
|
+
if (typeof safeArgs["url"] !== "string") {
|
|
1500
|
+
return errorResponse("url required (https://...)");
|
|
1501
|
+
}
|
|
1502
|
+
return await callApi(apiBase, "/v1/alerts/test-webhook", {}, apiKey, {
|
|
1503
|
+
method: "POST",
|
|
1504
|
+
jsonBody: safeArgs,
|
|
1505
|
+
});
|
|
1506
|
+
}
|
|
1507
|
+
case "get_llm_budget": {
|
|
1508
|
+
return await callApi(apiBase, "/v1/account/llm-feature-budget", {}, apiKey);
|
|
1509
|
+
}
|
|
1510
|
+
case "raise_llm_budget": {
|
|
1511
|
+
if (typeof safeArgs["budgetUsd"] !== "number") {
|
|
1512
|
+
return errorResponse("budgetUsd required (number, 5-500)");
|
|
1513
|
+
}
|
|
1514
|
+
return await callApi(apiBase, "/v1/account/llm-feature-budget", {}, apiKey, {
|
|
1515
|
+
method: "PATCH",
|
|
1516
|
+
jsonBody: safeArgs,
|
|
1517
|
+
});
|
|
1518
|
+
}
|
|
835
1519
|
case "list_prompts": {
|
|
836
1520
|
const q = {};
|
|
837
1521
|
if (typeof safeArgs["label"] === "string")
|
|
@@ -849,6 +1533,46 @@ export async function dispatchTool(input) {
|
|
|
849
1533
|
}
|
|
850
1534
|
return await callApi(apiBase, `/v1/prompts/${encodeURIComponent(promptId)}`, {}, apiKey);
|
|
851
1535
|
}
|
|
1536
|
+
case "create_prompt": {
|
|
1537
|
+
if (typeof safeArgs["name"] !== "string" || typeof safeArgs["version"] !== "string" || typeof safeArgs["template"] !== "string") {
|
|
1538
|
+
return errorResponse("name + version + template required");
|
|
1539
|
+
}
|
|
1540
|
+
return await callApi(apiBase, "/v1/prompts", {}, apiKey, {
|
|
1541
|
+
method: "POST",
|
|
1542
|
+
jsonBody: safeArgs,
|
|
1543
|
+
});
|
|
1544
|
+
}
|
|
1545
|
+
case "update_prompt": {
|
|
1546
|
+
const promptId = validateAnnotationId(safeArgs["promptId"]);
|
|
1547
|
+
if (!promptId) {
|
|
1548
|
+
return errorResponse("promptId required (positive integer up to 10 digits)");
|
|
1549
|
+
}
|
|
1550
|
+
const { promptId: _ignore, ...body } = safeArgs;
|
|
1551
|
+
return await callApi(apiBase, `/v1/prompts/${encodeURIComponent(promptId)}`, {}, apiKey, {
|
|
1552
|
+
method: "PATCH",
|
|
1553
|
+
jsonBody: body,
|
|
1554
|
+
});
|
|
1555
|
+
}
|
|
1556
|
+
case "rename_prompt": {
|
|
1557
|
+
const promptId = validateAnnotationId(safeArgs["promptId"]);
|
|
1558
|
+
if (!promptId) {
|
|
1559
|
+
return errorResponse("promptId required (positive integer up to 10 digits)");
|
|
1560
|
+
}
|
|
1561
|
+
if (typeof safeArgs["name"] !== "string" || typeof safeArgs["version"] !== "string") {
|
|
1562
|
+
return errorResponse("name + version required");
|
|
1563
|
+
}
|
|
1564
|
+
return await callApi(apiBase, `/v1/prompts/${encodeURIComponent(promptId)}/rename`, {}, apiKey, {
|
|
1565
|
+
method: "POST",
|
|
1566
|
+
jsonBody: { name: safeArgs["name"], version: safeArgs["version"] },
|
|
1567
|
+
});
|
|
1568
|
+
}
|
|
1569
|
+
case "delete_prompt": {
|
|
1570
|
+
const promptId = validateAnnotationId(safeArgs["promptId"]);
|
|
1571
|
+
if (!promptId) {
|
|
1572
|
+
return errorResponse("promptId required (positive integer up to 10 digits)");
|
|
1573
|
+
}
|
|
1574
|
+
return await callApi(apiBase, `/v1/prompts/${encodeURIComponent(promptId)}`, {}, apiKey, { method: "DELETE" });
|
|
1575
|
+
}
|
|
852
1576
|
case "list_safety_assessments": {
|
|
853
1577
|
const q = {};
|
|
854
1578
|
if (typeof safeArgs["callId"] === "string") {
|
|
@@ -891,6 +1615,8 @@ export async function dispatchTool(input) {
|
|
|
891
1615
|
body["label"] = safeArgs["label"];
|
|
892
1616
|
if (typeof safeArgs["promptRegistryId"] === "number")
|
|
893
1617
|
body["promptRegistryId"] = safeArgs["promptRegistryId"];
|
|
1618
|
+
if (typeof safeArgs["idempotencyKey"] === "string")
|
|
1619
|
+
body["idempotencyKey"] = safeArgs["idempotencyKey"];
|
|
894
1620
|
return await callApi(apiBase, "/v1/eval-runs", {}, apiKey, {
|
|
895
1621
|
method: "POST",
|
|
896
1622
|
jsonBody: body,
|