@wavespeed/mcp 1.2.9 → 1.2.10
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/server.js +10 -2
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -94,7 +94,7 @@ function progressTicker(extra, id, startedAt) {
|
|
|
94
94
|
// catch an invented parameter. Fails open when no schema is available, and
|
|
95
95
|
// re-fetches the catalog once before rejecting so a stale cache can't block
|
|
96
96
|
// a valid input.
|
|
97
|
-
async function assertKnownInputs(model, input) {
|
|
97
|
+
async function assertKnownInputs(model, input, consequence = 'and still bills the run, so nothing was submitted') {
|
|
98
98
|
let report;
|
|
99
99
|
try {
|
|
100
100
|
report = findUnknownInputs(input, (await fetchModels()).find((m) => m.model_id === model));
|
|
@@ -113,7 +113,7 @@ async function assertKnownInputs(model, input) {
|
|
|
113
113
|
return s ? `${k} (did you mean ${s}?)` : k;
|
|
114
114
|
});
|
|
115
115
|
throw new Error(`Model ${model} does not accept: ${hints.join(', ')}. The API silently drops unknown ` +
|
|
116
|
-
`inputs
|
|
116
|
+
`inputs ${consequence}. Accepted inputs: ` +
|
|
117
117
|
`${report.known.join(', ')}. See get_model_schema.`);
|
|
118
118
|
}
|
|
119
119
|
// Input properties of an endpoint from the live catalog, for fitting a
|
|
@@ -206,6 +206,12 @@ export function createServer() {
|
|
|
206
206
|
}
|
|
207
207
|
};
|
|
208
208
|
const tool = registerTool(...args);
|
|
209
|
+
// Refuse an argument the tool does not declare. zod objects strip unknown keys by default, so a misspelt
|
|
210
|
+
// name ("inputs" for get_price's "input") ran as if left out and quoted the model with no inputs at all.
|
|
211
|
+
if (typeof tool.inputSchema?.strict === 'function') {
|
|
212
|
+
const accepted = Object.keys(tool.inputSchema.shape ?? {}).sort().join(', ') || 'none';
|
|
213
|
+
tool.inputSchema = tool.inputSchema.strict(`Unknown argument for ${name}. It accepts: ${accepted}.`);
|
|
214
|
+
}
|
|
209
215
|
const meta = toolMeta(name);
|
|
210
216
|
if (meta)
|
|
211
217
|
tool.update({ _meta: meta });
|
|
@@ -463,6 +469,8 @@ export function createServer() {
|
|
|
463
469
|
upload: async (p) => (await uploadFile(p)).url,
|
|
464
470
|
});
|
|
465
471
|
const priceInput = resolved.input;
|
|
472
|
+
// Same guard as run_model: a key the model does not declare is dropped by the API and the quote ignores it.
|
|
473
|
+
await assertKnownInputs(model, priceInput, 'so the quote would not account for them');
|
|
466
474
|
const data = await fetchPricing(model, priceInput);
|
|
467
475
|
return ok({ ...data, estimate: true, disclaimer: PRICE_DISCLAIMER, playground_url: modelPlaygroundUrl(model) });
|
|
468
476
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wavespeed/mcp",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.10",
|
|
4
4
|
"description": "WaveSpeed MCP server — run any model on the live WaveSpeed catalog (image, video, audio, 3D) with schema introspection, local-file upload, and price quotes.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|