faux-studio 0.3.2 → 0.3.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/index.js +93 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -25355,10 +25355,99 @@ async function handleGetBlueprint(blueprintId, jwt2) {
|
|
|
25355
25355
|
}
|
|
25356
25356
|
return { content };
|
|
25357
25357
|
}
|
|
25358
|
+
var TOOL_ANNOTATIONS = {
|
|
25359
|
+
// --- Local tools ---
|
|
25360
|
+
login: { readOnlyHint: true, openWorldHint: true },
|
|
25361
|
+
setup_figma: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
25362
|
+
// --- Read/Inspect ---
|
|
25363
|
+
get_design_system: { readOnlyHint: true, openWorldHint: false },
|
|
25364
|
+
get_screenshot: { readOnlyHint: true, openWorldHint: false },
|
|
25365
|
+
get_node_details: { readOnlyHint: true, openWorldHint: false },
|
|
25366
|
+
get_page_structure: { readOnlyHint: true, openWorldHint: false },
|
|
25367
|
+
query_nodes: { readOnlyHint: true, openWorldHint: false },
|
|
25368
|
+
get_components: { readOnlyHint: true, openWorldHint: false },
|
|
25369
|
+
get_selection: { readOnlyHint: true, openWorldHint: false },
|
|
25370
|
+
get_connections: { readOnlyHint: true, openWorldHint: false },
|
|
25371
|
+
get_flow_starting_points: { readOnlyHint: true, openWorldHint: false },
|
|
25372
|
+
get_blueprint: { readOnlyHint: true, openWorldHint: true },
|
|
25373
|
+
search_icons: { readOnlyHint: true, openWorldHint: true },
|
|
25374
|
+
// --- Create (not idempotent — creates new nodes each time) ---
|
|
25375
|
+
create_from_schema: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
25376
|
+
create_variable_collection: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
25377
|
+
create_variables: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
25378
|
+
create_text_styles: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
25379
|
+
connect_nodes: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
25380
|
+
add_variant_to_component_set: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
25381
|
+
// --- Modify (idempotent — same params = same result) ---
|
|
25382
|
+
modify_via_schema: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
25383
|
+
update_variables: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
25384
|
+
update_text_styles: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
25385
|
+
update_connections: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
25386
|
+
move_nodes: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
25387
|
+
reorder_children: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
25388
|
+
align_nodes: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
25389
|
+
set_variable_mode: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
25390
|
+
manage_component_properties: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
25391
|
+
focus_viewport: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
25392
|
+
// --- Destructive ---
|
|
25393
|
+
delete_nodes: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
25394
|
+
delete_variable_collections: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
25395
|
+
delete_variables: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
25396
|
+
delete_text_styles: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
25397
|
+
disconnect_nodes: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
25398
|
+
detach_instance: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },
|
|
25399
|
+
// --- Arbitrary execution (can't classify) ---
|
|
25400
|
+
execute_figma_script: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
25401
|
+
execute_workflow: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
25402
|
+
// --- Signals (UI lifecycle, no canvas effect) ---
|
|
25403
|
+
signal_work_start: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
25404
|
+
signal_work_end: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false }
|
|
25405
|
+
};
|
|
25406
|
+
function annotate(tool) {
|
|
25407
|
+
const annotations = TOOL_ANNOTATIONS[tool.name];
|
|
25408
|
+
if (!annotations) return tool;
|
|
25409
|
+
return { ...tool, annotations };
|
|
25410
|
+
}
|
|
25411
|
+
var INSTRUCTIONS = `You are connected to Figma Desktop via faux-studio. You can create, modify, and inspect designs using the tools below.
|
|
25412
|
+
|
|
25413
|
+
## Workflow
|
|
25414
|
+
1. Call \`setup_figma\` first to ensure Figma is running and connected.
|
|
25415
|
+
2. Call \`get_page_structure\` or \`get_screenshot\` to understand what's on the canvas.
|
|
25416
|
+
3. Use \`create_from_schema\` for all creation \u2014 it accepts declarative JSON schemas.
|
|
25417
|
+
4. Use \`modify_via_schema\` to change existing nodes.
|
|
25418
|
+
5. Use \`get_screenshot\` to verify your work visually.
|
|
25419
|
+
|
|
25420
|
+
## Primary Tools
|
|
25421
|
+
- **create_from_schema** \u2014 The main creation tool. Pass a JSON schema describing frames, components, text, shapes, auto-layout, and variable bindings. Supports \`@Variable|fallback\` syntax for design tokens, \`$icon\` for icons, \`$image\` for images, \`$textStyle\` for typography, and ComponentSet matrix mode.
|
|
25422
|
+
- **modify_via_schema** \u2014 Modify existing nodes by ID. Same schema format as create_from_schema.
|
|
25423
|
+
- **execute_figma_script** \u2014 Run raw Figma Plugin API JavaScript when no other tool fits.
|
|
25424
|
+
|
|
25425
|
+
## Design Tokens & Variables
|
|
25426
|
+
- Call \`get_design_system\` to read existing variables, styles, and tokens before designing.
|
|
25427
|
+
- Use \`create_variable_collection\` and \`create_variables\` to set up design tokens.
|
|
25428
|
+
- Bind variables in schemas with \`@CollectionName/VariableName|fallback\` syntax.
|
|
25429
|
+
|
|
25430
|
+
## Reading the Canvas
|
|
25431
|
+
- \`get_page_structure\` \u2014 page/frame hierarchy
|
|
25432
|
+
- \`get_node_details\` \u2014 inspect specific nodes by ID
|
|
25433
|
+
- \`get_selection\` \u2014 what the user has selected
|
|
25434
|
+
- \`query_nodes\` \u2014 search nodes by type, name, or properties
|
|
25435
|
+
- \`get_components\` \u2014 list available components
|
|
25436
|
+
- \`get_screenshot\` \u2014 visual capture of the canvas
|
|
25437
|
+
|
|
25438
|
+
## Best Practices
|
|
25439
|
+
- Always read the existing design system before creating new elements.
|
|
25440
|
+
- Use auto-layout (horizontal/vertical) for responsive layouts \u2014 avoid absolute positioning.
|
|
25441
|
+
- Bind colors, spacing, and typography to variables for maintainability.
|
|
25442
|
+
- Group related elements in frames with descriptive names.
|
|
25443
|
+
- Create components for reusable UI patterns.`;
|
|
25358
25444
|
function createMcpServer(deps) {
|
|
25359
25445
|
const server = new Server(
|
|
25360
|
-
{ name: "faux-studio", version: "0.3.
|
|
25361
|
-
{
|
|
25446
|
+
{ name: "faux-studio", version: "0.3.4" },
|
|
25447
|
+
{
|
|
25448
|
+
capabilities: { tools: { listChanged: true } },
|
|
25449
|
+
instructions: INSTRUCTIONS
|
|
25450
|
+
}
|
|
25362
25451
|
);
|
|
25363
25452
|
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
25364
25453
|
const localTools = [
|
|
@@ -25382,7 +25471,8 @@ function createMcpServer(deps) {
|
|
|
25382
25471
|
}
|
|
25383
25472
|
}
|
|
25384
25473
|
];
|
|
25385
|
-
|
|
25474
|
+
const allTools = [...localTools, ...deps.tools].map(annotate);
|
|
25475
|
+
return { tools: allTools };
|
|
25386
25476
|
});
|
|
25387
25477
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
25388
25478
|
const { name, arguments: args } = request.params;
|