@valbuild/mcp 0.127.0 → 0.128.0
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/CHANGELOG.md +9 -0
- package/README.md +2 -2
- package/dist/valbuild-mcp.cjs.dev.js +15 -15
- package/dist/valbuild-mcp.cjs.prod.js +15 -15
- package/dist/valbuild-mcp.esm.js +15 -15
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @valbuild/mcp
|
|
2
2
|
|
|
3
|
+
## 0.128.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`8b52b33`](https://github.com/valbuild/val/commit/8b52b33e1f629f14f66cc71dcc7cf415d210c7d4), [`362fb49`](https://github.com/valbuild/val/commit/362fb49f30d2b04c4ff78d54dca2bf5ad978a05c), [`c595799`](https://github.com/valbuild/val/commit/c59579977a436ec530c6c69f2b340ab9829d97ab)]:
|
|
8
|
+
- @valbuild/core@0.128.0
|
|
9
|
+
- @valbuild/server@0.128.0
|
|
10
|
+
- @valbuild/shared@0.128.0
|
|
11
|
+
|
|
3
12
|
## 0.127.0
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ Writing:
|
|
|
39
39
|
| `create_patch` | change a value at a path |
|
|
40
40
|
| `duplicate_source` | copy an array item or record entry |
|
|
41
41
|
| `empty_at_path` | build an empty value the schema accepts, to fill in |
|
|
42
|
-
| `remove_image_gallery_entry` | drop an image from an `s.
|
|
42
|
+
| `remove_image_gallery_entry` | drop an image from an `s.imageset()` gallery |
|
|
43
43
|
| `upload_image` | add one — see below |
|
|
44
44
|
|
|
45
45
|
Every write is validated against the schema before it is stored, and refused
|
|
@@ -70,7 +70,7 @@ const { valMcpAuthorize, valMcpTools } = initValMcp(valModules, config, {
|
|
|
70
70
|
Leave `extraTools` out and everything else still works — an agent can then read,
|
|
71
71
|
validate and edit content, but not add an image.
|
|
72
72
|
|
|
73
|
-
Remotely stored images (`s.
|
|
73
|
+
Remotely stored images (`s.imageset({...}).remote()`) work through the same tool.
|
|
74
74
|
Adding one uploads nothing to Val's content host — the bytes go into the patch
|
|
75
75
|
store, and the push happens at publish — so the only thing it needs is the
|
|
76
76
|
project's bucket list, read with your app's own credential (its API key, or the
|
|
@@ -1656,7 +1656,7 @@ function writeTools() {
|
|
|
1656
1656
|
title: "Remove an image gallery entry",
|
|
1657
1657
|
description: "Remove one image from an image gallery module by its file path. This deletes the entry and the file it refers to.",
|
|
1658
1658
|
inputSchema: zod.z.object({
|
|
1659
|
-
moduleFilePath: ModuleFilePathSchema$1.describe("The gallery module, i.e. one declared with s.
|
|
1659
|
+
moduleFilePath: ModuleFilePathSchema$1.describe("The gallery module, i.e. one declared with s.imageset() or s.fileset()."),
|
|
1660
1660
|
filePath: zod.z.string().describe('The gallery key to remove, e.g. "/public/val/photo_a1b2c.jpg".')
|
|
1661
1661
|
}),
|
|
1662
1662
|
// Destructive: it removes content and the underlying file, so a host
|
|
@@ -2317,7 +2317,7 @@ function _load() {
|
|
|
2317
2317
|
_context.n = 1;
|
|
2318
2318
|
break;
|
|
2319
2319
|
}
|
|
2320
|
-
return _context.a(2, err("unsupported", "This Val project is not connected to Val Build, so there is nowhere to upload a remote image to. Set `project` in val.config (or the VAL_PROJECT environment variable), or use a schema without
|
|
2320
|
+
return _context.a(2, err("unsupported", "This Val project is not connected to Val Build, so there is nowhere to upload a remote image to. Set `project` in val.config (or the VAL_PROJECT environment variable), or use a schema without `.remote()`."));
|
|
2321
2321
|
case 1:
|
|
2322
2322
|
_context.n = 2;
|
|
2323
2323
|
return server.resolveRemoteFileAuth(options);
|
|
@@ -2444,7 +2444,7 @@ function buildRemoteRef(input) {
|
|
|
2444
2444
|
* that installs Val. So the host builds this one and hands it in — see
|
|
2445
2445
|
* `createValTools`'s `extraTools`, and `@valbuild/mcp/sharp`.
|
|
2446
2446
|
*
|
|
2447
|
-
* What it deliberately does NOT do: remote files. `s.image(
|
|
2447
|
+
* What it deliberately does NOT do: remote files. `s.image().remote()`
|
|
2448
2448
|
* uploads straight to Val's content host through a presigned nonce, which is
|
|
2449
2449
|
* the one path in local mode that needs a personal access token
|
|
2450
2450
|
* (`docs/plans/mcp.md` D.1). Refused with a message that says so rather than
|
|
@@ -2489,7 +2489,7 @@ function createValImageTools(processor, options) {
|
|
|
2489
2489
|
return [defineTool({
|
|
2490
2490
|
name: "upload_image",
|
|
2491
2491
|
title: "Upload an image",
|
|
2492
|
-
description: "Upload an image file and put it in an image field, or add it to an image gallery module (one declared with s.
|
|
2492
|
+
description: "Upload an image file and put it in an image field, or add it to an image gallery module (one declared with s.imageset()). Give it either imageFilePath — a path to a file on the machine this app runs on — or imageBase64. The image is re-encoded first if the schema asks for that. Works for remotely stored images too (s.image().remote()), which need the project to be connected to Val Build.",
|
|
2493
2493
|
inputSchema: zod.z.object({
|
|
2494
2494
|
moduleFilePath: ModuleFilePathSchema,
|
|
2495
2495
|
path: zod.z.array(zod.z.string())["default"]([]).describe('Path of the image field within the module, e.g. ["hero","image"]. Leave empty when the module itself is an image gallery — the image is then added to it under a generated key.'),
|
|
@@ -2567,7 +2567,7 @@ function createValImageTools(processor, options) {
|
|
|
2567
2567
|
// Where the bytes live, always: a `/public/...` path in the patch
|
|
2568
2568
|
// store. For a remote image the CONTENT points somewhere else, but the
|
|
2569
2569
|
// bytes still land here and stay here until publish pushes them.
|
|
2570
|
-
storedPath = "".concat(target.
|
|
2570
|
+
storedPath = "".concat(target.dir, "/").concat(generated);
|
|
2571
2571
|
_context.n = 9;
|
|
2572
2572
|
return resolveRef(target, settingsFor(deps.config), {
|
|
2573
2573
|
bytes: prepared.bytes,
|
|
@@ -2695,7 +2695,7 @@ function _resolveRef() {
|
|
|
2695
2695
|
_context3.n = 2;
|
|
2696
2696
|
break;
|
|
2697
2697
|
}
|
|
2698
|
-
return _context3.a(2, err("invalid-args", "A remote image has to be stored under /public, and this schema's directory is ".concat(JSON.stringify(target.
|
|
2698
|
+
return _context3.a(2, err("invalid-args", "A remote image has to be stored under /public, and this schema's directory is ".concat(JSON.stringify(target.dir), ".")));
|
|
2699
2699
|
case 2:
|
|
2700
2700
|
_context3.n = 3;
|
|
2701
2701
|
return resolveRemoteUploadTarget(loadSettings);
|
|
@@ -2734,9 +2734,9 @@ function _resolveRef() {
|
|
|
2734
2734
|
/** The default in `createFilePatch`, and the same default here. */
|
|
2735
2735
|
var DEFAULT_DIRECTORY = "/public/val";
|
|
2736
2736
|
function resolveTarget(deps, moduleSchema, fieldPath) {
|
|
2737
|
-
var _ref2, _schema$options$
|
|
2737
|
+
var _ref2, _schema$options$dir, _schema$options, _schema$options$accep, _schema$options2, _schema$options3;
|
|
2738
2738
|
if (fieldPath.length === 0) {
|
|
2739
|
-
var _moduleSchema$
|
|
2739
|
+
var _moduleSchema$dir;
|
|
2740
2740
|
if (moduleSchema.type !== "record" || moduleSchema.mediaType !== "images") {
|
|
2741
2741
|
return {
|
|
2742
2742
|
status: "error",
|
|
@@ -2747,7 +2747,7 @@ function resolveTarget(deps, moduleSchema, fieldPath) {
|
|
|
2747
2747
|
status: "ok",
|
|
2748
2748
|
kind: "gallery",
|
|
2749
2749
|
gallerySchema: moduleSchema,
|
|
2750
|
-
|
|
2750
|
+
dir: (_moduleSchema$dir = moduleSchema.dir) !== null && _moduleSchema$dir !== void 0 ? _moduleSchema$dir : DEFAULT_DIRECTORY,
|
|
2751
2751
|
accept: moduleSchema.accept,
|
|
2752
2752
|
encode: internal.resolveEncodeSettings(undefined, moduleSchema.encode),
|
|
2753
2753
|
altRequired: altIsRequired(moduleSchema),
|
|
@@ -2800,7 +2800,7 @@ function resolveTarget(deps, moduleSchema, fieldPath) {
|
|
|
2800
2800
|
kind: "field",
|
|
2801
2801
|
referencedModule: referencedModule,
|
|
2802
2802
|
galleryBacked: referencedModule !== undefined,
|
|
2803
|
-
|
|
2803
|
+
dir: (_ref2 = (_schema$options$dir = (_schema$options = schema.options) === null || _schema$options === void 0 ? void 0 : _schema$options.dir) !== null && _schema$options$dir !== void 0 ? _schema$options$dir : galleryRecord === null || galleryRecord === void 0 ? void 0 : galleryRecord.dir) !== null && _ref2 !== void 0 ? _ref2 : DEFAULT_DIRECTORY,
|
|
2804
2804
|
accept: (_schema$options$accep = (_schema$options2 = schema.options) === null || _schema$options2 === void 0 ? void 0 : _schema$options2.accept) !== null && _schema$options$accep !== void 0 ? _schema$options$accep : galleryRecord === null || galleryRecord === void 0 ? void 0 : galleryRecord.accept,
|
|
2805
2805
|
encode: internal.resolveEncodeSettings((_schema$options3 = schema.options) === null || _schema$options3 === void 0 ? void 0 : _schema$options3.encode, galleryRecord === null || galleryRecord === void 0 ? void 0 : galleryRecord.encode),
|
|
2806
2806
|
// Only a gallery has an alt schema to satisfy. A plain `s.image()` field
|
|
@@ -2827,8 +2827,8 @@ function galleryEntryImageSchema(gallery) {
|
|
|
2827
2827
|
opt: false,
|
|
2828
2828
|
options: _objectSpread2(_objectSpread2({}, gallery.accept ? {
|
|
2829
2829
|
accept: gallery.accept
|
|
2830
|
-
} : {}), gallery.
|
|
2831
|
-
|
|
2830
|
+
} : {}), gallery.dir ? {
|
|
2831
|
+
dir: gallery.dir
|
|
2832
2832
|
} : {})
|
|
2833
2833
|
};
|
|
2834
2834
|
}
|
|
@@ -2836,8 +2836,8 @@ function galleryEntryImageSchema(gallery) {
|
|
|
2836
2836
|
/**
|
|
2837
2837
|
* Does this gallery insist on alt text?
|
|
2838
2838
|
*
|
|
2839
|
-
* `s.
|
|
2840
|
-
* without one stores `null`. A gallery that passed its own — `s.
|
|
2839
|
+
* `s.imageset()` gives `alt` a nullable string by default, and an entry written
|
|
2840
|
+
* without one stores `null`. A gallery that passed its own — `s.imageset({ alt:
|
|
2841
2841
|
* s.string().minLength(4) })`, which the example app does — has made it
|
|
2842
2842
|
* required, and an upload with no `alt` cannot satisfy it however it is
|
|
2843
2843
|
* written. Asked here so the caller is told what to pass, rather than shown a
|
|
@@ -3365,7 +3365,7 @@ var packageJson = {
|
|
|
3365
3365
|
"./package.json": "./package.json"
|
|
3366
3366
|
},
|
|
3367
3367
|
types: "dist/valbuild-mcp.cjs.d.ts",
|
|
3368
|
-
version: "0.
|
|
3368
|
+
version: "0.128.0",
|
|
3369
3369
|
scripts: {
|
|
3370
3370
|
typecheck: "tsc --noEmit",
|
|
3371
3371
|
test: "jest",
|
|
@@ -1656,7 +1656,7 @@ function writeTools() {
|
|
|
1656
1656
|
title: "Remove an image gallery entry",
|
|
1657
1657
|
description: "Remove one image from an image gallery module by its file path. This deletes the entry and the file it refers to.",
|
|
1658
1658
|
inputSchema: zod.z.object({
|
|
1659
|
-
moduleFilePath: ModuleFilePathSchema$1.describe("The gallery module, i.e. one declared with s.
|
|
1659
|
+
moduleFilePath: ModuleFilePathSchema$1.describe("The gallery module, i.e. one declared with s.imageset() or s.fileset()."),
|
|
1660
1660
|
filePath: zod.z.string().describe('The gallery key to remove, e.g. "/public/val/photo_a1b2c.jpg".')
|
|
1661
1661
|
}),
|
|
1662
1662
|
// Destructive: it removes content and the underlying file, so a host
|
|
@@ -2317,7 +2317,7 @@ function _load() {
|
|
|
2317
2317
|
_context.n = 1;
|
|
2318
2318
|
break;
|
|
2319
2319
|
}
|
|
2320
|
-
return _context.a(2, err("unsupported", "This Val project is not connected to Val Build, so there is nowhere to upload a remote image to. Set `project` in val.config (or the VAL_PROJECT environment variable), or use a schema without
|
|
2320
|
+
return _context.a(2, err("unsupported", "This Val project is not connected to Val Build, so there is nowhere to upload a remote image to. Set `project` in val.config (or the VAL_PROJECT environment variable), or use a schema without `.remote()`."));
|
|
2321
2321
|
case 1:
|
|
2322
2322
|
_context.n = 2;
|
|
2323
2323
|
return server.resolveRemoteFileAuth(options);
|
|
@@ -2444,7 +2444,7 @@ function buildRemoteRef(input) {
|
|
|
2444
2444
|
* that installs Val. So the host builds this one and hands it in — see
|
|
2445
2445
|
* `createValTools`'s `extraTools`, and `@valbuild/mcp/sharp`.
|
|
2446
2446
|
*
|
|
2447
|
-
* What it deliberately does NOT do: remote files. `s.image(
|
|
2447
|
+
* What it deliberately does NOT do: remote files. `s.image().remote()`
|
|
2448
2448
|
* uploads straight to Val's content host through a presigned nonce, which is
|
|
2449
2449
|
* the one path in local mode that needs a personal access token
|
|
2450
2450
|
* (`docs/plans/mcp.md` D.1). Refused with a message that says so rather than
|
|
@@ -2489,7 +2489,7 @@ function createValImageTools(processor, options) {
|
|
|
2489
2489
|
return [defineTool({
|
|
2490
2490
|
name: "upload_image",
|
|
2491
2491
|
title: "Upload an image",
|
|
2492
|
-
description: "Upload an image file and put it in an image field, or add it to an image gallery module (one declared with s.
|
|
2492
|
+
description: "Upload an image file and put it in an image field, or add it to an image gallery module (one declared with s.imageset()). Give it either imageFilePath — a path to a file on the machine this app runs on — or imageBase64. The image is re-encoded first if the schema asks for that. Works for remotely stored images too (s.image().remote()), which need the project to be connected to Val Build.",
|
|
2493
2493
|
inputSchema: zod.z.object({
|
|
2494
2494
|
moduleFilePath: ModuleFilePathSchema,
|
|
2495
2495
|
path: zod.z.array(zod.z.string())["default"]([]).describe('Path of the image field within the module, e.g. ["hero","image"]. Leave empty when the module itself is an image gallery — the image is then added to it under a generated key.'),
|
|
@@ -2567,7 +2567,7 @@ function createValImageTools(processor, options) {
|
|
|
2567
2567
|
// Where the bytes live, always: a `/public/...` path in the patch
|
|
2568
2568
|
// store. For a remote image the CONTENT points somewhere else, but the
|
|
2569
2569
|
// bytes still land here and stay here until publish pushes them.
|
|
2570
|
-
storedPath = "".concat(target.
|
|
2570
|
+
storedPath = "".concat(target.dir, "/").concat(generated);
|
|
2571
2571
|
_context.n = 9;
|
|
2572
2572
|
return resolveRef(target, settingsFor(deps.config), {
|
|
2573
2573
|
bytes: prepared.bytes,
|
|
@@ -2695,7 +2695,7 @@ function _resolveRef() {
|
|
|
2695
2695
|
_context3.n = 2;
|
|
2696
2696
|
break;
|
|
2697
2697
|
}
|
|
2698
|
-
return _context3.a(2, err("invalid-args", "A remote image has to be stored under /public, and this schema's directory is ".concat(JSON.stringify(target.
|
|
2698
|
+
return _context3.a(2, err("invalid-args", "A remote image has to be stored under /public, and this schema's directory is ".concat(JSON.stringify(target.dir), ".")));
|
|
2699
2699
|
case 2:
|
|
2700
2700
|
_context3.n = 3;
|
|
2701
2701
|
return resolveRemoteUploadTarget(loadSettings);
|
|
@@ -2734,9 +2734,9 @@ function _resolveRef() {
|
|
|
2734
2734
|
/** The default in `createFilePatch`, and the same default here. */
|
|
2735
2735
|
var DEFAULT_DIRECTORY = "/public/val";
|
|
2736
2736
|
function resolveTarget(deps, moduleSchema, fieldPath) {
|
|
2737
|
-
var _ref2, _schema$options$
|
|
2737
|
+
var _ref2, _schema$options$dir, _schema$options, _schema$options$accep, _schema$options2, _schema$options3;
|
|
2738
2738
|
if (fieldPath.length === 0) {
|
|
2739
|
-
var _moduleSchema$
|
|
2739
|
+
var _moduleSchema$dir;
|
|
2740
2740
|
if (moduleSchema.type !== "record" || moduleSchema.mediaType !== "images") {
|
|
2741
2741
|
return {
|
|
2742
2742
|
status: "error",
|
|
@@ -2747,7 +2747,7 @@ function resolveTarget(deps, moduleSchema, fieldPath) {
|
|
|
2747
2747
|
status: "ok",
|
|
2748
2748
|
kind: "gallery",
|
|
2749
2749
|
gallerySchema: moduleSchema,
|
|
2750
|
-
|
|
2750
|
+
dir: (_moduleSchema$dir = moduleSchema.dir) !== null && _moduleSchema$dir !== void 0 ? _moduleSchema$dir : DEFAULT_DIRECTORY,
|
|
2751
2751
|
accept: moduleSchema.accept,
|
|
2752
2752
|
encode: internal.resolveEncodeSettings(undefined, moduleSchema.encode),
|
|
2753
2753
|
altRequired: altIsRequired(moduleSchema),
|
|
@@ -2800,7 +2800,7 @@ function resolveTarget(deps, moduleSchema, fieldPath) {
|
|
|
2800
2800
|
kind: "field",
|
|
2801
2801
|
referencedModule: referencedModule,
|
|
2802
2802
|
galleryBacked: referencedModule !== undefined,
|
|
2803
|
-
|
|
2803
|
+
dir: (_ref2 = (_schema$options$dir = (_schema$options = schema.options) === null || _schema$options === void 0 ? void 0 : _schema$options.dir) !== null && _schema$options$dir !== void 0 ? _schema$options$dir : galleryRecord === null || galleryRecord === void 0 ? void 0 : galleryRecord.dir) !== null && _ref2 !== void 0 ? _ref2 : DEFAULT_DIRECTORY,
|
|
2804
2804
|
accept: (_schema$options$accep = (_schema$options2 = schema.options) === null || _schema$options2 === void 0 ? void 0 : _schema$options2.accept) !== null && _schema$options$accep !== void 0 ? _schema$options$accep : galleryRecord === null || galleryRecord === void 0 ? void 0 : galleryRecord.accept,
|
|
2805
2805
|
encode: internal.resolveEncodeSettings((_schema$options3 = schema.options) === null || _schema$options3 === void 0 ? void 0 : _schema$options3.encode, galleryRecord === null || galleryRecord === void 0 ? void 0 : galleryRecord.encode),
|
|
2806
2806
|
// Only a gallery has an alt schema to satisfy. A plain `s.image()` field
|
|
@@ -2827,8 +2827,8 @@ function galleryEntryImageSchema(gallery) {
|
|
|
2827
2827
|
opt: false,
|
|
2828
2828
|
options: _objectSpread2(_objectSpread2({}, gallery.accept ? {
|
|
2829
2829
|
accept: gallery.accept
|
|
2830
|
-
} : {}), gallery.
|
|
2831
|
-
|
|
2830
|
+
} : {}), gallery.dir ? {
|
|
2831
|
+
dir: gallery.dir
|
|
2832
2832
|
} : {})
|
|
2833
2833
|
};
|
|
2834
2834
|
}
|
|
@@ -2836,8 +2836,8 @@ function galleryEntryImageSchema(gallery) {
|
|
|
2836
2836
|
/**
|
|
2837
2837
|
* Does this gallery insist on alt text?
|
|
2838
2838
|
*
|
|
2839
|
-
* `s.
|
|
2840
|
-
* without one stores `null`. A gallery that passed its own — `s.
|
|
2839
|
+
* `s.imageset()` gives `alt` a nullable string by default, and an entry written
|
|
2840
|
+
* without one stores `null`. A gallery that passed its own — `s.imageset({ alt:
|
|
2841
2841
|
* s.string().minLength(4) })`, which the example app does — has made it
|
|
2842
2842
|
* required, and an upload with no `alt` cannot satisfy it however it is
|
|
2843
2843
|
* written. Asked here so the caller is told what to pass, rather than shown a
|
|
@@ -3365,7 +3365,7 @@ var packageJson = {
|
|
|
3365
3365
|
"./package.json": "./package.json"
|
|
3366
3366
|
},
|
|
3367
3367
|
types: "dist/valbuild-mcp.cjs.d.ts",
|
|
3368
|
-
version: "0.
|
|
3368
|
+
version: "0.128.0",
|
|
3369
3369
|
scripts: {
|
|
3370
3370
|
typecheck: "tsc --noEmit",
|
|
3371
3371
|
test: "jest",
|
package/dist/valbuild-mcp.esm.js
CHANGED
|
@@ -1647,7 +1647,7 @@ function writeTools() {
|
|
|
1647
1647
|
title: "Remove an image gallery entry",
|
|
1648
1648
|
description: "Remove one image from an image gallery module by its file path. This deletes the entry and the file it refers to.",
|
|
1649
1649
|
inputSchema: z.object({
|
|
1650
|
-
moduleFilePath: ModuleFilePathSchema$1.describe("The gallery module, i.e. one declared with s.
|
|
1650
|
+
moduleFilePath: ModuleFilePathSchema$1.describe("The gallery module, i.e. one declared with s.imageset() or s.fileset()."),
|
|
1651
1651
|
filePath: z.string().describe('The gallery key to remove, e.g. "/public/val/photo_a1b2c.jpg".')
|
|
1652
1652
|
}),
|
|
1653
1653
|
// Destructive: it removes content and the underlying file, so a host
|
|
@@ -2308,7 +2308,7 @@ function _load() {
|
|
|
2308
2308
|
_context.n = 1;
|
|
2309
2309
|
break;
|
|
2310
2310
|
}
|
|
2311
|
-
return _context.a(2, err("unsupported", "This Val project is not connected to Val Build, so there is nowhere to upload a remote image to. Set `project` in val.config (or the VAL_PROJECT environment variable), or use a schema without
|
|
2311
|
+
return _context.a(2, err("unsupported", "This Val project is not connected to Val Build, so there is nowhere to upload a remote image to. Set `project` in val.config (or the VAL_PROJECT environment variable), or use a schema without `.remote()`."));
|
|
2312
2312
|
case 1:
|
|
2313
2313
|
_context.n = 2;
|
|
2314
2314
|
return resolveRemoteFileAuth(options);
|
|
@@ -2435,7 +2435,7 @@ function buildRemoteRef(input) {
|
|
|
2435
2435
|
* that installs Val. So the host builds this one and hands it in — see
|
|
2436
2436
|
* `createValTools`'s `extraTools`, and `@valbuild/mcp/sharp`.
|
|
2437
2437
|
*
|
|
2438
|
-
* What it deliberately does NOT do: remote files. `s.image(
|
|
2438
|
+
* What it deliberately does NOT do: remote files. `s.image().remote()`
|
|
2439
2439
|
* uploads straight to Val's content host through a presigned nonce, which is
|
|
2440
2440
|
* the one path in local mode that needs a personal access token
|
|
2441
2441
|
* (`docs/plans/mcp.md` D.1). Refused with a message that says so rather than
|
|
@@ -2480,7 +2480,7 @@ function createValImageTools(processor, options) {
|
|
|
2480
2480
|
return [defineTool({
|
|
2481
2481
|
name: "upload_image",
|
|
2482
2482
|
title: "Upload an image",
|
|
2483
|
-
description: "Upload an image file and put it in an image field, or add it to an image gallery module (one declared with s.
|
|
2483
|
+
description: "Upload an image file and put it in an image field, or add it to an image gallery module (one declared with s.imageset()). Give it either imageFilePath — a path to a file on the machine this app runs on — or imageBase64. The image is re-encoded first if the schema asks for that. Works for remotely stored images too (s.image().remote()), which need the project to be connected to Val Build.",
|
|
2484
2484
|
inputSchema: z.object({
|
|
2485
2485
|
moduleFilePath: ModuleFilePathSchema,
|
|
2486
2486
|
path: z.array(z.string())["default"]([]).describe('Path of the image field within the module, e.g. ["hero","image"]. Leave empty when the module itself is an image gallery — the image is then added to it under a generated key.'),
|
|
@@ -2558,7 +2558,7 @@ function createValImageTools(processor, options) {
|
|
|
2558
2558
|
// Where the bytes live, always: a `/public/...` path in the patch
|
|
2559
2559
|
// store. For a remote image the CONTENT points somewhere else, but the
|
|
2560
2560
|
// bytes still land here and stay here until publish pushes them.
|
|
2561
|
-
storedPath = "".concat(target.
|
|
2561
|
+
storedPath = "".concat(target.dir, "/").concat(generated);
|
|
2562
2562
|
_context.n = 9;
|
|
2563
2563
|
return resolveRef(target, settingsFor(deps.config), {
|
|
2564
2564
|
bytes: prepared.bytes,
|
|
@@ -2686,7 +2686,7 @@ function _resolveRef() {
|
|
|
2686
2686
|
_context3.n = 2;
|
|
2687
2687
|
break;
|
|
2688
2688
|
}
|
|
2689
|
-
return _context3.a(2, err("invalid-args", "A remote image has to be stored under /public, and this schema's directory is ".concat(JSON.stringify(target.
|
|
2689
|
+
return _context3.a(2, err("invalid-args", "A remote image has to be stored under /public, and this schema's directory is ".concat(JSON.stringify(target.dir), ".")));
|
|
2690
2690
|
case 2:
|
|
2691
2691
|
_context3.n = 3;
|
|
2692
2692
|
return resolveRemoteUploadTarget(loadSettings);
|
|
@@ -2725,9 +2725,9 @@ function _resolveRef() {
|
|
|
2725
2725
|
/** The default in `createFilePatch`, and the same default here. */
|
|
2726
2726
|
var DEFAULT_DIRECTORY = "/public/val";
|
|
2727
2727
|
function resolveTarget(deps, moduleSchema, fieldPath) {
|
|
2728
|
-
var _ref2, _schema$options$
|
|
2728
|
+
var _ref2, _schema$options$dir, _schema$options, _schema$options$accep, _schema$options2, _schema$options3;
|
|
2729
2729
|
if (fieldPath.length === 0) {
|
|
2730
|
-
var _moduleSchema$
|
|
2730
|
+
var _moduleSchema$dir;
|
|
2731
2731
|
if (moduleSchema.type !== "record" || moduleSchema.mediaType !== "images") {
|
|
2732
2732
|
return {
|
|
2733
2733
|
status: "error",
|
|
@@ -2738,7 +2738,7 @@ function resolveTarget(deps, moduleSchema, fieldPath) {
|
|
|
2738
2738
|
status: "ok",
|
|
2739
2739
|
kind: "gallery",
|
|
2740
2740
|
gallerySchema: moduleSchema,
|
|
2741
|
-
|
|
2741
|
+
dir: (_moduleSchema$dir = moduleSchema.dir) !== null && _moduleSchema$dir !== void 0 ? _moduleSchema$dir : DEFAULT_DIRECTORY,
|
|
2742
2742
|
accept: moduleSchema.accept,
|
|
2743
2743
|
encode: resolveEncodeSettings(undefined, moduleSchema.encode),
|
|
2744
2744
|
altRequired: altIsRequired(moduleSchema),
|
|
@@ -2791,7 +2791,7 @@ function resolveTarget(deps, moduleSchema, fieldPath) {
|
|
|
2791
2791
|
kind: "field",
|
|
2792
2792
|
referencedModule: referencedModule,
|
|
2793
2793
|
galleryBacked: referencedModule !== undefined,
|
|
2794
|
-
|
|
2794
|
+
dir: (_ref2 = (_schema$options$dir = (_schema$options = schema.options) === null || _schema$options === void 0 ? void 0 : _schema$options.dir) !== null && _schema$options$dir !== void 0 ? _schema$options$dir : galleryRecord === null || galleryRecord === void 0 ? void 0 : galleryRecord.dir) !== null && _ref2 !== void 0 ? _ref2 : DEFAULT_DIRECTORY,
|
|
2795
2795
|
accept: (_schema$options$accep = (_schema$options2 = schema.options) === null || _schema$options2 === void 0 ? void 0 : _schema$options2.accept) !== null && _schema$options$accep !== void 0 ? _schema$options$accep : galleryRecord === null || galleryRecord === void 0 ? void 0 : galleryRecord.accept,
|
|
2796
2796
|
encode: resolveEncodeSettings((_schema$options3 = schema.options) === null || _schema$options3 === void 0 ? void 0 : _schema$options3.encode, galleryRecord === null || galleryRecord === void 0 ? void 0 : galleryRecord.encode),
|
|
2797
2797
|
// Only a gallery has an alt schema to satisfy. A plain `s.image()` field
|
|
@@ -2818,8 +2818,8 @@ function galleryEntryImageSchema(gallery) {
|
|
|
2818
2818
|
opt: false,
|
|
2819
2819
|
options: _objectSpread2(_objectSpread2({}, gallery.accept ? {
|
|
2820
2820
|
accept: gallery.accept
|
|
2821
|
-
} : {}), gallery.
|
|
2822
|
-
|
|
2821
|
+
} : {}), gallery.dir ? {
|
|
2822
|
+
dir: gallery.dir
|
|
2823
2823
|
} : {})
|
|
2824
2824
|
};
|
|
2825
2825
|
}
|
|
@@ -2827,8 +2827,8 @@ function galleryEntryImageSchema(gallery) {
|
|
|
2827
2827
|
/**
|
|
2828
2828
|
* Does this gallery insist on alt text?
|
|
2829
2829
|
*
|
|
2830
|
-
* `s.
|
|
2831
|
-
* without one stores `null`. A gallery that passed its own — `s.
|
|
2830
|
+
* `s.imageset()` gives `alt` a nullable string by default, and an entry written
|
|
2831
|
+
* without one stores `null`. A gallery that passed its own — `s.imageset({ alt:
|
|
2832
2832
|
* s.string().minLength(4) })`, which the example app does — has made it
|
|
2833
2833
|
* required, and an upload with no `alt` cannot satisfy it however it is
|
|
2834
2834
|
* written. Asked here so the caller is told what to pass, rather than shown a
|
|
@@ -3356,7 +3356,7 @@ var packageJson = {
|
|
|
3356
3356
|
"./package.json": "./package.json"
|
|
3357
3357
|
},
|
|
3358
3358
|
types: "dist/valbuild-mcp.cjs.d.ts",
|
|
3359
|
-
version: "0.
|
|
3359
|
+
version: "0.128.0",
|
|
3360
3360
|
scripts: {
|
|
3361
3361
|
typecheck: "tsc --noEmit",
|
|
3362
3362
|
test: "jest",
|
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"./package.json": "./package.json"
|
|
21
21
|
},
|
|
22
22
|
"types": "dist/valbuild-mcp.cjs.d.ts",
|
|
23
|
-
"version": "0.
|
|
23
|
+
"version": "0.128.0",
|
|
24
24
|
"preconstruct": {
|
|
25
25
|
"entrypoints": [
|
|
26
26
|
"./index.ts",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"minimatch": "^10.2.6",
|
|
33
33
|
"zod": "^4.4.3",
|
|
34
|
-
"@valbuild/core": "0.
|
|
35
|
-
"@valbuild/
|
|
36
|
-
"@valbuild/
|
|
34
|
+
"@valbuild/core": "0.128.0",
|
|
35
|
+
"@valbuild/shared": "0.128.0",
|
|
36
|
+
"@valbuild/server": "0.128.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@prettier/sync": "^0.6.1",
|