@bighub/bighub-mcp 0.2.0 → 0.2.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/README.md +335 -28
- package/dist/index.js +2 -2
- package/dist/registerTools.js +367 -49
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @bighub/bighub-mcp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**BIGHUB's decision layer as an MCP server. Evaluate agent actions, receive structured recommendations, report outcomes, and improve future decisions — from any MCP-compatible client.**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
> MCP server for decision learning on agent actions.
|
|
6
6
|
|
|
7
7
|
```text
|
|
8
8
|
MCP client
|
|
@@ -11,11 +11,32 @@ MCP client
|
|
|
11
11
|
↓
|
|
12
12
|
BIGHUB API
|
|
13
13
|
↓
|
|
14
|
-
evaluate
|
|
14
|
+
evaluate → recommend → agent acts → report outcome → learn
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
---
|
|
18
18
|
|
|
19
|
+
## Table of contents
|
|
20
|
+
|
|
21
|
+
**Start here**
|
|
22
|
+
|
|
23
|
+
- [Install](#install)
|
|
24
|
+
- [Quickstart](#quickstart)
|
|
25
|
+
- [When to use bighub-mcp](#when-to-use-bighub-mcp)
|
|
26
|
+
- [Typical MCP Loop](#typical-mcp-loop)
|
|
27
|
+
- [Structured recommendation](#structured-recommendation)
|
|
28
|
+
- [Trajectory-aware evaluation](#trajectory-aware-evaluation)
|
|
29
|
+
|
|
30
|
+
**Tool reference**
|
|
31
|
+
|
|
32
|
+
- [Core loop](#core-loop) · [Actions](#actions) · [Outcomes](#outcomes) · [Decision cases](#decision-cases) · [Precedents](#precedents) · [Calibration](#calibration) · [Multi-signal retrieval](#multi-signal-retrieval) · [Insights](#insights) · [Simulations](#simulations) · [Learning](#learning) · [Features](#features) · [Runtime ingestion](#runtime-ingestion) · [Operating constraints](#operating-constraints) · [Approvals & kill switch](#approvals--kill-switch) · [Events](#events) · [Webhooks](#webhooks) · [API keys](#api-keys) · [Auth](#auth) · [Utility](#utility)
|
|
33
|
+
|
|
34
|
+
**Reference**
|
|
35
|
+
|
|
36
|
+
- [Environment Variables](#environment-variables) · [Free BETA](#free-beta) · [Local Development](#local-development) · [Links](#links)
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
19
40
|
## Install
|
|
20
41
|
|
|
21
42
|
```bash
|
|
@@ -60,44 +81,330 @@ Works with MCP-compatible clients such as Claude Desktop and Cursor.
|
|
|
60
81
|
|
|
61
82
|
---
|
|
62
83
|
|
|
63
|
-
##
|
|
84
|
+
## When to use bighub-mcp
|
|
64
85
|
|
|
65
|
-
|
|
86
|
+
Use this server when your MCP-connected agent performs actions that:
|
|
66
87
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
| `bighub_precedents_query` | Retrieve similar past cases |
|
|
72
|
-
| `bighub_calibration_report` | Compare prediction vs reality |
|
|
73
|
-
| `bighub_insights_advise` | Retrieve learned guidance for the next action |
|
|
88
|
+
- **Have real consequences** — financial, operational, or reputational impact
|
|
89
|
+
- **Are ambiguous or multi-step** — the right call depends on context and trajectory
|
|
90
|
+
- **Produce observable outcomes** — you can report what actually happened
|
|
91
|
+
- **Need to improve over time** — static instructions aren't enough
|
|
74
92
|
|
|
75
|
-
|
|
93
|
+
If your agent only answers questions or performs read-only lookups, you don't need this. It's designed for agents that make decisions with real-world consequences.
|
|
76
94
|
|
|
77
95
|
---
|
|
78
96
|
|
|
79
97
|
## Typical MCP Loop
|
|
80
98
|
|
|
81
|
-
1.
|
|
82
|
-
2.
|
|
83
|
-
3.
|
|
84
|
-
4.
|
|
85
|
-
5.
|
|
86
|
-
6. Use learned
|
|
87
|
-
|
|
88
|
-
Typical tool flow:
|
|
99
|
+
1. Submit a decision for evaluation
|
|
100
|
+
2. Receive a recommendation and decision signals
|
|
101
|
+
3. Let the agent or runtime act
|
|
102
|
+
4. Report the real outcome
|
|
103
|
+
5. Inspect similar past cases and calibration
|
|
104
|
+
6. Use what was learned on the next decision
|
|
89
105
|
|
|
90
106
|
```text
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
107
|
+
bighub_actions_evaluate
|
|
108
|
+
→ agent runtime acts based on recommendation
|
|
109
|
+
→ bighub_outcomes_report
|
|
110
|
+
→ bighub_precedents_query
|
|
111
|
+
→ bighub_calibration_report
|
|
112
|
+
→ bighub_insights_advise
|
|
97
113
|
```
|
|
98
114
|
|
|
99
115
|
---
|
|
100
116
|
|
|
117
|
+
## Structured recommendation
|
|
118
|
+
|
|
119
|
+
Every evaluation returns a structured recommendation — not just allow / block:
|
|
120
|
+
|
|
121
|
+
| Field | Description |
|
|
122
|
+
|---|---|
|
|
123
|
+
| `recommendation` | `proceed`, `proceed_with_caution`, `review_recommended`, `do_not_proceed` |
|
|
124
|
+
| `recommendation_confidence` | `high`, `medium`, `low` |
|
|
125
|
+
| `risk_score` | Aggregated risk (0–1) |
|
|
126
|
+
| `enforcement_mode` | `advisory`, `review`, `enforced` |
|
|
127
|
+
| `decision_intelligence` | Rationale, evidence status, trajectory health, alternatives |
|
|
128
|
+
|
|
129
|
+
Legacy fields (`allowed`, `result`, `reason`) may still appear for backward compatibility but are not the primary surface.
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Trajectory-aware evaluation
|
|
134
|
+
|
|
135
|
+
BIGHUB evaluates actions not only in isolation, but also in the context of what happened before. As outcomes accumulate, similar sequences and prior decisions improve future recommendations.
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
# Complete Tool Reference
|
|
140
|
+
|
|
141
|
+
125 tools organized by domain. The core loop tools are listed first.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Core loop
|
|
146
|
+
|
|
147
|
+
| Tool | Description |
|
|
148
|
+
|---|---|
|
|
149
|
+
| `bighub_actions_evaluate` | Submit an action for evaluation — returns recommendation, confidence, risk score |
|
|
150
|
+
| `bighub_outcomes_report` | Report what actually happened after execution |
|
|
151
|
+
| `bighub_precedents_query` | Query similar past cases |
|
|
152
|
+
| `bighub_calibration_report` | Calibration report (prediction vs reality) |
|
|
153
|
+
| `bighub_insights_advise` | Learned advisories for an action |
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Actions
|
|
158
|
+
|
|
159
|
+
| Tool | Description |
|
|
160
|
+
|---|---|
|
|
161
|
+
| `bighub_actions_evaluate` | Evaluate an action (primary entry point) |
|
|
162
|
+
| `bighub_actions_evaluate_payload` | Evaluate with a free-form payload |
|
|
163
|
+
| `bighub_actions_evaluate_batch` | Evaluate multiple actions in one request |
|
|
164
|
+
| `bighub_actions_dry_run` | Non-persistent evaluation (preview) |
|
|
165
|
+
| `bighub_actions_live_connect` | Open a live connection slot |
|
|
166
|
+
| `bighub_actions_live_heartbeat` | Heartbeat a live connection |
|
|
167
|
+
| `bighub_actions_live_disconnect` | Close a live connection |
|
|
168
|
+
| `bighub_actions_verify_validation` | Verify a validation hash |
|
|
169
|
+
| `bighub_actions_observer_stats` | Observer statistics |
|
|
170
|
+
| `bighub_actions_dashboard_summary` | Dashboard summary metrics |
|
|
171
|
+
| `bighub_actions_status` | Service status |
|
|
172
|
+
| `bighub_actions_memory_ingest` | Ingest decision memory events |
|
|
173
|
+
| `bighub_actions_memory_context` | Retrieve memory context |
|
|
174
|
+
| `bighub_actions_memory_refresh_aggregates` | Refresh memory aggregates |
|
|
175
|
+
| `bighub_actions_memory_recommendations` | Pattern-based recommendations from memory |
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Outcomes
|
|
180
|
+
|
|
181
|
+
| Tool | Description |
|
|
182
|
+
|---|---|
|
|
183
|
+
| `bighub_outcomes_report` | Report a real-world outcome |
|
|
184
|
+
| `bighub_outcomes_report_batch` | Batch report outcomes |
|
|
185
|
+
| `bighub_outcomes_get` | Get outcome by request_id |
|
|
186
|
+
| `bighub_outcomes_get_by_validation` | Get outcome by validation_id |
|
|
187
|
+
| `bighub_outcomes_get_by_case` | Get outcome by case_id |
|
|
188
|
+
| `bighub_outcomes_timeline` | Full outcome timeline |
|
|
189
|
+
| `bighub_outcomes_pending` | Decisions awaiting outcomes |
|
|
190
|
+
| `bighub_outcomes_analytics` | Outcome analytics summary |
|
|
191
|
+
| `bighub_outcomes_taxonomy` | Supported outcome statuses |
|
|
192
|
+
| `bighub_outcomes_recommendation_quality` | Follow rate, quadrants, trend, by domain/actor |
|
|
193
|
+
| `bighub_outcomes_partner_view` | Self-contained domain view with KPIs and examples |
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Decision cases
|
|
198
|
+
|
|
199
|
+
| Tool | Description |
|
|
200
|
+
|---|---|
|
|
201
|
+
| `bighub_cases_create` | Create a decision case |
|
|
202
|
+
| `bighub_cases_get` | Get a case by ID |
|
|
203
|
+
| `bighub_cases_list` | List and filter cases |
|
|
204
|
+
| `bighub_cases_report_outcome` | Report outcome for a case |
|
|
205
|
+
| `bighub_cases_precedents` | Precedent intelligence for a proposed action |
|
|
206
|
+
| `bighub_cases_calibration` | Calibration metrics for cases |
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Precedents
|
|
211
|
+
|
|
212
|
+
| Tool | Description |
|
|
213
|
+
|---|---|
|
|
214
|
+
| `bighub_precedents_query` | Query similar past cases |
|
|
215
|
+
| `bighub_precedents_signals` | Aggregated precedent signals |
|
|
216
|
+
| `bighub_precedents_stats` | Precedent index statistics |
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Calibration
|
|
221
|
+
|
|
222
|
+
| Tool | Description |
|
|
223
|
+
|---|---|
|
|
224
|
+
| `bighub_calibration_report` | Calibration report |
|
|
225
|
+
| `bighub_calibration_reliability` | Reliability diagram data |
|
|
226
|
+
| `bighub_calibration_drift` | Calibration drift over time |
|
|
227
|
+
| `bighub_calibration_breakdown` | Breakdown by domain or tool |
|
|
228
|
+
| `bighub_calibration_feedback` | Calibration feedback signals |
|
|
229
|
+
| `bighub_calibration_observe` | Submit a calibration observation |
|
|
230
|
+
| `bighub_calibration_quality_history` | Daily quality score over time |
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Multi-signal retrieval
|
|
235
|
+
|
|
236
|
+
| Tool | Description |
|
|
237
|
+
|---|---|
|
|
238
|
+
| `bighub_retrieval_query` | Multi-signal precedent retrieval |
|
|
239
|
+
| `bighub_retrieval_query_explained` | Retrieval with explanation trace |
|
|
240
|
+
| `bighub_retrieval_strategies` | List available strategies |
|
|
241
|
+
| `bighub_retrieval_strategy` | Get one strategy's details |
|
|
242
|
+
| `bighub_retrieval_index_case` | Manually index a case |
|
|
243
|
+
| `bighub_retrieval_compare` | Compare two strategies |
|
|
244
|
+
| `bighub_retrieval_stats` | Retrieval index statistics |
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## Insights
|
|
249
|
+
|
|
250
|
+
| Tool | Description |
|
|
251
|
+
|---|---|
|
|
252
|
+
| `bighub_insights_advise` | Learned advisories for an action |
|
|
253
|
+
| `bighub_insights_patterns` | Discovered risk patterns |
|
|
254
|
+
| `bighub_insights_learn` | Learning refresh |
|
|
255
|
+
| `bighub_insights_profile` | Action/tool profile |
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## Simulations
|
|
260
|
+
|
|
261
|
+
| Tool | Description |
|
|
262
|
+
|---|---|
|
|
263
|
+
| `bighub_simulations_list` | List simulation snapshots |
|
|
264
|
+
| `bighub_simulations_get` | Get a snapshot |
|
|
265
|
+
| `bighub_simulations_by_request` | Get snapshot by request |
|
|
266
|
+
| `bighub_simulations_compare` | Compare predicted vs actual |
|
|
267
|
+
| `bighub_simulations_accuracy` | Domain-level accuracy |
|
|
268
|
+
| `bighub_simulations_stats` | Simulation statistics |
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## Learning
|
|
273
|
+
|
|
274
|
+
| Tool | Description |
|
|
275
|
+
|---|---|
|
|
276
|
+
| `bighub_learning_strategy` | Current learning strategy |
|
|
277
|
+
| `bighub_learning_runs` | Recent learning runs |
|
|
278
|
+
| `bighub_learning_recompute` | Trigger learning recomputation |
|
|
279
|
+
| `bighub_learning_backfill` | Backfill learning artifacts |
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## Features
|
|
284
|
+
|
|
285
|
+
| Tool | Description |
|
|
286
|
+
|---|---|
|
|
287
|
+
| `bighub_features_compute` | Compute features for an action |
|
|
288
|
+
| `bighub_features_compute_batch` | Batch feature computation |
|
|
289
|
+
| `bighub_features_snapshot` | Create a feature snapshot |
|
|
290
|
+
| `bighub_features_get_snapshot` | Get a snapshot |
|
|
291
|
+
| `bighub_features_list_snapshots` | List snapshots |
|
|
292
|
+
| `bighub_features_explain` | Explain features for a case |
|
|
293
|
+
| `bighub_features_export` | Export features for a case |
|
|
294
|
+
| `bighub_features_export_batch` | Batch export |
|
|
295
|
+
| `bighub_features_compare` | Compare feature sets |
|
|
296
|
+
| `bighub_features_schema` | Feature schema |
|
|
297
|
+
| `bighub_features_stats` | Feature statistics |
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
## Runtime ingestion
|
|
302
|
+
|
|
303
|
+
| Tool | Description |
|
|
304
|
+
|---|---|
|
|
305
|
+
| `bighub_ingest_event` | Ingest a single event |
|
|
306
|
+
| `bighub_ingest_batch` | Ingest events in batch |
|
|
307
|
+
| `bighub_ingest_reconcile` | Reconcile outcome with event |
|
|
308
|
+
| `bighub_ingest_lifecycles` | List event lifecycles |
|
|
309
|
+
| `bighub_ingest_lifecycle` | Get lifecycle for one event |
|
|
310
|
+
| `bighub_ingest_pending` | Events pending reconciliation |
|
|
311
|
+
| `bighub_ingest_stale` | Stale unreconciled events |
|
|
312
|
+
| `bighub_ingest_stats` | Ingestion statistics |
|
|
313
|
+
| `bighub_ingest_adapters` | List available adapters |
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
317
|
+
## Operating constraints
|
|
318
|
+
|
|
319
|
+
| Tool | Description |
|
|
320
|
+
|---|---|
|
|
321
|
+
| `bighub_constraints_create` | Create a constraint |
|
|
322
|
+
| `bighub_constraints_list` | List constraints |
|
|
323
|
+
| `bighub_constraints_get` | Get a constraint |
|
|
324
|
+
| `bighub_constraints_update` | Update a constraint |
|
|
325
|
+
| `bighub_constraints_delete` | Delete a constraint |
|
|
326
|
+
| `bighub_constraints_pause` | Pause a constraint |
|
|
327
|
+
| `bighub_constraints_resume` | Resume a constraint |
|
|
328
|
+
| `bighub_constraints_dry_run` | Preview without persisting |
|
|
329
|
+
| `bighub_constraints_validate` | Validate an action against constraints |
|
|
330
|
+
| `bighub_constraints_validate_dry_run` | Validate (dry run) |
|
|
331
|
+
| `bighub_constraints_domains` | List domains with constraints |
|
|
332
|
+
| `bighub_constraints_versions` | Constraint version history |
|
|
333
|
+
| `bighub_constraints_apply_patch` | Apply a JSON Patch |
|
|
334
|
+
| `bighub_constraints_purge_idempotency` | Admin: purge idempotency keys |
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
338
|
+
## Approvals & kill switch
|
|
339
|
+
|
|
340
|
+
| Tool | Description |
|
|
341
|
+
|---|---|
|
|
342
|
+
| `bighub_approvals_list` | List approval requests |
|
|
343
|
+
| `bighub_approvals_resolve` | Resolve an approval |
|
|
344
|
+
| `bighub_kill_switch_status` | Kill switch status |
|
|
345
|
+
| `bighub_kill_switch_activate` | Activate kill switch |
|
|
346
|
+
| `bighub_kill_switch_deactivate` | Deactivate kill switch |
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
## Events
|
|
351
|
+
|
|
352
|
+
| Tool | Description |
|
|
353
|
+
|---|---|
|
|
354
|
+
| `bighub_events_list` | Query event stream |
|
|
355
|
+
| `bighub_events_stats` | Event statistics |
|
|
356
|
+
|
|
357
|
+
---
|
|
358
|
+
|
|
359
|
+
## Webhooks
|
|
360
|
+
|
|
361
|
+
| Tool | Description |
|
|
362
|
+
|---|---|
|
|
363
|
+
| `bighub_webhooks_create` | Create a webhook |
|
|
364
|
+
| `bighub_webhooks_list` | List webhooks |
|
|
365
|
+
| `bighub_webhooks_get` | Get a webhook |
|
|
366
|
+
| `bighub_webhooks_update` | Update a webhook |
|
|
367
|
+
| `bighub_webhooks_delete` | Delete a webhook |
|
|
368
|
+
| `bighub_webhooks_deliveries` | List deliveries |
|
|
369
|
+
| `bighub_webhooks_test` | Send a test delivery |
|
|
370
|
+
| `bighub_webhooks_list_events` | List subscribable event types |
|
|
371
|
+
| `bighub_webhooks_verify_signature` | Verify webhook signature |
|
|
372
|
+
| `bighub_webhooks_replay_failed_delivery` | Replay a failed delivery |
|
|
373
|
+
|
|
374
|
+
---
|
|
375
|
+
|
|
376
|
+
## API keys
|
|
377
|
+
|
|
378
|
+
| Tool | Description |
|
|
379
|
+
|---|---|
|
|
380
|
+
| `bighub_api_keys_create` | Create an API key |
|
|
381
|
+
| `bighub_api_keys_list` | List API keys |
|
|
382
|
+
| `bighub_api_keys_delete` | Delete an API key |
|
|
383
|
+
| `bighub_api_keys_rotate` | Rotate an API key |
|
|
384
|
+
| `bighub_api_keys_validate` | Validate an API key |
|
|
385
|
+
| `bighub_api_keys_scopes` | List available scopes |
|
|
386
|
+
|
|
387
|
+
---
|
|
388
|
+
|
|
389
|
+
## Auth
|
|
390
|
+
|
|
391
|
+
| Tool | Description |
|
|
392
|
+
|---|---|
|
|
393
|
+
| `bighub_auth_signup` | Create an account |
|
|
394
|
+
| `bighub_auth_login` | Log in |
|
|
395
|
+
| `bighub_auth_refresh` | Refresh token |
|
|
396
|
+
| `bighub_auth_logout` | Log out |
|
|
397
|
+
|
|
398
|
+
---
|
|
399
|
+
|
|
400
|
+
## Utility
|
|
401
|
+
|
|
402
|
+
| Tool | Description |
|
|
403
|
+
|---|---|
|
|
404
|
+
| `bighub_http_request` | Generic HTTP passthrough |
|
|
405
|
+
|
|
406
|
+
---
|
|
407
|
+
|
|
101
408
|
## Environment Variables
|
|
102
409
|
|
|
103
410
|
| Variable | Required | Default | Description |
|
|
@@ -111,7 +418,7 @@ bighub_actions_submit
|
|
|
111
418
|
|
|
112
419
|
\* One of `BIGHUB_API_KEY` or `BIGHUB_BEARER_TOKEN` is required.
|
|
113
420
|
|
|
114
|
-
|
|
421
|
+
Management tools (API keys, webhooks, auth) require user JWT auth via `BIGHUB_BEARER_TOKEN`.
|
|
115
422
|
|
|
116
423
|
---
|
|
117
424
|
|
package/dist/index.js
CHANGED
|
@@ -25,11 +25,11 @@ async function main() {
|
|
|
25
25
|
bearerToken,
|
|
26
26
|
timeoutMs: parseNumberEnv("BIGHUB_TIMEOUT_MS", 15000),
|
|
27
27
|
maxRetries: parseNumberEnv("BIGHUB_MAX_RETRIES", 2),
|
|
28
|
-
userAgent: "bighub-mcp/0.2.
|
|
28
|
+
userAgent: "bighub-mcp/0.2.1",
|
|
29
29
|
});
|
|
30
30
|
const server = new McpServer({
|
|
31
31
|
name: "bighub-mcp",
|
|
32
|
-
version: "0.2.
|
|
32
|
+
version: "0.2.1",
|
|
33
33
|
});
|
|
34
34
|
registerBighubTools(server, client);
|
|
35
35
|
const transport = new StdioServerTransport();
|
package/dist/registerTools.js
CHANGED
|
@@ -36,8 +36,8 @@ export function registerBighubTools(server, client) {
|
|
|
36
36
|
headers,
|
|
37
37
|
idempotencyKey: idempotency_key,
|
|
38
38
|
})));
|
|
39
|
-
server.registerTool("
|
|
40
|
-
description: "Evaluate an action via /actions/
|
|
39
|
+
server.registerTool("bighub_actions_evaluate", {
|
|
40
|
+
description: "Evaluate an action via /actions/evaluate — returns decision intelligence (recommendation, risk, trajectory health, alternatives).",
|
|
41
41
|
outputSchema: AnyOutputSchema,
|
|
42
42
|
inputSchema: {
|
|
43
43
|
action: z.string(),
|
|
@@ -49,14 +49,18 @@ export function registerBighubTools(server, client) {
|
|
|
49
49
|
metadata: JsonObjectSchema.optional(),
|
|
50
50
|
idempotency_key: z.string().optional(),
|
|
51
51
|
},
|
|
52
|
-
}, async ({ action, actor, value, target, domain, context, metadata, idempotency_key }) =>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
}, async ({ action, actor, value, target, domain, context, metadata, idempotency_key }) => {
|
|
53
|
+
const mergedContext = { ...(metadata || {}), ...(context || {}) };
|
|
54
|
+
const body = cleanObject({ action, actor, value, target, domain, context: Object.keys(mergedContext).length ? mergedContext : undefined });
|
|
55
|
+
return toResult(await client.request({
|
|
56
|
+
method: "POST",
|
|
57
|
+
path: "/actions/evaluate",
|
|
58
|
+
body,
|
|
59
|
+
idempotencyKey: idempotency_key,
|
|
60
|
+
}));
|
|
61
|
+
});
|
|
62
|
+
server.registerTool("bighub_actions_evaluate_payload", {
|
|
63
|
+
description: "Evaluate an action with full decision intelligence payload via /actions/evaluate.",
|
|
60
64
|
outputSchema: AnyOutputSchema,
|
|
61
65
|
inputSchema: {
|
|
62
66
|
payload: JsonObjectSchema,
|
|
@@ -64,22 +68,58 @@ export function registerBighubTools(server, client) {
|
|
|
64
68
|
},
|
|
65
69
|
}, async ({ payload, idempotency_key }) => toResult(await client.request({
|
|
66
70
|
method: "POST",
|
|
67
|
-
path: "/actions/
|
|
71
|
+
path: "/actions/evaluate",
|
|
68
72
|
body: payload,
|
|
69
73
|
idempotencyKey: idempotency_key,
|
|
70
74
|
})));
|
|
71
75
|
server.registerTool("bighub_actions_dry_run", {
|
|
72
|
-
description: "Dry-run action evaluation (non-persistent) via /actions/
|
|
76
|
+
description: "Dry-run action evaluation (non-persistent) via /actions/evaluate with dry_run=true.",
|
|
73
77
|
inputSchema: {
|
|
74
78
|
payload: JsonObjectSchema,
|
|
75
79
|
idempotency_key: z.string().optional(),
|
|
76
80
|
},
|
|
77
81
|
}, async ({ payload, idempotency_key }) => toResult(await client.request({
|
|
78
82
|
method: "POST",
|
|
79
|
-
path: "/actions/
|
|
80
|
-
body: payload,
|
|
83
|
+
path: "/actions/evaluate",
|
|
84
|
+
body: { ...payload, dry_run: true },
|
|
81
85
|
idempotencyKey: idempotency_key,
|
|
82
86
|
})));
|
|
87
|
+
server.registerTool("bighub_actions_live_connect", {
|
|
88
|
+
description: "Open a concurrent live agent connection slot. Returns connection_id to reuse for heartbeats and submits.",
|
|
89
|
+
outputSchema: AnyOutputSchema,
|
|
90
|
+
inputSchema: {
|
|
91
|
+
actor: z.string().default("AI_AGENT"),
|
|
92
|
+
context: JsonObjectSchema.optional(),
|
|
93
|
+
},
|
|
94
|
+
}, async ({ actor, context }) => toResult(await client.request({
|
|
95
|
+
method: "POST",
|
|
96
|
+
path: "/actions/live/connect",
|
|
97
|
+
body: { actor, context: context || {} },
|
|
98
|
+
})));
|
|
99
|
+
server.registerTool("bighub_actions_live_heartbeat", {
|
|
100
|
+
description: "Heartbeat an existing live agent connection to keep it alive (recommended every 40s, TTL 120s).",
|
|
101
|
+
outputSchema: AnyOutputSchema,
|
|
102
|
+
inputSchema: {
|
|
103
|
+
connection_id: z.string(),
|
|
104
|
+
context: JsonObjectSchema.optional(),
|
|
105
|
+
},
|
|
106
|
+
}, async ({ connection_id, context }) => toResult(await client.request({
|
|
107
|
+
method: "POST",
|
|
108
|
+
path: "/actions/live/heartbeat",
|
|
109
|
+
body: { connection_id, context: context || {} },
|
|
110
|
+
})));
|
|
111
|
+
server.registerTool("bighub_actions_live_disconnect", {
|
|
112
|
+
description: "Disconnect a live agent connection, freeing the slot immediately.",
|
|
113
|
+
outputSchema: AnyOutputSchema,
|
|
114
|
+
inputSchema: {
|
|
115
|
+
connection_id: z.string(),
|
|
116
|
+
context: JsonObjectSchema.optional(),
|
|
117
|
+
},
|
|
118
|
+
}, async ({ connection_id, context }) => toResult(await client.request({
|
|
119
|
+
method: "POST",
|
|
120
|
+
path: "/actions/live/disconnect",
|
|
121
|
+
body: { connection_id, context: context || {} },
|
|
122
|
+
})));
|
|
83
123
|
server.registerTool("bighub_actions_verify_validation", {
|
|
84
124
|
description: "Verify a previous evaluation by validation_id.",
|
|
85
125
|
inputSchema: { validation_id: z.string() },
|
|
@@ -176,7 +216,7 @@ export function registerBighubTools(server, client) {
|
|
|
176
216
|
path: "/actions/memory/recommendations",
|
|
177
217
|
body: cleanObject(args),
|
|
178
218
|
})));
|
|
179
|
-
server.registerTool("
|
|
219
|
+
server.registerTool("bighub_constraints_create", {
|
|
180
220
|
description: "Create a boundary rule.",
|
|
181
221
|
outputSchema: AnyOutputSchema,
|
|
182
222
|
inputSchema: {
|
|
@@ -189,7 +229,7 @@ export function registerBighubTools(server, client) {
|
|
|
189
229
|
body: payload,
|
|
190
230
|
idempotencyKey: idempotency_key,
|
|
191
231
|
})));
|
|
192
|
-
server.registerTool("
|
|
232
|
+
server.registerTool("bighub_constraints_list", {
|
|
193
233
|
description: "List boundary rules.",
|
|
194
234
|
outputSchema: AnyOutputSchema,
|
|
195
235
|
inputSchema: {
|
|
@@ -203,12 +243,12 @@ export function registerBighubTools(server, client) {
|
|
|
203
243
|
path: "/rules",
|
|
204
244
|
query: cleanObject({ status, domain, limit, offset }),
|
|
205
245
|
})));
|
|
206
|
-
server.registerTool("
|
|
246
|
+
server.registerTool("bighub_constraints_get", {
|
|
207
247
|
description: "Fetch a single rule by rule_id.",
|
|
208
248
|
outputSchema: AnyOutputSchema,
|
|
209
249
|
inputSchema: { rule_id: z.string() },
|
|
210
250
|
}, async ({ rule_id }) => toResult(await client.request({ method: "GET", path: `/rules/${rule_id}` })));
|
|
211
|
-
server.registerTool("
|
|
251
|
+
server.registerTool("bighub_constraints_update", {
|
|
212
252
|
description: "Update a rule by rule_id.",
|
|
213
253
|
outputSchema: AnyOutputSchema,
|
|
214
254
|
inputSchema: {
|
|
@@ -222,7 +262,7 @@ export function registerBighubTools(server, client) {
|
|
|
222
262
|
body: payload,
|
|
223
263
|
idempotencyKey: idempotency_key,
|
|
224
264
|
})));
|
|
225
|
-
server.registerTool("
|
|
265
|
+
server.registerTool("bighub_constraints_delete", {
|
|
226
266
|
description: "Delete a rule.",
|
|
227
267
|
inputSchema: {
|
|
228
268
|
rule_id: z.string(),
|
|
@@ -233,7 +273,7 @@ export function registerBighubTools(server, client) {
|
|
|
233
273
|
path: `/rules/${rule_id}`,
|
|
234
274
|
idempotencyKey: idempotency_key,
|
|
235
275
|
})));
|
|
236
|
-
server.registerTool("
|
|
276
|
+
server.registerTool("bighub_constraints_pause", {
|
|
237
277
|
description: "Pause a rule by rule_id.",
|
|
238
278
|
inputSchema: {
|
|
239
279
|
rule_id: z.string(),
|
|
@@ -244,7 +284,7 @@ export function registerBighubTools(server, client) {
|
|
|
244
284
|
path: `/rules/${rule_id}/pause`,
|
|
245
285
|
idempotencyKey: idempotency_key,
|
|
246
286
|
})));
|
|
247
|
-
server.registerTool("
|
|
287
|
+
server.registerTool("bighub_constraints_resume", {
|
|
248
288
|
description: "Resume a paused rule.",
|
|
249
289
|
inputSchema: {
|
|
250
290
|
rule_id: z.string(),
|
|
@@ -255,7 +295,7 @@ export function registerBighubTools(server, client) {
|
|
|
255
295
|
path: `/rules/${rule_id}/resume`,
|
|
256
296
|
idempotencyKey: idempotency_key,
|
|
257
297
|
})));
|
|
258
|
-
server.registerTool("
|
|
298
|
+
server.registerTool("bighub_constraints_dry_run", {
|
|
259
299
|
description: "Dry run a rule payload without persisting.",
|
|
260
300
|
inputSchema: {
|
|
261
301
|
payload: JsonObjectSchema,
|
|
@@ -265,7 +305,7 @@ export function registerBighubTools(server, client) {
|
|
|
265
305
|
path: "/rules/dry-run",
|
|
266
306
|
body: payload,
|
|
267
307
|
})));
|
|
268
|
-
server.registerTool("
|
|
308
|
+
server.registerTool("bighub_constraints_validate", {
|
|
269
309
|
description: "Validate a rule payload.",
|
|
270
310
|
inputSchema: {
|
|
271
311
|
payload: JsonObjectSchema,
|
|
@@ -275,7 +315,7 @@ export function registerBighubTools(server, client) {
|
|
|
275
315
|
path: "/rules/validate",
|
|
276
316
|
body: payload,
|
|
277
317
|
})));
|
|
278
|
-
server.registerTool("
|
|
318
|
+
server.registerTool("bighub_constraints_validate_dry_run", {
|
|
279
319
|
description: "Dry-run validate a rule payload.",
|
|
280
320
|
inputSchema: {
|
|
281
321
|
payload: JsonObjectSchema,
|
|
@@ -285,11 +325,11 @@ export function registerBighubTools(server, client) {
|
|
|
285
325
|
path: "/rules/validate/dry-run",
|
|
286
326
|
body: payload,
|
|
287
327
|
})));
|
|
288
|
-
server.registerTool("
|
|
328
|
+
server.registerTool("bighub_constraints_domains", {
|
|
289
329
|
description: "List available rule domains.",
|
|
290
330
|
inputSchema: {},
|
|
291
331
|
}, async () => toResult(await client.request({ method: "GET", path: "/rules/domains" })));
|
|
292
|
-
server.registerTool("
|
|
332
|
+
server.registerTool("bighub_constraints_versions", {
|
|
293
333
|
description: "List historical versions for a rule.",
|
|
294
334
|
outputSchema: AnyOutputSchema,
|
|
295
335
|
inputSchema: {
|
|
@@ -301,7 +341,7 @@ export function registerBighubTools(server, client) {
|
|
|
301
341
|
path: `/rules/${rule_id}/versions`,
|
|
302
342
|
query: cleanObject({ limit }),
|
|
303
343
|
})));
|
|
304
|
-
server.registerTool("
|
|
344
|
+
server.registerTool("bighub_constraints_purge_idempotency", {
|
|
305
345
|
description: "Purge rule idempotency records from the backend store.",
|
|
306
346
|
outputSchema: AnyOutputSchema,
|
|
307
347
|
inputSchema: {
|
|
@@ -314,7 +354,7 @@ export function registerBighubTools(server, client) {
|
|
|
314
354
|
path: "/rules/admin/idempotency/purge",
|
|
315
355
|
query: cleanObject({ only_expired, older_than_hours, limit }),
|
|
316
356
|
})));
|
|
317
|
-
server.registerTool("
|
|
357
|
+
server.registerTool("bighub_constraints_apply_patch", {
|
|
318
358
|
description: "Apply JSON Patch operations to a rule with preview/optimistic locking support.",
|
|
319
359
|
outputSchema: AnyOutputSchema,
|
|
320
360
|
inputSchema: {
|
|
@@ -370,21 +410,27 @@ export function registerBighubTools(server, client) {
|
|
|
370
410
|
inputSchema: {},
|
|
371
411
|
}, async () => toResult(await client.request({ method: "GET", path: "/kill-switch/status" })));
|
|
372
412
|
server.registerTool("bighub_kill_switch_activate", {
|
|
373
|
-
description: "Activate global/domain kill switch.",
|
|
413
|
+
description: "Activate global/domain kill switch. Requires a reason.",
|
|
374
414
|
inputSchema: {
|
|
375
|
-
|
|
415
|
+
reason: z.string().min(1).describe("Why the kill switch is being activated"),
|
|
416
|
+
scope: z.string().default("global").describe("Scope: global or domain"),
|
|
417
|
+
domain: z.string().optional().describe("Domain to target (when scope=domain)"),
|
|
418
|
+
rule_id: z.string().optional().describe("Specific rule to kill"),
|
|
376
419
|
},
|
|
377
|
-
}, async ({
|
|
420
|
+
}, async ({ reason, scope, domain, rule_id }) => toResult(await client.request({ method: "POST", path: "/kill-switch/activate", body: cleanObject({ reason, scope, domain, rule_id }) })));
|
|
378
421
|
server.registerTool("bighub_kill_switch_deactivate", {
|
|
379
|
-
description: "Deactivate kill switch by switch_id.",
|
|
422
|
+
description: "Deactivate kill switch by switch_id. Requires a reason.",
|
|
380
423
|
inputSchema: {
|
|
381
424
|
switch_id: z.string(),
|
|
382
|
-
|
|
425
|
+
reason: z.string().min(1).describe("Why the kill switch is being deactivated"),
|
|
426
|
+
scope: z.string().default("global").optional(),
|
|
427
|
+
domain: z.string().optional(),
|
|
428
|
+
rule_id: z.string().optional(),
|
|
383
429
|
},
|
|
384
|
-
}, async ({ switch_id,
|
|
430
|
+
}, async ({ switch_id, reason, scope, domain, rule_id }) => toResult(await client.request({
|
|
385
431
|
method: "POST",
|
|
386
432
|
path: `/kill-switch/deactivate/${switch_id}`,
|
|
387
|
-
body:
|
|
433
|
+
body: cleanObject({ reason, scope, domain, rule_id }),
|
|
388
434
|
})));
|
|
389
435
|
server.registerTool("bighub_events_list", {
|
|
390
436
|
description: "List event stream entries.",
|
|
@@ -553,14 +599,14 @@ export function registerBighubTools(server, client) {
|
|
|
553
599
|
// Cases — Decision case lifecycle
|
|
554
600
|
// ---------------------------------------------------------------------------
|
|
555
601
|
server.registerTool("bighub_cases_create", {
|
|
556
|
-
description: "Create a decision case.",
|
|
602
|
+
description: "Create a decision case. Requires action and verdict.",
|
|
557
603
|
outputSchema: AnyOutputSchema,
|
|
558
604
|
inputSchema: {
|
|
559
605
|
domain: z.string(),
|
|
560
|
-
action: JsonObjectSchema,
|
|
606
|
+
action: JsonObjectSchema.describe("Action payload: {tool, action, arguments, value, target, domain}"),
|
|
607
|
+
verdict: JsonObjectSchema.describe("Required verdict: {verdict: ALLOWED|BLOCKED|APPROVAL_REQUIRED|LIMITED|DRY_RUN, mode, reasons, risk_score, confidence}"),
|
|
561
608
|
context: JsonObjectSchema.optional(),
|
|
562
609
|
simulation: JsonObjectSchema.optional(),
|
|
563
|
-
verdict: JsonObjectSchema.optional(),
|
|
564
610
|
goal_summary: z.string().optional(),
|
|
565
611
|
trigger_source: z.string().optional(),
|
|
566
612
|
actor_type: z.string().default("AI_AGENT"),
|
|
@@ -618,20 +664,19 @@ export function registerBighubTools(server, client) {
|
|
|
618
664
|
body: cleanObject({ status, description, details, actual_impact, correction_needed, rollback_performed, revenue_impact }),
|
|
619
665
|
})));
|
|
620
666
|
server.registerTool("bighub_cases_precedents", {
|
|
621
|
-
description: "Get precedent intelligence for a proposed action.",
|
|
667
|
+
description: "Get precedent intelligence for a proposed action. action must be a nested ActionInput object.",
|
|
622
668
|
outputSchema: AnyOutputSchema,
|
|
623
669
|
inputSchema: {
|
|
624
|
-
domain: z.string(),
|
|
625
|
-
action:
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
axes: JsonObjectSchema.optional(),
|
|
670
|
+
domain: z.string().optional().describe("Domain to scope precedent search"),
|
|
671
|
+
action: JsonObjectSchema.describe("ActionInput: {action, tool, action_type, arguments, value, target}"),
|
|
672
|
+
context: JsonObjectSchema.optional().describe("ContextInput: {axes, axes_risk_score, intent, irreversibility}"),
|
|
673
|
+
min_similarity: z.number().min(0).max(1).default(0.5).optional(),
|
|
674
|
+
limit: z.number().int().min(1).max(100).default(20).optional(),
|
|
630
675
|
},
|
|
631
|
-
}, async ({ domain, action,
|
|
676
|
+
}, async ({ domain, action, context, min_similarity, limit }) => toResult(await client.request({
|
|
632
677
|
method: "POST",
|
|
633
678
|
path: "/cases/precedents",
|
|
634
|
-
body: cleanObject({ domain, action,
|
|
679
|
+
body: cleanObject({ domain, action, context, min_similarity, limit }),
|
|
635
680
|
})));
|
|
636
681
|
server.registerTool("bighub_cases_calibration", {
|
|
637
682
|
description: "Get calibration metrics (prediction vs reality) for cases.",
|
|
@@ -659,16 +704,22 @@ export function registerBighubTools(server, client) {
|
|
|
659
704
|
details: JsonObjectSchema.optional(),
|
|
660
705
|
actual_impact: JsonObjectSchema.optional(),
|
|
661
706
|
correction_needed: z.boolean().default(false),
|
|
707
|
+
correction_description: z.string().optional(),
|
|
708
|
+
correction_cost: z.number().optional(),
|
|
709
|
+
time_to_detect_s: z.number().optional(),
|
|
710
|
+
time_to_resolve_s: z.number().optional(),
|
|
662
711
|
rollback_performed: z.boolean().default(false),
|
|
663
712
|
revenue_impact: z.number().optional(),
|
|
713
|
+
customer_impact_count: z.number().int().default(0),
|
|
714
|
+
support_tickets_created: z.number().int().default(0),
|
|
664
715
|
observed_at: z.string().optional(),
|
|
665
716
|
reported_by: z.string().optional(),
|
|
666
717
|
tags: z.array(z.string()).optional(),
|
|
667
718
|
},
|
|
668
|
-
}, async ({ status, request_id, case_id, validation_id, description, details, actual_impact, correction_needed, rollback_performed, revenue_impact, observed_at, reported_by, tags }) => toResult(await client.request({
|
|
719
|
+
}, async ({ status, request_id, case_id, validation_id, description, details, actual_impact, correction_needed, correction_description, correction_cost, time_to_detect_s, time_to_resolve_s, rollback_performed, revenue_impact, customer_impact_count, support_tickets_created, observed_at, reported_by, tags }) => toResult(await client.request({
|
|
669
720
|
method: "POST",
|
|
670
721
|
path: "/outcomes/report",
|
|
671
|
-
body: cleanObject({ status, request_id, case_id, validation_id, description, details, actual_impact, correction_needed, rollback_performed, revenue_impact, observed_at, reported_by, tags }),
|
|
722
|
+
body: cleanObject({ status, request_id, case_id, validation_id, description, details, actual_impact, correction_needed, correction_description, correction_cost, time_to_detect_s, time_to_resolve_s, rollback_performed, revenue_impact, customer_impact_count, support_tickets_created, observed_at, reported_by, tags }),
|
|
672
723
|
})));
|
|
673
724
|
server.registerTool("bighub_outcomes_report_batch", {
|
|
674
725
|
description: "Batch report outcomes (max 100).",
|
|
@@ -686,6 +737,16 @@ export function registerBighubTools(server, client) {
|
|
|
686
737
|
outputSchema: AnyOutputSchema,
|
|
687
738
|
inputSchema: { request_id: z.string() },
|
|
688
739
|
}, async ({ request_id }) => toResult(await client.request({ method: "GET", path: `/outcomes/${request_id}` })));
|
|
740
|
+
server.registerTool("bighub_outcomes_get_by_validation", {
|
|
741
|
+
description: "Get outcome by validation_id.",
|
|
742
|
+
outputSchema: AnyOutputSchema,
|
|
743
|
+
inputSchema: { validation_id: z.string() },
|
|
744
|
+
}, async ({ validation_id }) => toResult(await client.request({ method: "GET", path: `/outcomes/by-validation/${validation_id}` })));
|
|
745
|
+
server.registerTool("bighub_outcomes_get_by_case", {
|
|
746
|
+
description: "Get outcome by case_id.",
|
|
747
|
+
outputSchema: AnyOutputSchema,
|
|
748
|
+
inputSchema: { case_id: z.string() },
|
|
749
|
+
}, async ({ case_id }) => toResult(await client.request({ method: "GET", path: `/outcomes/by-case/${case_id}` })));
|
|
689
750
|
server.registerTool("bighub_outcomes_timeline", {
|
|
690
751
|
description: "Get full outcome timeline for a request.",
|
|
691
752
|
outputSchema: AnyOutputSchema,
|
|
@@ -720,6 +781,29 @@ export function registerBighubTools(server, client) {
|
|
|
720
781
|
description: "Supported outcome status taxonomy.",
|
|
721
782
|
inputSchema: {},
|
|
722
783
|
}, async () => toResult(await client.request({ method: "GET", path: "/outcomes/taxonomy" })));
|
|
784
|
+
server.registerTool("bighub_outcomes_recommendation_quality", {
|
|
785
|
+
description: "Recommendation quality analytics: follow rate, quadrants (followed+positive, followed+negative, ignored+positive, ignored+negative), breakdowns by domain/actor, and notable examples of BIGHUB helped / missed.",
|
|
786
|
+
inputSchema: {
|
|
787
|
+
domain: z.string().optional().describe("Filter by domain"),
|
|
788
|
+
since: z.string().optional().describe("Start date (ISO 8601)"),
|
|
789
|
+
until: z.string().optional().describe("End date (ISO 8601)"),
|
|
790
|
+
},
|
|
791
|
+
}, async ({ domain, since, until }) => {
|
|
792
|
+
return toResult(await client.request({
|
|
793
|
+
method: "GET",
|
|
794
|
+
path: `/outcomes/analytics/recommendation-quality`,
|
|
795
|
+
query: cleanObject({ domain, since, until }),
|
|
796
|
+
}));
|
|
797
|
+
});
|
|
798
|
+
server.registerTool("bighub_outcomes_partner_view", {
|
|
799
|
+
description: "Self-contained partner/domain view: decisions evaluated, follow rate, positive after following, trend, by-action breakdown, sparse evidence pockets, and helped/missed examples.",
|
|
800
|
+
inputSchema: {
|
|
801
|
+
domain: z.string().describe("The domain to generate the partner view for"),
|
|
802
|
+
},
|
|
803
|
+
}, async ({ domain }) => toResult(await client.request({
|
|
804
|
+
method: "GET",
|
|
805
|
+
path: `/outcomes/analytics/partner-view/${encodeURIComponent(domain)}`,
|
|
806
|
+
})));
|
|
723
807
|
// ---------------------------------------------------------------------------
|
|
724
808
|
// Precedents — Case-based reasoning from past decisions
|
|
725
809
|
// ---------------------------------------------------------------------------
|
|
@@ -843,6 +927,18 @@ export function registerBighubTools(server, client) {
|
|
|
843
927
|
path: "/calibration/observe",
|
|
844
928
|
body: cleanObject({ case_id, predicted_risk, outcome_status, domain, tool, action, actor_type, verdict }),
|
|
845
929
|
})));
|
|
930
|
+
server.registerTool("bighub_calibration_quality_history", {
|
|
931
|
+
description: "Daily quality score over time — powers the Learning chart. Returns quality_score (1 − Brier), positive_rate per day.",
|
|
932
|
+
outputSchema: AnyOutputSchema,
|
|
933
|
+
inputSchema: {
|
|
934
|
+
days: z.number().int().min(1).max(180).default(30).describe("Number of days to include"),
|
|
935
|
+
domain: z.string().optional(),
|
|
936
|
+
},
|
|
937
|
+
}, async ({ days, domain }) => toResult(await client.request({
|
|
938
|
+
method: "GET",
|
|
939
|
+
path: "/calibration/quality-history",
|
|
940
|
+
query: cleanObject({ days, domain }),
|
|
941
|
+
})));
|
|
846
942
|
// ---------------------------------------------------------------------------
|
|
847
943
|
// Retrieval — Multi-signal decision retrieval engine
|
|
848
944
|
// ---------------------------------------------------------------------------
|
|
@@ -932,6 +1028,25 @@ export function registerBighubTools(server, client) {
|
|
|
932
1028
|
description: "Get retrieval engine statistics.",
|
|
933
1029
|
inputSchema: {},
|
|
934
1030
|
}, async () => toResult(await client.request({ method: "GET", path: "/retrieval/stats" })));
|
|
1031
|
+
server.registerTool("bighub_retrieval_compare", {
|
|
1032
|
+
description: "Compare two retrieval strategies on the same query. Returns scored results, risk level, confidence, and stability for each strategy.",
|
|
1033
|
+
outputSchema: AnyOutputSchema,
|
|
1034
|
+
inputSchema: {
|
|
1035
|
+
domain: z.string().default(""),
|
|
1036
|
+
tool: z.string().default(""),
|
|
1037
|
+
action: z.string().default(""),
|
|
1038
|
+
actor_type: z.string().default(""),
|
|
1039
|
+
axes: JsonObjectSchema.optional().describe("Risk axes as {axis_name: score}"),
|
|
1040
|
+
risk_score: z.number().default(0.0),
|
|
1041
|
+
intent: z.string().default(""),
|
|
1042
|
+
strategy_a: z.string().default("balanced").describe("First strategy to compare"),
|
|
1043
|
+
strategy_b: z.string().default("consequence-focused").describe("Second strategy to compare"),
|
|
1044
|
+
},
|
|
1045
|
+
}, async ({ domain, tool, action, actor_type, axes, risk_score, intent, strategy_a, strategy_b }) => toResult(await client.request({
|
|
1046
|
+
method: "POST",
|
|
1047
|
+
path: "/retrieval/compare",
|
|
1048
|
+
body: cleanObject({ domain, tool, action, actor_type, axes, risk_score, intent, strategy_a, strategy_b }),
|
|
1049
|
+
})));
|
|
935
1050
|
// ---------------------------------------------------------------------------
|
|
936
1051
|
// Features — Decision feature layer
|
|
937
1052
|
// ---------------------------------------------------------------------------
|
|
@@ -1003,6 +1118,52 @@ export function registerBighubTools(server, client) {
|
|
|
1003
1118
|
description: "Get feature layer statistics.",
|
|
1004
1119
|
inputSchema: {},
|
|
1005
1120
|
}, async () => toResult(await client.request({ method: "GET", path: "/features/stats" })));
|
|
1121
|
+
server.registerTool("bighub_features_compute_batch", {
|
|
1122
|
+
description: "Compute feature vectors for multiple cases in a single request (max 500).",
|
|
1123
|
+
outputSchema: AnyOutputSchema,
|
|
1124
|
+
inputSchema: {
|
|
1125
|
+
cases: z.array(z.object({
|
|
1126
|
+
case_id: z.string(),
|
|
1127
|
+
org_id: z.string().default(""),
|
|
1128
|
+
case_data: JsonObjectSchema.optional(),
|
|
1129
|
+
outcome_data: JsonObjectSchema.optional(),
|
|
1130
|
+
precedent_data: JsonObjectSchema.optional(),
|
|
1131
|
+
calibration_data: JsonObjectSchema.optional(),
|
|
1132
|
+
advisory_data: JsonObjectSchema.optional(),
|
|
1133
|
+
domain_stats: JsonObjectSchema.optional(),
|
|
1134
|
+
})).min(1).max(500),
|
|
1135
|
+
},
|
|
1136
|
+
}, async ({ cases }) => toResult(await client.request({
|
|
1137
|
+
method: "POST",
|
|
1138
|
+
path: "/features/compute/batch",
|
|
1139
|
+
body: { cases },
|
|
1140
|
+
})));
|
|
1141
|
+
server.registerTool("bighub_features_compare", {
|
|
1142
|
+
description: "Compare two feature snapshots or cached vectors. Returns changed features with diffs.",
|
|
1143
|
+
outputSchema: AnyOutputSchema,
|
|
1144
|
+
inputSchema: {
|
|
1145
|
+
snapshot_id_a: z.string().optional(),
|
|
1146
|
+
snapshot_id_b: z.string().optional(),
|
|
1147
|
+
case_id_a: z.string().optional(),
|
|
1148
|
+
case_id_b: z.string().optional(),
|
|
1149
|
+
changed_only: z.boolean().default(true).describe("Only return features that differ"),
|
|
1150
|
+
},
|
|
1151
|
+
}, async ({ snapshot_id_a, snapshot_id_b, case_id_a, case_id_b, changed_only }) => toResult(await client.request({
|
|
1152
|
+
method: "POST",
|
|
1153
|
+
path: "/features/compare",
|
|
1154
|
+
body: cleanObject({ snapshot_id_a, snapshot_id_b, case_id_a, case_id_b, changed_only }),
|
|
1155
|
+
})));
|
|
1156
|
+
server.registerTool("bighub_features_export_batch", {
|
|
1157
|
+
description: "Export flat feature dicts for multiple cases (max 500).",
|
|
1158
|
+
outputSchema: AnyOutputSchema,
|
|
1159
|
+
inputSchema: {
|
|
1160
|
+
case_ids: z.array(z.string()).min(1).max(500),
|
|
1161
|
+
},
|
|
1162
|
+
}, async ({ case_ids }) => toResult(await client.request({
|
|
1163
|
+
method: "POST",
|
|
1164
|
+
path: "/features/export/batch",
|
|
1165
|
+
body: { case_ids },
|
|
1166
|
+
})));
|
|
1006
1167
|
// ---------------------------------------------------------------------------
|
|
1007
1168
|
// Insights — Patterns, advisories, and action profiles
|
|
1008
1169
|
// ---------------------------------------------------------------------------
|
|
@@ -1148,4 +1309,161 @@ export function registerBighubTools(server, client) {
|
|
|
1148
1309
|
path: "/ops/learning/backfill",
|
|
1149
1310
|
body: { domain, action_family, force, limit, async_mode },
|
|
1150
1311
|
})));
|
|
1312
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1313
|
+
// Batch action evaluation
|
|
1314
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1315
|
+
server.registerTool("bighub_actions_evaluate_batch", {
|
|
1316
|
+
description: "Evaluate multiple actions in a single request via /actions/evaluate/batch. " +
|
|
1317
|
+
"Each element follows the same schema as bighub_actions_evaluate. Max 100 actions. Rate limited: 10/min.",
|
|
1318
|
+
outputSchema: AnyOutputSchema,
|
|
1319
|
+
inputSchema: {
|
|
1320
|
+
actions: z.array(z.object({
|
|
1321
|
+
action: z.string(),
|
|
1322
|
+
actor: z.string().default("AI_AGENT"),
|
|
1323
|
+
value: z.number().optional(),
|
|
1324
|
+
target: z.string().optional(),
|
|
1325
|
+
domain: z.string().optional(),
|
|
1326
|
+
context: JsonObjectSchema.optional(),
|
|
1327
|
+
dry_run: z.boolean().default(false),
|
|
1328
|
+
check_contracts: z.boolean().default(false),
|
|
1329
|
+
})).max(100),
|
|
1330
|
+
idempotency_key: z.string().optional(),
|
|
1331
|
+
},
|
|
1332
|
+
}, async ({ actions, idempotency_key }) => toResult(await client.request({
|
|
1333
|
+
method: "POST",
|
|
1334
|
+
path: "/actions/evaluate/batch",
|
|
1335
|
+
body: { actions },
|
|
1336
|
+
idempotencyKey: idempotency_key,
|
|
1337
|
+
})));
|
|
1338
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1339
|
+
// Ingest — real-world event lifecycle
|
|
1340
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1341
|
+
server.registerTool("bighub_ingest_event", {
|
|
1342
|
+
description: "Ingest a single real-world event into BIGHUB. Events flow through: " +
|
|
1343
|
+
"normalize → enrich → correlate → sync. BIGHUB links the event to the " +
|
|
1344
|
+
"correct decision lifecycle using any provided correlation key.",
|
|
1345
|
+
outputSchema: AnyOutputSchema,
|
|
1346
|
+
inputSchema: {
|
|
1347
|
+
event_type: z.string().default("OUTCOME_OBSERVED").describe("Event type: ACTION_PROPOSED, ACTION_EXECUTED, ACTION_BLOCKED, " +
|
|
1348
|
+
"HUMAN_OVERRIDE, HUMAN_APPROVAL, HUMAN_REJECTION, " +
|
|
1349
|
+
"OUTCOME_OBSERVED, OUTCOME_UPDATED, ROLLBACK_PERFORMED, " +
|
|
1350
|
+
"CORRECTION_APPLIED, ESCALATION_TRIGGERED, FRAUD_DETECTED, " +
|
|
1351
|
+
"CHURN_SIGNAL, TICKET_REOPENED, REFUND_COMPLETED, PRICING_CORRECTION"),
|
|
1352
|
+
timestamp: z.string().optional().describe("ISO 8601 timestamp (defaults to now)"),
|
|
1353
|
+
request_id: z.string().default("").describe("Link to BIGHUB decision (from /actions/evaluate response)"),
|
|
1354
|
+
case_id: z.string().default("").describe("Link to DecisionCase"),
|
|
1355
|
+
validation_id: z.string().default("").describe("Link to rule validation"),
|
|
1356
|
+
external_ref: z.string().default("").describe("Your system's reference (e.g. order_id)"),
|
|
1357
|
+
tenant_ref: z.string().default("").describe("Tenant-level reference"),
|
|
1358
|
+
entity_id: z.string().default("").describe("Entity being acted on"),
|
|
1359
|
+
session_id: z.string().default("").describe("Session / conversation ID"),
|
|
1360
|
+
action: JsonObjectSchema.optional().describe("Action payload: {tool, action, arguments, value, target, domain}"),
|
|
1361
|
+
context: JsonObjectSchema.optional().describe("Context: {risk_score, axes, environment, ...}"),
|
|
1362
|
+
execution: JsonObjectSchema.optional().describe("Execution result: {executed, status_code, error, ...}"),
|
|
1363
|
+
outcome: JsonObjectSchema.optional().describe("Outcome: {status, description, revenue_impact, ...}"),
|
|
1364
|
+
human_feedback: JsonObjectSchema.optional().describe("Human: {feedback_type, decision, reason, ...}"),
|
|
1365
|
+
intent: JsonObjectSchema.optional().describe("Intent: {goal_summary, trigger_source, actor_type, ...}"),
|
|
1366
|
+
adapter: z.string().default("generic_webhook"),
|
|
1367
|
+
domain: z.string().default(""),
|
|
1368
|
+
tags: z.array(z.string()).optional(),
|
|
1369
|
+
},
|
|
1370
|
+
}, async (args) => toResult(await client.request({
|
|
1371
|
+
method: "POST",
|
|
1372
|
+
path: "/ingest",
|
|
1373
|
+
body: cleanObject(args),
|
|
1374
|
+
})));
|
|
1375
|
+
server.registerTool("bighub_ingest_batch", {
|
|
1376
|
+
description: "Ingest multiple real-world events in a single request (max 500). " +
|
|
1377
|
+
"Events are processed through the same normalize → enrich → correlate → sync pipeline.",
|
|
1378
|
+
outputSchema: AnyOutputSchema,
|
|
1379
|
+
inputSchema: {
|
|
1380
|
+
events: z.array(JsonObjectSchema).max(500).describe("Raw event payloads"),
|
|
1381
|
+
adapter: z.string().default("generic_webhook"),
|
|
1382
|
+
domain: z.string().default(""),
|
|
1383
|
+
},
|
|
1384
|
+
}, async ({ events, adapter, domain }) => toResult(await client.request({
|
|
1385
|
+
method: "POST",
|
|
1386
|
+
path: "/ingest/batch",
|
|
1387
|
+
body: { events, adapter, domain },
|
|
1388
|
+
})));
|
|
1389
|
+
server.registerTool("bighub_ingest_reconcile", {
|
|
1390
|
+
description: "Reconcile a late-arriving outcome with a previous decision. " +
|
|
1391
|
+
"Use when the outcome arrives after the initial event was already ingested.",
|
|
1392
|
+
outputSchema: AnyOutputSchema,
|
|
1393
|
+
inputSchema: {
|
|
1394
|
+
key_name: z.string().describe("Correlation key: request_id, case_id, external_ref, tenant_ref, or entity_id"),
|
|
1395
|
+
key_value: z.string().describe("Value of the correlation key"),
|
|
1396
|
+
outcome: JsonObjectSchema.describe("Outcome event payload to attach"),
|
|
1397
|
+
},
|
|
1398
|
+
}, async ({ key_name, key_value, outcome }) => toResult(await client.request({
|
|
1399
|
+
method: "POST",
|
|
1400
|
+
path: "/ingest/reconcile",
|
|
1401
|
+
body: { key_name, key_value, outcome },
|
|
1402
|
+
})));
|
|
1403
|
+
server.registerTool("bighub_ingest_lifecycles", {
|
|
1404
|
+
description: "List decision lifecycles with optional status filter.",
|
|
1405
|
+
outputSchema: AnyOutputSchema,
|
|
1406
|
+
inputSchema: {
|
|
1407
|
+
status_filter: z.string().optional().describe("Filter by lifecycle status"),
|
|
1408
|
+
limit: z.number().int().default(50),
|
|
1409
|
+
},
|
|
1410
|
+
}, async ({ status_filter, limit }) => toResult(await client.request({
|
|
1411
|
+
method: "GET",
|
|
1412
|
+
path: "/ingest/lifecycles",
|
|
1413
|
+
query: cleanObject({ status_filter, limit }),
|
|
1414
|
+
})));
|
|
1415
|
+
server.registerTool("bighub_ingest_lifecycle", {
|
|
1416
|
+
description: "Get a specific decision lifecycle by correlation key.",
|
|
1417
|
+
outputSchema: AnyOutputSchema,
|
|
1418
|
+
inputSchema: {
|
|
1419
|
+
request_id: z.string().optional(),
|
|
1420
|
+
case_id: z.string().optional(),
|
|
1421
|
+
external_ref: z.string().optional(),
|
|
1422
|
+
tenant_ref: z.string().optional(),
|
|
1423
|
+
entity_id: z.string().optional(),
|
|
1424
|
+
},
|
|
1425
|
+
}, async ({ request_id, case_id, external_ref, tenant_ref, entity_id }) => toResult(await client.request({
|
|
1426
|
+
method: "GET",
|
|
1427
|
+
path: "/ingest/lifecycle",
|
|
1428
|
+
query: cleanObject({ request_id, case_id, external_ref, tenant_ref, entity_id }),
|
|
1429
|
+
})));
|
|
1430
|
+
server.registerTool("bighub_ingest_pending", {
|
|
1431
|
+
description: "List lifecycles awaiting outcome reconciliation.",
|
|
1432
|
+
outputSchema: AnyOutputSchema,
|
|
1433
|
+
inputSchema: {
|
|
1434
|
+
limit: z.number().int().default(50),
|
|
1435
|
+
},
|
|
1436
|
+
}, async ({ limit }) => toResult(await client.request({
|
|
1437
|
+
method: "GET",
|
|
1438
|
+
path: "/ingest/pending",
|
|
1439
|
+
query: { limit },
|
|
1440
|
+
})));
|
|
1441
|
+
server.registerTool("bighub_ingest_stale", {
|
|
1442
|
+
description: "List stale lifecycles that have not received an outcome within the expected timeframe.",
|
|
1443
|
+
outputSchema: AnyOutputSchema,
|
|
1444
|
+
inputSchema: {
|
|
1445
|
+
stale_after_days: z.number().int().default(7),
|
|
1446
|
+
limit: z.number().int().default(50),
|
|
1447
|
+
},
|
|
1448
|
+
}, async ({ stale_after_days, limit }) => toResult(await client.request({
|
|
1449
|
+
method: "GET",
|
|
1450
|
+
path: "/ingest/stale",
|
|
1451
|
+
query: { stale_after_days, limit },
|
|
1452
|
+
})));
|
|
1453
|
+
server.registerTool("bighub_ingest_stats", {
|
|
1454
|
+
description: "Get organization-wide ingestion statistics (event counts, adapter breakdown, lifecycle status distribution).",
|
|
1455
|
+
outputSchema: AnyOutputSchema,
|
|
1456
|
+
inputSchema: {},
|
|
1457
|
+
}, async () => toResult(await client.request({
|
|
1458
|
+
method: "GET",
|
|
1459
|
+
path: "/ingest/stats",
|
|
1460
|
+
})));
|
|
1461
|
+
server.registerTool("bighub_ingest_adapters", {
|
|
1462
|
+
description: "List available ingestion adapters and domain normalizers.",
|
|
1463
|
+
outputSchema: AnyOutputSchema,
|
|
1464
|
+
inputSchema: {},
|
|
1465
|
+
}, async () => toResult(await client.request({
|
|
1466
|
+
method: "GET",
|
|
1467
|
+
path: "/ingest/adapters",
|
|
1468
|
+
})));
|
|
1151
1469
|
}
|