Skip to content

Commit aa54ec2

Browse files
committed
0.2.1 release
1 parent 457c864 commit aa54ec2

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@faim-group/mcp",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"description": "MCP server for FAIM forecasting SDK - Enables Claude to perform time series forecasting using Chronos2 and TiRex models",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ server.tool(
129129
x: z
130130
.any()
131131
.describe(
132-
'Time series data to forecast from. Can be a 1D array (single series), 2D array (multiple series/batch or multivariate per model), or 3D array (batch, sequence, features).'
132+
'Time series data to forecast from. MUST be an array, NOT a string. Can be a 1D array [1,2,3,4,5], 2D array [[1,2],[3,4]] (multiple series/batch or multivariate per model), or 3D array [[[1],[2]]] (batch, sequence, features). Never pass x as a JSON string - always pass as an actual array.'
133133
),
134134
horizon: z
135135
.number()

src/utils/validation.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,23 @@ export function validateForecastRequest(request: unknown): ErrorResponse | null
115115
};
116116
}
117117

118+
// Handle case where x is passed as a JSON string (e.g., from Claude Desktop)
119+
let xData = req.x;
120+
if (typeof xData === 'string') {
121+
try {
122+
xData = JSON.parse(xData);
123+
} catch (e) {
124+
return {
125+
error_code: 'INVALID_PARAMETER',
126+
message: 'x parameter must be an array. If passing as string, it must be valid JSON.',
127+
field: 'x',
128+
details: `Failed to parse x: ${(e as Error).message}`,
129+
};
130+
}
131+
}
132+
118133
// Validate x is an array-like structure
119-
const xError = validateArrayInput(req.x);
134+
const xError = validateArrayInput(xData);
120135
if (xError) {
121136
return {
122137
error_code: xError.error_code,

0 commit comments

Comments
 (0)