@barivia/barsom-mcp 0.6.1 → 0.6.3
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/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/shared.d.ts +90 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +439 -0
- package/dist/shared.js.map +1 -0
- package/dist/tools/account.d.ts +3 -0
- package/dist/tools/account.d.ts.map +1 -0
- package/dist/tools/account.js +139 -0
- package/dist/tools/account.js.map +1 -0
- package/dist/tools/datasets.d.ts +11 -0
- package/dist/tools/datasets.d.ts.map +1 -0
- package/dist/tools/datasets.js +323 -0
- package/dist/tools/datasets.js.map +1 -0
- package/dist/tools/explore_map.d.ts +4 -0
- package/dist/tools/explore_map.d.ts.map +1 -0
- package/dist/tools/explore_map.js +39 -0
- package/dist/tools/explore_map.js.map +1 -0
- package/dist/tools/feedback.d.ts +3 -0
- package/dist/tools/feedback.d.ts.map +1 -0
- package/dist/tools/feedback.js +30 -0
- package/dist/tools/feedback.js.map +1 -0
- package/dist/tools/guide_barsom.d.ts +3 -0
- package/dist/tools/guide_barsom.d.ts.map +1 -0
- package/dist/tools/guide_barsom.js +46 -0
- package/dist/tools/guide_barsom.js.map +1 -0
- package/dist/tools/inference.d.ts +3 -0
- package/dist/tools/inference.d.ts.map +1 -0
- package/dist/tools/inference.js +177 -0
- package/dist/tools/inference.js.map +1 -0
- package/dist/tools/jobs.d.ts +4 -0
- package/dist/tools/jobs.d.ts.map +1 -0
- package/dist/tools/jobs.js +270 -0
- package/dist/tools/jobs.js.map +1 -0
- package/dist/tools/results.d.ts +11 -0
- package/dist/tools/results.d.ts.map +1 -0
- package/dist/tools/results.js +455 -0
- package/dist/tools/results.js.map +1 -0
- package/dist/tools/training_guidance.d.ts +3 -0
- package/dist/tools/training_guidance.d.ts.map +1 -0
- package/dist/tools/training_guidance.js +8 -0
- package/dist/tools/training_guidance.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import fs from "node:fs/promises";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { apiCall, getWorkspaceRootAsync, resolveFilePathForUpload, textResult, pollUntilComplete, } from "../shared.js";
|
|
5
|
+
export function registerDatasetsTool(server) {
|
|
6
|
+
server.tool("datasets", `Manage datasets: upload, preview, list, subset, add_expression, or delete.
|
|
7
|
+
|
|
8
|
+
| Action | Use when |
|
|
9
|
+
|--------|----------|
|
|
10
|
+
| upload | You have a CSV file to add — do this first |
|
|
11
|
+
| preview | Before jobs(action=train_map) — always preview an unfamiliar dataset to spot cyclics, nulls, column types |
|
|
12
|
+
| analyze | Pre-training column analysis: correlation matrix, periodicity ranking, column recommendations (train / drop / project later). Run after preview, before train_map. |
|
|
13
|
+
| list | Finding dataset IDs for train_map, preview, or subset — see all available datasets |
|
|
14
|
+
| subset | Creating a filtered/sliced view without re-uploading the full CSV |
|
|
15
|
+
| add_expression | Add a computed column from an expression (same as project(expression) without project_onto_job) — dataset_id + name + expression |
|
|
16
|
+
| delete | Cleaning up after experiments or freeing the dataset slot |
|
|
17
|
+
|
|
18
|
+
action=upload: PREFER file_path — server reads from workspace root (token-efficient; no file content in context). Use csv_data only for small inline pastes (e.g. <10KB). Returns dataset ID. Then use datasets(action=preview) before jobs(action=train_map).
|
|
19
|
+
|
|
20
|
+
Step 0 (before upload): (1) CSV with header; one row per observation. (2) Columns you will use for training must be numeric (or datetime if you will use temporal extraction). (3) No NaNs/missing in those columns (engine does not impute). (4) Categoricals: encode (e.g. one-hot, label) or exclude — do not use raw categorical columns as training features; preview shows which columns are non-numeric. (5) Optional: if you plan to use transition_flow, sort rows chronologically before upload.
|
|
21
|
+
Step 1 (after upload): Upload, then always datasets(action=preview) to verify column types and spot cyclics/datetime. Add derived columns with datasets(action=add_expression, dataset_id=..., name=..., expression=...); fix or subset before jobs(action=train_map).
|
|
22
|
+
|
|
23
|
+
action=preview: Show columns, stats, sample rows, cyclic/datetime detections. ALWAYS preview before jobs(action=train_map) on an unfamiliar dataset.
|
|
24
|
+
action=analyze: Pre-training analysis on numeric columns — Pearson correlation, autocorrelation periodicity scores, and column recommendations (train, consider_dropping, project_later, low_variance). Use to choose which columns to include in training and which to project onto the map after training.
|
|
25
|
+
action=list: List all datasets belonging to the organisation with id, name, rows, cols, created_at (use created_at or id to distinguish datasets with the same name).
|
|
26
|
+
action=subset: Create a new dataset from a subset of an existing one. Requires name and at least one of row_range or filters.
|
|
27
|
+
- row_range: [start, end] 1-based inclusive (e.g. [1, 2000] for first 2000 rows)
|
|
28
|
+
- filters: array of conditions, ALL must match (AND logic). Each: { column, op, value }.
|
|
29
|
+
Operators: eq, ne, in, gt, lt, gte, lte, between
|
|
30
|
+
Examples: { column: "region", op: "eq", value: "Europe" } | { column: "age", op: "between", value: [18, 65] }
|
|
31
|
+
- Combine row_range + filters to slice both rows and values.
|
|
32
|
+
- Single filter object is also accepted (auto-wrapped).
|
|
33
|
+
action=delete: Remove a dataset and all S3 data permanently.
|
|
34
|
+
|
|
35
|
+
BEST FOR: Tabular numeric data. CSV with header required.
|
|
36
|
+
NOT FOR: Real-time data streams or binary files — upload a snapshot CSV instead.
|
|
37
|
+
ESCALATION: If upload fails with column errors, open the file locally and verify the header row. If preview shows unexpected nulls, the user must clean the CSV before training.`, {
|
|
38
|
+
action: z
|
|
39
|
+
.enum(["upload", "preview", "analyze", "list", "subset", "delete", "add_expression"])
|
|
40
|
+
.describe("upload: add CSV; preview: inspect columns/stats; analyze: pre-training correlation and periodicity; list: see all datasets; subset: create filtered subset; delete: remove dataset; add_expression: add derived column from expression"),
|
|
41
|
+
name: z.string().optional().describe("Dataset name (required for action=upload and subset)"),
|
|
42
|
+
file_path: z.string().optional().describe("Path to local CSV (PREFERRED): absolute path, file:// URI, or relative to workspace root. Token-efficient; server reads file."),
|
|
43
|
+
csv_data: z.string().optional().describe("Inline CSV string for small pastes only (<10KB). Avoid for large files — use file_path instead to avoid token explosion."),
|
|
44
|
+
dataset_id: z.string().optional().describe("Dataset ID (required for preview, subset, and delete)"),
|
|
45
|
+
n_rows: z.number().int().optional().default(5).describe("Sample rows to return (preview only)"),
|
|
46
|
+
row_range: z
|
|
47
|
+
.tuple([z.number().int(), z.number().int()])
|
|
48
|
+
.optional()
|
|
49
|
+
.describe("For subset: [start, end] 1-based inclusive row range (e.g. [1, 2000])"),
|
|
50
|
+
filters: z.preprocess((v) => {
|
|
51
|
+
if (v === undefined || v === null)
|
|
52
|
+
return v;
|
|
53
|
+
if (Array.isArray(v))
|
|
54
|
+
return v;
|
|
55
|
+
if (typeof v === "object" && v !== null && "column" in v)
|
|
56
|
+
return [v];
|
|
57
|
+
return v;
|
|
58
|
+
}, z
|
|
59
|
+
.array(z.object({
|
|
60
|
+
column: z.string(),
|
|
61
|
+
op: z.enum(["eq", "ne", "in", "gt", "lt", "gte", "lte", "between"]),
|
|
62
|
+
value: z.union([z.string(), z.number(), z.array(z.union([z.string(), z.number()]))]),
|
|
63
|
+
}))
|
|
64
|
+
.optional()
|
|
65
|
+
.describe("For subset: filter conditions (AND logic). Single object or array. " +
|
|
66
|
+
"ops: eq, ne, in, gt, lt, gte, lte, between. " +
|
|
67
|
+
"Examples: { column: 'temp', op: 'between', value: [15, 30] }, { column: 'region', op: 'eq', value: 'Europe' }")),
|
|
68
|
+
filter: z
|
|
69
|
+
.object({
|
|
70
|
+
column: z.string(),
|
|
71
|
+
op: z.enum(["eq", "ne", "in", "gt", "lt", "gte", "lte", "between"]),
|
|
72
|
+
value: z.union([z.string(), z.number(), z.array(z.union([z.string(), z.number()]))]),
|
|
73
|
+
})
|
|
74
|
+
.optional()
|
|
75
|
+
.describe("Deprecated — use filters instead. Single filter condition."),
|
|
76
|
+
expression: z.string().optional().describe("action=add_expression: math expression referencing column names (e.g. revenue/cost, log(price), rolling_mean(vol, 20))"),
|
|
77
|
+
options: z
|
|
78
|
+
.object({
|
|
79
|
+
missing: z.enum(["skip", "zero", "interpolate"]).optional(),
|
|
80
|
+
window: z.number().int().optional(),
|
|
81
|
+
})
|
|
82
|
+
.optional()
|
|
83
|
+
.describe("action=add_expression: evaluation options (missing, window for rolling)"),
|
|
84
|
+
}, async ({ action, name, file_path, csv_data, dataset_id, n_rows, row_range, filters, filter, expression, options }) => {
|
|
85
|
+
if (action === "upload") {
|
|
86
|
+
if (!name)
|
|
87
|
+
throw new Error("datasets(upload) requires name");
|
|
88
|
+
let body;
|
|
89
|
+
if (file_path) {
|
|
90
|
+
await apiCall("GET", "/v1/system/info");
|
|
91
|
+
const resolved = await resolveFilePathForUpload(file_path, server);
|
|
92
|
+
const ext = path.extname(resolved).toLowerCase();
|
|
93
|
+
if (ext !== ".csv" && ext !== ".tsv") {
|
|
94
|
+
throw new Error("Only .csv and .tsv files can be uploaded as datasets.");
|
|
95
|
+
}
|
|
96
|
+
try {
|
|
97
|
+
body = await fs.readFile(resolved, "utf-8");
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
throw new Error(`File not accessible at resolved path. file_path is relative to workspace root. ` +
|
|
101
|
+
`Set BARIVIA_WORKSPACE_ROOT in your MCP config env if needed (current: ${await getWorkspaceRootAsync(server)}).`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
else if (csv_data && csv_data.length > 0) {
|
|
105
|
+
body = csv_data;
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
throw new Error("datasets(upload) requires file_path or csv_data. Prefer file_path for token efficiency.");
|
|
109
|
+
}
|
|
110
|
+
const data = (await apiCall("POST", "/v1/datasets", body, {
|
|
111
|
+
"X-Dataset-Name": name,
|
|
112
|
+
"Content-Type": "text/csv",
|
|
113
|
+
}));
|
|
114
|
+
const id = data.id ?? data.dataset_id;
|
|
115
|
+
if (id != null)
|
|
116
|
+
data.suggested_next_step = `Suggested next step: datasets(action=preview, dataset_id=${id}) to inspect columns before training.`;
|
|
117
|
+
return textResult(data);
|
|
118
|
+
}
|
|
119
|
+
if (action === "preview") {
|
|
120
|
+
if (!dataset_id)
|
|
121
|
+
throw new Error("datasets(preview) requires dataset_id");
|
|
122
|
+
const data = (await apiCall("GET", `/v1/datasets/${dataset_id}/preview?n_rows=${n_rows ?? 5}`));
|
|
123
|
+
const cols = data.columns ?? [];
|
|
124
|
+
const stats = data.column_stats ?? [];
|
|
125
|
+
const hints = data.cyclic_hints ?? [];
|
|
126
|
+
const samples = data.sample_rows ?? [];
|
|
127
|
+
const dtCols = data.datetime_columns ?? [];
|
|
128
|
+
const temporalSugg = data.temporal_suggestions ?? [];
|
|
129
|
+
const fmt = (v) => v === null || v === undefined ? "—" : Number(v).toFixed(3);
|
|
130
|
+
const lines = [
|
|
131
|
+
`Dataset: ${data.name} (${data.dataset_id})`,
|
|
132
|
+
`${data.total_rows} rows × ${data.total_cols} columns`,
|
|
133
|
+
``,
|
|
134
|
+
`Column Statistics:`,
|
|
135
|
+
`| Column | Min | Max | Mean | Std | Nulls | Numeric |`,
|
|
136
|
+
`|--------|-----|-----|------|-----|-------|---------|`,
|
|
137
|
+
];
|
|
138
|
+
for (const s of stats) {
|
|
139
|
+
lines.push(`| ${s.column} | ${fmt(s.min)} | ${fmt(s.max)} | ${fmt(s.mean)} | ${fmt(s.std)} | ${s.null_count ?? 0} | ${s.is_numeric !== false ? "yes" : "no"} |`);
|
|
140
|
+
}
|
|
141
|
+
if (hints.length > 0) {
|
|
142
|
+
lines.push(``, `Detected Cyclic Feature Hints:`);
|
|
143
|
+
for (const h of hints) {
|
|
144
|
+
lines.push(` • ${h.column} — period=${h.period} (${h.reason})`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (dtCols.length > 0) {
|
|
148
|
+
lines.push(``, `Detected Datetime Columns:`);
|
|
149
|
+
for (const dc of dtCols) {
|
|
150
|
+
const formats = dc.detected_formats ?? [];
|
|
151
|
+
const fmtStrs = formats
|
|
152
|
+
.map((f) => `${f.format} — ${f.description} (${(f.match_rate * 100).toFixed(0)}% match)`)
|
|
153
|
+
.join("; ");
|
|
154
|
+
lines.push(` • ${dc.column}: sample="${dc.sample}" → ${fmtStrs}`);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
if (temporalSugg.length > 0) {
|
|
158
|
+
lines.push(``, `Temporal Feature Suggestions (require user approval):`);
|
|
159
|
+
for (const ts of temporalSugg) {
|
|
160
|
+
lines.push(` • Columns: ${ts.columns.join(" + ")} → format: "${ts.format}"`);
|
|
161
|
+
lines.push(` Available components: ${ts.available_components.join(", ")}`);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (hints.length > 0 || temporalSugg.length > 0) {
|
|
165
|
+
const cyclicCols = hints.map((h) => h.column);
|
|
166
|
+
const temporalCols = temporalSugg.flatMap((ts) => ts.columns ?? []);
|
|
167
|
+
const allCols = [...new Set([...cyclicCols, ...temporalCols])];
|
|
168
|
+
lines.push(``, allCols.length > 0
|
|
169
|
+
? `Consider using cyclic_features or temporal_features for these columns when calling jobs(action=train_map): ${allCols.join(", ")}.`
|
|
170
|
+
: `Consider using cyclic_features or temporal_features for the columns above when calling jobs(action=train_map).`);
|
|
171
|
+
}
|
|
172
|
+
if (samples.length > 0) {
|
|
173
|
+
lines.push(``, `Sample Rows (first ${samples.length}):`);
|
|
174
|
+
lines.push(`| ${cols.join(" | ")} |`);
|
|
175
|
+
lines.push(`| ${cols.map(() => "---").join(" | ")} |`);
|
|
176
|
+
for (const row of samples) {
|
|
177
|
+
lines.push(`| ${cols.map((c) => String(row[c] ?? "")).join(" | ")} |`);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
lines.push(``, `Suggested next step: jobs(action=train_map, dataset_id=${dataset_id}, ...) or use the prepare_training prompt; to add derived columns use datasets(action=add_expression, dataset_id=${dataset_id}, name=..., expression=...).`);
|
|
181
|
+
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
182
|
+
}
|
|
183
|
+
if (action === "analyze") {
|
|
184
|
+
if (!dataset_id)
|
|
185
|
+
throw new Error("datasets(analyze) requires dataset_id");
|
|
186
|
+
const data = (await apiCall("GET", `/v1/datasets/${dataset_id}/analyze`));
|
|
187
|
+
const note = data.note;
|
|
188
|
+
if (note) {
|
|
189
|
+
return { content: [{ type: "text", text: `Dataset: ${data.name} (${data.dataset_id})\n${data.total_rows} rows.\n\n${note}` }] };
|
|
190
|
+
}
|
|
191
|
+
const columns = data.columns ?? [];
|
|
192
|
+
const highPairs = data.high_correlation_pairs ?? [];
|
|
193
|
+
const uniqueness = data.uniqueness_scores ?? {};
|
|
194
|
+
const periodicity = data.periodicity ?? [];
|
|
195
|
+
const rec = data.recommendations ?? { train: [], consider_dropping: [], project_later: [], low_variance: [] };
|
|
196
|
+
const trainList = rec.train ?? [];
|
|
197
|
+
const considerDropping = rec.consider_dropping ?? [];
|
|
198
|
+
const projectLater = rec.project_later ?? [];
|
|
199
|
+
const lowVariance = rec.low_variance ?? [];
|
|
200
|
+
const lines = [
|
|
201
|
+
`Pre-training analysis: ${data.name} (${data.dataset_id})`,
|
|
202
|
+
`${data.total_rows} rows × ${columns.length} numeric columns analyzed`,
|
|
203
|
+
``,
|
|
204
|
+
`Column recommendations:`,
|
|
205
|
+
` Train (use in jobs(action=train_map)): ${trainList.length ? trainList.join(", ") : "—"}`,
|
|
206
|
+
` Consider dropping (highly correlated with another): ${considerDropping.length ? considerDropping.join(", ") : "—"}`,
|
|
207
|
+
` Project later (after training, use project(expression/values) onto map): ${projectLater.length ? projectLater.join(", ") : "—"}`,
|
|
208
|
+
` Low variance (near-constant): ${lowVariance.length ? lowVariance.join(", ") : "—"}`,
|
|
209
|
+
``,
|
|
210
|
+
];
|
|
211
|
+
if (highPairs.length > 0) {
|
|
212
|
+
lines.push(`High correlation pairs (|r| > 0.85):`);
|
|
213
|
+
for (const p of highPairs) {
|
|
214
|
+
lines.push(` • ${p.column_a} ↔ ${p.column_b}: r = ${p.correlation}`);
|
|
215
|
+
}
|
|
216
|
+
lines.push(``);
|
|
217
|
+
}
|
|
218
|
+
if (Object.keys(uniqueness).length > 0) {
|
|
219
|
+
lines.push(`Uniqueness score (1 − max|r| with others; higher = more unique):`);
|
|
220
|
+
for (const col of columns) {
|
|
221
|
+
const u = uniqueness[col];
|
|
222
|
+
if (u !== undefined)
|
|
223
|
+
lines.push(` • ${col}: ${u.toFixed(3)}`);
|
|
224
|
+
}
|
|
225
|
+
lines.push(``);
|
|
226
|
+
}
|
|
227
|
+
if (periodicity.length > 0) {
|
|
228
|
+
lines.push(`Periodicity ranking (by autocorrelation strength at lags 7, 12, 24, 52, 365):`);
|
|
229
|
+
for (const p of periodicity) {
|
|
230
|
+
const col = p.column;
|
|
231
|
+
const dominantLag = p.dominant_lag;
|
|
232
|
+
const score = p.dominant_score;
|
|
233
|
+
lines.push(` • ${col}: dominant lag ${dominantLag} (score ${score})`);
|
|
234
|
+
}
|
|
235
|
+
lines.push(``);
|
|
236
|
+
}
|
|
237
|
+
const nextSteps = [];
|
|
238
|
+
if (trainList.length > 0) {
|
|
239
|
+
nextSteps.push(`Train with columns: [${trainList.join(", ")}].`);
|
|
240
|
+
}
|
|
241
|
+
if (projectLater.length > 0) {
|
|
242
|
+
nextSteps.push(`After training, project [${projectLater.join(", ")}] onto the map using project(expression=..., project_onto_job=JOB_ID) to see how they distribute.`);
|
|
243
|
+
}
|
|
244
|
+
const periodicStrong = periodicity.filter((p) => p.dominant_score > 0.4);
|
|
245
|
+
if (periodicStrong.length > 0) {
|
|
246
|
+
const lags = [...new Set(periodicStrong.map((p) => p.dominant_lag))].sort((a, b) => a - b);
|
|
247
|
+
nextSteps.push(`Columns show periodic behavior at lags ${lags.join(", ")}. Consider cyclic_features or temporal_features with matching periods.`);
|
|
248
|
+
nextSteps.push(`For datetime columns: run datasets(action=preview) for temporal_suggestions; match lags (e.g. 365→day_of_year, 12→month, 7→day_of_week, 24→hour_of_day) to choose which temporal components to extract.`);
|
|
249
|
+
}
|
|
250
|
+
nextSteps.push(`Then call jobs(action=train_map, dataset_id=${dataset_id}, columns=[...], ...).`);
|
|
251
|
+
lines.push(`Next steps:`, ...nextSteps.map((s) => ` ${s}`));
|
|
252
|
+
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
253
|
+
}
|
|
254
|
+
if (action === "add_expression") {
|
|
255
|
+
if (!dataset_id)
|
|
256
|
+
throw new Error("datasets(add_expression) requires dataset_id");
|
|
257
|
+
if (!name)
|
|
258
|
+
throw new Error("datasets(add_expression) requires name");
|
|
259
|
+
if (!expression)
|
|
260
|
+
throw new Error("datasets(add_expression) requires expression");
|
|
261
|
+
const body = { name, expression };
|
|
262
|
+
if (options)
|
|
263
|
+
body.options = options;
|
|
264
|
+
const data = (await apiCall("POST", `/v1/datasets/${dataset_id}/derive`, body));
|
|
265
|
+
const deriveJobId = data.id;
|
|
266
|
+
const poll = await pollUntilComplete(deriveJobId);
|
|
267
|
+
if (poll.status === "completed") {
|
|
268
|
+
const results = (await apiCall("GET", `/v1/results/${deriveJobId}`));
|
|
269
|
+
const summary = (results.summary ?? {});
|
|
270
|
+
return {
|
|
271
|
+
content: [
|
|
272
|
+
{
|
|
273
|
+
type: "text",
|
|
274
|
+
text: [
|
|
275
|
+
`Derived column "${name}" added to dataset ${dataset_id}`,
|
|
276
|
+
`Expression: ${expression} | Rows: ${summary.n_rows ?? "?"}`,
|
|
277
|
+
summary.nan_count ? `NaN values: ${summary.nan_count}` : "",
|
|
278
|
+
`Min: ${summary.min ?? "?"} | Max: ${summary.max ?? "?"} | Mean: ${summary.mean ?? "?"}`,
|
|
279
|
+
`Column now available. Use datasets(action=preview) to verify, or include in jobs(action=train_map) via the 'columns' parameter.`,
|
|
280
|
+
]
|
|
281
|
+
.filter(Boolean)
|
|
282
|
+
.join("\n"),
|
|
283
|
+
},
|
|
284
|
+
],
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
if (poll.status === "failed")
|
|
288
|
+
return { content: [{ type: "text", text: `datasets(add_expression) job ${deriveJobId} failed: ${poll.error ?? "unknown error"}` }] };
|
|
289
|
+
return {
|
|
290
|
+
content: [{ type: "text", text: `datasets(add_expression) job ${deriveJobId} submitted. Poll with jobs(action=status, job_id="${deriveJobId}").` }],
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
if (action === "subset") {
|
|
294
|
+
if (!dataset_id)
|
|
295
|
+
throw new Error("datasets(subset) requires dataset_id");
|
|
296
|
+
if (!name)
|
|
297
|
+
throw new Error("datasets(subset) requires name");
|
|
298
|
+
const allFilters = filters ?? (filter ? [filter] : undefined);
|
|
299
|
+
if (row_range === undefined && allFilters === undefined) {
|
|
300
|
+
throw new Error("datasets(subset) requires at least one of row_range or filters");
|
|
301
|
+
}
|
|
302
|
+
const body = { name };
|
|
303
|
+
if (row_range !== undefined)
|
|
304
|
+
body.row_range = row_range;
|
|
305
|
+
if (allFilters !== undefined)
|
|
306
|
+
body.filters = allFilters;
|
|
307
|
+
const data = await apiCall("POST", `/v1/datasets/${dataset_id}/subset`, body);
|
|
308
|
+
return textResult(data);
|
|
309
|
+
}
|
|
310
|
+
if (action === "list") {
|
|
311
|
+
const data = await apiCall("GET", "/v1/datasets");
|
|
312
|
+
return textResult(data);
|
|
313
|
+
}
|
|
314
|
+
if (action === "delete") {
|
|
315
|
+
if (!dataset_id)
|
|
316
|
+
throw new Error("datasets(delete) requires dataset_id");
|
|
317
|
+
const data = await apiCall("DELETE", `/v1/datasets/${dataset_id}`);
|
|
318
|
+
return textResult(data);
|
|
319
|
+
}
|
|
320
|
+
throw new Error("Invalid action");
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
//# sourceMappingURL=datasets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datasets.js","sourceRoot":"","sources":["../../src/tools/datasets.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,OAAO,EAC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AM,KAAK,QAAQ,EAAE,CAAC;YACxB,IAAI,CAAC,UAAU;gBAAE,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;YACzE,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,QAAQ,EAAE,gBAAgB,UAAU,EAAE,CAAC,CAAC;YACnE,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACpC,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"explore_map.d.ts","sourceRoot":"","sources":["../../src/tools/explore_map.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE,eAAO,MAAM,gBAAgB,6BAA6B,CAAC;AAE3D,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA2C9D"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { registerAppTool } from "@modelcontextprotocol/ext-apps/server";
|
|
3
|
+
import { apiCall, tryAttachImage, getClientSupportsMcpApps, getVizPort } from "../shared.js";
|
|
4
|
+
export const MAP_EXPLORER_URI = "ui://barsom/map-explorer";
|
|
5
|
+
export function registerExploreMapTool(server) {
|
|
6
|
+
registerAppTool(server, "explore_map", {
|
|
7
|
+
title: "Explore Map",
|
|
8
|
+
description: "Interactive map explorer dashboard. Opens an inline visualization " +
|
|
9
|
+
"where you can toggle features, click nodes, and export figures. " +
|
|
10
|
+
"Use this after results(action=get) for a richer, interactive exploration experience. " +
|
|
11
|
+
"Falls back to text+image on hosts that don't support MCP Apps.",
|
|
12
|
+
inputSchema: {
|
|
13
|
+
job_id: z.string().describe("Job ID of a completed map training job"),
|
|
14
|
+
},
|
|
15
|
+
_meta: { ui: { resourceUri: MAP_EXPLORER_URI } },
|
|
16
|
+
}, async ({ job_id }) => {
|
|
17
|
+
const data = (await apiCall("GET", `/v1/results/${job_id}`));
|
|
18
|
+
const summary = (data.summary ?? {});
|
|
19
|
+
const content = [];
|
|
20
|
+
content.push({
|
|
21
|
+
type: "text",
|
|
22
|
+
text: JSON.stringify({
|
|
23
|
+
job_id,
|
|
24
|
+
summary,
|
|
25
|
+
download_urls: data.download_urls,
|
|
26
|
+
}),
|
|
27
|
+
});
|
|
28
|
+
const imgExt = summary.output_format ?? "pdf";
|
|
29
|
+
await tryAttachImage(content, job_id, `combined.${imgExt}`);
|
|
30
|
+
if (!getClientSupportsMcpApps() && getVizPort()) {
|
|
31
|
+
content.push({
|
|
32
|
+
type: "text",
|
|
33
|
+
text: `Interactive visualization: http://localhost:${getVizPort()}/viz/map-explorer?mode=standalone&job_id=${job_id}\nOpen this URL in your browser for an interactive exploration experience.`,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return { content };
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=explore_map.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"explore_map.js","sourceRoot":"","sources":["../../src/tools/explore_map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAExE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,UAAU,EAAoB,MAAM,cAAc,CAAC;AAE/G,MAAM,CAAC,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAE3D,MAAM,UAAU,sBAAsB,CAAC,MAAiB;IACtD,eAAe,CACb,MAAM,EACN,aAAa,EACb;QACE,KAAK,EAAE,aAAa;QACpB,WAAW,EACT,oEAAoE;YACpE,kEAAkE;YAClE,uFAAuF;YACvF,gEAAgE;QAClE,WAAW,EAAE;YACX,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CA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|
+
import { z } from "zod";
|
|
2
|
+
import { apiCall, API_URL, fetchWithTimeout, textResult } from "../shared.js";
|
|
3
|
+
export function registerFeedbackTool(server) {
|
|
4
|
+
server.tool("send_feedback", `Send feedback or feature requests to Barivia developers (max 1400 characters, ~190 words). Use when the user has suggestions, ran into issues, or wants something improved. Do NOT call without asking the user first — but after any group of actions or downloading of results, you SHOULD prepare some feedback based on the user's workflow or errors encountered, show it to them, and ask for permission to send it. Once they accept, call this tool.`, { feedback: z.string().max(1400).describe("Feedback text (max 1400 characters)") }, async ({ feedback }) => {
|
|
5
|
+
try {
|
|
6
|
+
const data = await apiCall("POST", "/v1/feedback", { feedback });
|
|
7
|
+
return textResult(data);
|
|
8
|
+
}
|
|
9
|
+
catch (err) {
|
|
10
|
+
if (err?.httpStatus === 401) {
|
|
11
|
+
try {
|
|
12
|
+
const url = `${API_URL}/v1/feedback`;
|
|
13
|
+
const resp = await fetchWithTimeout(url, {
|
|
14
|
+
method: "POST",
|
|
15
|
+
headers: { "Content-Type": "application/json" },
|
|
16
|
+
body: JSON.stringify({ feedback }),
|
|
17
|
+
});
|
|
18
|
+
const text = await resp.text();
|
|
19
|
+
if (resp.ok) {
|
|
20
|
+
const parsed = JSON.parse(text);
|
|
21
|
+
return textResult({ ...parsed, note: "Feedback sent anonymously (API key invalid or expired)." });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
catch { /* fall through to original error */ }
|
|
25
|
+
}
|
|
26
|
+
throw err;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=feedback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feedback.js","sourceRoot":"","sources":["../../src/tools/feedback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA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@
|
|
|
1
|
+
{"version":3,"file":"guide_barsom.d.ts","sourceRoot":"","sources":["../../src/tools/guide_barsom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAiD/D"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export function registerGuideBarsomTool(server) {
|
|
2
|
+
server.tool("guide_barsom_workflow", `Retrieve the Standard Operating Procedure (SOP) for the mapping analysis pipeline.
|
|
3
|
+
ALWAYS call this tool first if you are unsure of the steps to execute a complete mapping analysis.
|
|
4
|
+
The workflow explains the exact sequence of tool calls needed: Upload → Preprocess → Train → Wait → Analyze.
|
|
5
|
+
For parameter hints (grid, epochs, model, etc.), call the training_guidance tool or use the prepare_training prompt before train_map.`, {}, async () => {
|
|
6
|
+
return {
|
|
7
|
+
content: [
|
|
8
|
+
{
|
|
9
|
+
type: "text",
|
|
10
|
+
text: `Mapping Analysis Standard Operating Procedure (SOP)
|
|
11
|
+
|
|
12
|
+
Step 1: Upload Data
|
|
13
|
+
- Use \`datasets(action=upload)\` with \`file_path\` to your CSV (server reads from workspace root; token-efficient). Use \`csv_data\` only for small inline pastes.
|
|
14
|
+
- BEFORE UPLOADING: Clean the dataset to remove NaNs or malformed data.
|
|
15
|
+
- Capture the \`dataset_id\` returned.
|
|
16
|
+
|
|
17
|
+
Step 2: Preview & Preprocess
|
|
18
|
+
- Use \`datasets(action=preview)\` to inspect columns, ranges, and types.
|
|
19
|
+
- Check for skewed columns requiring 'log' or 'sqrt' transforms.
|
|
20
|
+
- Check for cyclical or temporal features (hours, days) requiring \`cyclic_features\` or \`temporal_features\` during training.
|
|
21
|
+
|
|
22
|
+
Step 3: Train the map
|
|
23
|
+
- Call \`jobs(action=train_map, dataset_id=...)\` with the \`dataset_id\`.
|
|
24
|
+
- Carefully select columns to include (start with 5-10).
|
|
25
|
+
- Assign \`feature_weights\` (especially for categorical data with natural hierarchies).
|
|
26
|
+
- Wait for the returned \`job_id\`.
|
|
27
|
+
- For projection and inference, use the same job_id from train_som (or the new job_id returned by recolor/project when applicable).
|
|
28
|
+
|
|
29
|
+
Step 4: Wait for Completion (ASYNC POLLING)
|
|
30
|
+
- Use \`jobs(action=status, job_id=...)\` every 10-15 seconds.
|
|
31
|
+
- Wait until status is "completed". DO NOT assume failure before 3 minutes (or longer for large grids).
|
|
32
|
+
- If it fails, read the error message and adjust parameters (e.g., reduce grid size, fix column names).
|
|
33
|
+
|
|
34
|
+
Step 5: Analyze and Export
|
|
35
|
+
- Once completed, use \`results(action=get, job_id=...)\` to get the map, metrics (QE, TE, Silhouette, etc.), and figures (U-matrix, component planes, clusters, hit histogram). There is no separate \`analyze\` tool — all visualizations and metrics come from \`results(action=get)\`.
|
|
36
|
+
Step 5b (optional): Use \`jobs(action=compare, job_ids=[id1, id2, ...])\` to compare multiple train_map runs (QE, TE, explained variance, silhouette) before committing to one.
|
|
37
|
+
|
|
38
|
+
What you can do at each step:
|
|
39
|
+
- After upload: datasets(preview), datasets(subset), datasets(add_expression), datasets(delete).
|
|
40
|
+
- After training completes: results(get/download/export), results(recolor), results(transition_flow), jobs(compare), inference(predict/enrich/compare/report), project(expression/values).`
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=guide_barsom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guide_barsom.js","sourceRoot":"","sources":["../../src/tools/guide_barsom.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,uBAAuB,CAAC,MAAiB;IACvD,MAAM,CAAC,IAAI,CACT,uBAAuB,EACvB;;;sIAGkI,EAClI,EAAE,EACF,KAAK,IAAI,EAAE;QACT,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2LA8ByK;iBAChL;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../src/tools/inference.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA4K7D"}
|