touchstone-mcp-tools 1.0.4 → 1.0.5
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.
|
@@ -89,7 +89,7 @@ export class WolvesHandler {
|
|
|
89
89
|
message: `Updated ${subscribers.length} subscriber(s) for experiment "${params.experiment_id}"`,
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
|
-
// Tool
|
|
92
|
+
// Tool 7: get_experiment
|
|
93
93
|
async getExperiment(params) {
|
|
94
94
|
const result = await this.api.getExperiment(params.experiment_id);
|
|
95
95
|
return {
|
|
@@ -144,10 +144,16 @@ export class WolvesHandler {
|
|
|
144
144
|
.sort()
|
|
145
145
|
.reverse()
|
|
146
146
|
.slice(0, limit);
|
|
147
|
-
const records =
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
147
|
+
const records = [];
|
|
148
|
+
for (const f of files) {
|
|
149
|
+
try {
|
|
150
|
+
const content = readFileSync(join(expDir, f), "utf8");
|
|
151
|
+
records.push(JSON.parse(content));
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
// Skip corrupted JSON files
|
|
155
|
+
}
|
|
156
|
+
}
|
|
151
157
|
return {
|
|
152
158
|
data: records,
|
|
153
159
|
message: `Found ${records.length} experiment history record(s)`,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type AxiosError } from "axios";
|
|
2
1
|
import { type TokenUserInfo } from "./token-manager.js";
|
|
3
2
|
export interface TouchStoneApiConfig {
|
|
4
3
|
baseUrl?: string;
|
|
@@ -120,10 +119,6 @@ export interface PaginatedExperimentsResponse {
|
|
|
120
119
|
page_size: number;
|
|
121
120
|
total_pages: number;
|
|
122
121
|
}
|
|
123
|
-
export declare function normalizeError(error: AxiosError): {
|
|
124
|
-
message: string;
|
|
125
|
-
statusCode: number;
|
|
126
|
-
};
|
|
127
122
|
export declare class WolvesApiClient {
|
|
128
123
|
private client;
|
|
129
124
|
private tokenManager;
|
|
@@ -1,16 +1,5 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
2
|
import { TokenManager } from "./token-manager.js";
|
|
3
|
-
// ---- Error Handling ----
|
|
4
|
-
export function normalizeError(error) {
|
|
5
|
-
if (error.response) {
|
|
6
|
-
const detail = error.response.data?.detail || error.message;
|
|
7
|
-
return { message: detail, statusCode: error.response.status };
|
|
8
|
-
}
|
|
9
|
-
if (error.request) {
|
|
10
|
-
return { message: "No response from TouchStone API", statusCode: 0 };
|
|
11
|
-
}
|
|
12
|
-
return { message: error.message, statusCode: 0 };
|
|
13
|
-
}
|
|
14
3
|
// ---- API Client ----
|
|
15
4
|
export class WolvesApiClient {
|
|
16
5
|
client;
|
|
@@ -76,7 +65,7 @@ export class WolvesApiClient {
|
|
|
76
65
|
await this.client.put(`/api/experiments/experiments/${encodeURIComponent(experimentId)}/subscribers`, data);
|
|
77
66
|
}
|
|
78
67
|
async getExperiment(experimentId) {
|
|
79
|
-
const response = await this.client.get(`/api/experiments/experiments/${experimentId}`);
|
|
68
|
+
const response = await this.client.get(`/api/experiments/experiments/${encodeURIComponent(experimentId)}`);
|
|
80
69
|
return response.data;
|
|
81
70
|
}
|
|
82
71
|
async listExperiments(params) {
|