@brander/mcp-tools 0.2.3 → 0.2.4
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/app/index.html +986 -986
- package/dist/server/elements/click-behaviors.d.ts.map +1 -1
- package/dist/server/elements/click-behaviors.js +4 -0
- package/dist/server/elements/element-functions.d.ts.map +1 -1
- package/dist/server/elements/element-functions.js +6 -0
- package/dist/server/tools/element-definitions.d.ts +1 -1
- package/dist/server/tools/element-definitions.d.ts.map +1 -1
- package/dist/server/tools/element-definitions.js +6 -1
- package/dist/server/tools/generate-screen-schema.d.ts +17 -1
- package/dist/server/tools/generate-screen-schema.d.ts.map +1 -1
- package/dist/server/tools/generate-screen-schema.js +18 -3
- package/dist/server/types/element-types.d.ts +1 -0
- package/dist/server/types/element-types.d.ts.map +1 -1
- package/dist/server/types/element-types.js +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"click-behaviors.d.ts","sourceRoot":"","sources":["../../../src/elements/click-behaviors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,WAAW,mBAAmB;IAClC,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,WAAW,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"click-behaviors.d.ts","sourceRoot":"","sources":["../../../src/elements/click-behaviors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,WAAW,mBAAmB;IAClC,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,WAAW,EAAE,mBAAmB,CAiE9E,CAAC;AAEF,6CAA6C;AAC7C,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,WAAW,GAAG,mBAAmB,GAAG,SAAS,CAE1F"}
|
|
@@ -60,6 +60,10 @@ export const ELEMENT_BEHAVIOR_REGISTRY = {
|
|
|
60
60
|
queryTemplate: "[actionQuery]",
|
|
61
61
|
description: "Alert action button triggers the configured query",
|
|
62
62
|
},
|
|
63
|
+
[ElementType.VIDEO]: {
|
|
64
|
+
queryTemplate: "[action]",
|
|
65
|
+
description: "Discuss button fires the configured action query about the video",
|
|
66
|
+
},
|
|
63
67
|
[ElementType.SCREEN]: {
|
|
64
68
|
queryTemplate: "",
|
|
65
69
|
description: "Screen composition — click behaviors are per-element",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element-functions.d.ts","sourceRoot":"","sources":["../../../src/elements/element-functions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,0EAA0E;AAC1E,MAAM,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC;AAEzE,qDAAqD;AACrD,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,WAAW,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"element-functions.d.ts","sourceRoot":"","sources":["../../../src/elements/element-functions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,0EAA0E;AAC1E,MAAM,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC;AAEzE,qDAAqD;AACrD,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,WAAW,EAAE,eAAe,CAwDlE,CAAC;AAEF,mEAAmE;AACnE,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAGT;AAED;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAC5C,WAAW,EACX,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAiF/D,CAAC;AAEF;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,MAAM,CAwER"}
|
|
@@ -33,6 +33,7 @@ export const VISIBILITY_CHECKS = {
|
|
|
33
33
|
[ElementType.FORM]: (data) => Array.isArray(data?.fields) && data.fields.length > 0,
|
|
34
34
|
[ElementType.BUTTON]: (data) => Boolean(data),
|
|
35
35
|
[ElementType.ALERT]: (data) => Boolean(data?.message) && typeof data.message === "string" && data.message.trim().length > 0,
|
|
36
|
+
[ElementType.VIDEO]: (data) => Boolean(data?.src),
|
|
36
37
|
[ElementType.SCREEN]: (data) => Array.isArray(data?.elements) && data.elements.length > 0,
|
|
37
38
|
};
|
|
38
39
|
/** Check if tool input data is valid for the given element type */
|
|
@@ -105,6 +106,10 @@ export const CLICK_METADATA_ENRICHMENT = {
|
|
|
105
106
|
elementType: "alert",
|
|
106
107
|
actionType: "alert_action_click",
|
|
107
108
|
}),
|
|
109
|
+
[ElementType.VIDEO]: (data) => ({
|
|
110
|
+
...data,
|
|
111
|
+
elementType: "video",
|
|
112
|
+
}),
|
|
108
113
|
[ElementType.SCREEN]: (data) => ({ ...data }),
|
|
109
114
|
};
|
|
110
115
|
/**
|
|
@@ -157,6 +162,7 @@ export function buildContentSummary(elementType, data) {
|
|
|
157
162
|
},
|
|
158
163
|
[ElementType.BUTTON]: (d) => `Rendered button: "${d.label}"`,
|
|
159
164
|
[ElementType.ALERT]: (d) => `Displayed ${d.severity || "info"} alert: "${d.message}"`,
|
|
165
|
+
[ElementType.VIDEO]: (d) => `Rendered video player: "${d.title || d.src}"`,
|
|
160
166
|
[ElementType.SCREEN]: (d) => {
|
|
161
167
|
const elements = d.elements;
|
|
162
168
|
return `Rendered screen with ${elements?.length || 0} elements`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Element definitions — static metadata for the
|
|
2
|
+
* Element definitions — static metadata for the 15 BranderUX element types.
|
|
3
3
|
*
|
|
4
4
|
* Inlined here so the compiled dist/server can run as standalone Node.js without
|
|
5
5
|
* depending on @brander/elements TypeScript source at runtime (CJS/ESM interop issue).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element-definitions.d.ts","sourceRoot":"","sources":["../../../src/tools/element-definitions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,UAAU,WAAW;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,YAAY,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"element-definitions.d.ts","sourceRoot":"","sources":["../../../src/tools/element-definitions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,UAAU,WAAW;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,YAAY,EAAE,WAAW,EA4CrC,CAAC;AAIF,uEAAuE;AACvE,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAEjF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Element definitions — static metadata for the
|
|
2
|
+
* Element definitions — static metadata for the 15 BranderUX element types.
|
|
3
3
|
*
|
|
4
4
|
* Inlined here so the compiled dist/server can run as standalone Node.js without
|
|
5
5
|
* depending on @brander/elements TypeScript source at runtime (CJS/ESM interop issue).
|
|
@@ -43,6 +43,11 @@ export const ELEMENT_INFO = [
|
|
|
43
43
|
name: "Alert",
|
|
44
44
|
description: "Notification banner for messages, warnings, and feedback",
|
|
45
45
|
},
|
|
46
|
+
{
|
|
47
|
+
id: "video",
|
|
48
|
+
name: "Video Player",
|
|
49
|
+
description: "Embedded video player for YouTube URLs or direct mp4/webm files",
|
|
50
|
+
},
|
|
46
51
|
];
|
|
47
52
|
const ELEMENT_INFO_MAP = new Map(ELEMENT_INFO.map((e) => [e.id, e]));
|
|
48
53
|
/** Get element info by type (for names, click behaviors, summaries) */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Self-contained generate_screen Zod schema + tool description for the MCP server.
|
|
3
3
|
*
|
|
4
|
-
* All
|
|
4
|
+
* All 15 element prop schemas are defined here so the compiled dist/server can run
|
|
5
5
|
* as a standalone Node.js server without depending on @brander/elements at runtime.
|
|
6
6
|
* (Avoids CJS/ESM interop issues — brander-elements is CJS but mcp-tools is ESM.)
|
|
7
7
|
*/
|
|
@@ -255,6 +255,22 @@ export declare const generateScreenInputSchema: z.ZodObject<{
|
|
|
255
255
|
actionQuery: z.ZodOptional<z.ZodString>;
|
|
256
256
|
}, z.core.$strip>;
|
|
257
257
|
clickQuery: z.ZodOptional<z.ZodString>;
|
|
258
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
259
|
+
elementType: z.ZodLiteral<"video">;
|
|
260
|
+
props: z.ZodObject<{
|
|
261
|
+
id: z.ZodString;
|
|
262
|
+
src: z.ZodString;
|
|
263
|
+
title: z.ZodOptional<z.ZodString>;
|
|
264
|
+
description: z.ZodOptional<z.ZodString>;
|
|
265
|
+
action: z.ZodOptional<z.ZodString>;
|
|
266
|
+
aspectRatio: z.ZodOptional<z.ZodEnum<{
|
|
267
|
+
"16:9": "16:9";
|
|
268
|
+
"4:3": "4:3";
|
|
269
|
+
"1:1": "1:1";
|
|
270
|
+
}>>;
|
|
271
|
+
autoplay: z.ZodOptional<z.ZodBoolean>;
|
|
272
|
+
}, z.core.$strip>;
|
|
273
|
+
clickQuery: z.ZodOptional<z.ZodString>;
|
|
258
274
|
}, z.core.$strip>], "elementType">>;
|
|
259
275
|
}, z.core.$strip>;
|
|
260
276
|
interface DescriptionConfig {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-screen-schema.d.ts","sourceRoot":"","sources":["../../../src/tools/generate-screen-schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"generate-screen-schema.d.ts","sourceRoot":"","sources":["../../../src/tools/generate-screen-schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA6PxB,2DAA2D;AAC3D,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAIpC,CAAC;AAMH,UAAU,iBAAiB;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5C,aAAa,CAAC,EAAE,KAAK,CAAC;QACpB,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE;YAAE,QAAQ,CAAC,EAAE,KAAK,CAAC;gBAAE,WAAW,CAAC,EAAE,MAAM,CAAA;aAAE,CAAC,CAAA;SAAE,CAAC;QACxD,QAAQ,CAAC,EAAE,KAAK,CAAC;YAAE,WAAW,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAC5C,CAAC,CAAC;CACJ;AAED,iFAAiF;AACjF,wBAAgB,8BAA8B,CAAC,MAAM,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAqCjF"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Self-contained generate_screen Zod schema + tool description for the MCP server.
|
|
3
3
|
*
|
|
4
|
-
* All
|
|
4
|
+
* All 15 element prop schemas are defined here so the compiled dist/server can run
|
|
5
5
|
* as a standalone Node.js server without depending on @brander/elements at runtime.
|
|
6
6
|
* (Avoids CJS/ESM interop issues — brander-elements is CJS but mcp-tools is ESM.)
|
|
7
7
|
*/
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
import { ELEMENT_INFO } from "./element-definitions.js";
|
|
10
10
|
// ============================================================================
|
|
11
|
-
// ELEMENT PROP SCHEMAS (
|
|
11
|
+
// ELEMENT PROP SCHEMAS (15 element types)
|
|
12
12
|
// ============================================================================
|
|
13
13
|
const headerPropsSchema = z.object({
|
|
14
14
|
title: z.string().describe("Main page title"),
|
|
@@ -186,8 +186,22 @@ const alertPropsSchema = z.object({
|
|
|
186
186
|
actionText: z.string().optional().describe("Optional action button text"),
|
|
187
187
|
actionQuery: z.string().optional().describe("Query to send when action button clicked"),
|
|
188
188
|
});
|
|
189
|
+
const videoPropsSchema = z.object({
|
|
190
|
+
id: z.string().describe("Unique video element identifier"),
|
|
191
|
+
src: z
|
|
192
|
+
.string()
|
|
193
|
+
.describe("Video URL — YouTube (youtube.com/watch or youtu.be), or direct .mp4/.webm file URL"),
|
|
194
|
+
title: z.string().optional().describe("Video title shown below the player"),
|
|
195
|
+
description: z.string().optional().describe("Brief description shown below the title"),
|
|
196
|
+
action: z
|
|
197
|
+
.string()
|
|
198
|
+
.optional()
|
|
199
|
+
.describe("Query sent to the AI when the user clicks the Discuss button"),
|
|
200
|
+
aspectRatio: z.enum(["16:9", "4:3", "1:1"]).optional().describe("Video player aspect ratio"),
|
|
201
|
+
autoplay: z.boolean().optional().describe("Auto-play video when rendered"),
|
|
202
|
+
});
|
|
189
203
|
// ============================================================================
|
|
190
|
-
// SCREEN SCHEMA — discriminated union of all
|
|
204
|
+
// SCREEN SCHEMA — discriminated union of all 15 element types
|
|
191
205
|
// ============================================================================
|
|
192
206
|
const clickQuery = z
|
|
193
207
|
.string()
|
|
@@ -208,6 +222,7 @@ const screenElementSchema = z.discriminatedUnion("elementType", [
|
|
|
208
222
|
z.object({ elementType: z.literal("form"), props: formPropsSchema, clickQuery }),
|
|
209
223
|
z.object({ elementType: z.literal("button"), props: buttonPropsSchema, clickQuery }),
|
|
210
224
|
z.object({ elementType: z.literal("alert"), props: alertPropsSchema, clickQuery }),
|
|
225
|
+
z.object({ elementType: z.literal("video"), props: videoPropsSchema, clickQuery }),
|
|
211
226
|
]);
|
|
212
227
|
/** Full input schema for the MCP `generate_screen` tool */
|
|
213
228
|
export const generateScreenInputSchema = z.object({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element-types.d.ts","sourceRoot":"","sources":["../../../src/types/element-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,oBAAY,WAAW;IACrB,MAAM,WAAW;IACjB,UAAU,eAAe;IACzB,UAAU,eAAe;IACzB,UAAU,eAAe;IACzB,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,KAAK,UAAU;IACf,YAAY,iBAAiB;IAC7B,WAAW,gBAAgB;IAC3B,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,KAAK,UAAU;IACf,MAAM,WAAW;CAClB"}
|
|
1
|
+
{"version":3,"file":"element-types.d.ts","sourceRoot":"","sources":["../../../src/types/element-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,oBAAY,WAAW;IACrB,MAAM,WAAW;IACjB,UAAU,eAAe;IACzB,UAAU,eAAe;IACzB,UAAU,eAAe;IACzB,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,KAAK,UAAU;IACf,YAAY,iBAAiB;IAC7B,WAAW,gBAAgB;IAC3B,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,MAAM,WAAW;CAClB"}
|