@applaunchflow/mcp 0.1.0 → 0.1.1
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/build/tools/layouts.js +7 -5
- package/build/tools/variants.js +21 -2
- package/package.json +1 -1
package/build/tools/layouts.js
CHANGED
|
@@ -109,13 +109,15 @@ export function registerLayoutTools(server, client) {
|
|
|
109
109
|
server.registerTool("transform_layout", {
|
|
110
110
|
title: "Transform Layout",
|
|
111
111
|
description: "Apply transform operations to an existing layout. Primary editing tool for text, screenshots, colors, and structure changes. " +
|
|
112
|
+
"IMPORTANT: Always call get_layout FIRST to inspect the current layout state before using this tool. Never transform blindly. " +
|
|
112
113
|
"RULES: " +
|
|
113
|
-
"1. nodeType is REQUIRED in every operation target.
|
|
114
|
-
"2. Omit nodeId to update ALL nodes of that type in the target screens.
|
|
114
|
+
"1. nodeType is REQUIRED in every operation target. " +
|
|
115
|
+
"2. Omit nodeId to update ALL nodes of that type in the target screens. " +
|
|
115
116
|
"3. Use screens:'all' to target every screen at once. Do NOT send one operation per screen when the same change applies to all. " +
|
|
116
|
-
"4.
|
|
117
|
-
"5.
|
|
118
|
-
"6.
|
|
117
|
+
"4. Dot-notation is supported for deep updates without replacing the whole object. Example: {'richContent.attrs.defaultFontSize': 96} updates only the font size inside richContent.attrs, preserving all other fields. Always use dot-notation for nested property changes. " +
|
|
118
|
+
"5. For add_node, changes MUST include an 'id' field. " +
|
|
119
|
+
"6. To add new screens, first add empty screen containers, then populate them in a SECOND call using selector 'screenId:<id>'. " +
|
|
120
|
+
"7. Default to layouts:['mobile']. Only include tablet/desktop if the user asks.",
|
|
119
121
|
inputSchema: {
|
|
120
122
|
generationId: z.string().uuid(),
|
|
121
123
|
language: z.string(),
|
package/build/tools/variants.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
import { fail, ok } from "./utils.js";
|
|
3
4
|
const contentTypeEnum = z.enum(["screenshots"]);
|
|
@@ -26,9 +27,27 @@ export function registerVariantTools(server, client) {
|
|
|
26
27
|
label: z.string().optional(),
|
|
27
28
|
setActive: z.boolean().optional(),
|
|
28
29
|
},
|
|
29
|
-
}, async (args) => {
|
|
30
|
+
}, async (args, extra) => {
|
|
30
31
|
try {
|
|
31
|
-
|
|
32
|
+
const result = await client.createVariant(args);
|
|
33
|
+
const variantId = result?.variant?.id;
|
|
34
|
+
const generationId = args.generationId;
|
|
35
|
+
if (variantId && generationId) {
|
|
36
|
+
const editorUrl = `${client.credentials.baseUrl}/editor?projectId=${generationId}&variantId=${variantId}&device=phone`;
|
|
37
|
+
try {
|
|
38
|
+
await server.server.elicitInput({
|
|
39
|
+
mode: "url",
|
|
40
|
+
elicitationId: randomUUID(),
|
|
41
|
+
message: "Opening the new variant in the editor.",
|
|
42
|
+
url: editorUrl,
|
|
43
|
+
}, { signal: extra.signal });
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
// Client may not support URL elicitation — include URL in response
|
|
47
|
+
}
|
|
48
|
+
return ok({ ...result, editorUrl }, "Created variant");
|
|
49
|
+
}
|
|
50
|
+
return ok(result, "Created variant");
|
|
32
51
|
}
|
|
33
52
|
catch (error) {
|
|
34
53
|
return fail(error);
|