AI-native design editor. Open-source Figma alternative.
refactor(mcp): model tool effects and capabilities
Danila Poyarkov4a8714377e5a
diff --git a/packages/core/src/tools/analyze/clusters.ts b/packages/core/src/tools/analyze/clusters.tsindex 66bb7173f..0ed784de3 100644--- a/packages/core/src/tools/analyze/clusters.ts+++ b/packages/core/src/tools/analyze/clusters.ts@@ -26,7 +26,6 @@ export function calcClusterConfidence(nodes: SizedItem[]): number {export const analyzeClusters = defineTool({name: 'analyze_clusters',- documentAccess: 'inspect',description:'Find repeated design patterns (potential components). Groups nodes by structural signature — type, size, and child structure.',params: {diff --git a/packages/core/src/tools/analyze/colors.ts b/packages/core/src/tools/analyze/colors.tsindex 11df0e832..e00acc81e 100644--- a/packages/core/src/tools/analyze/colors.ts+++ b/packages/core/src/tools/analyze/colors.ts@@ -24,7 +24,6 @@ function trackColor(colorMap: Map<string, ColorEntry>, color: Color, variableNamexport const analyzeColors = defineTool({name: 'analyze_colors',- documentAccess: 'inspect',description:'Analyze color palette usage across the current page. Shows frequency, variable bindings, and optionally clusters similar colors.',params: {diff --git a/packages/core/src/tools/analyze/diff.ts b/packages/core/src/tools/analyze/diff.tsindex 95d038d0c..f4a318fb5 100644--- a/packages/core/src/tools/analyze/diff.ts+++ b/packages/core/src/tools/analyze/diff.ts@@ -121,7 +121,6 @@ function createUnifiedDiff(export const diffCreate = defineTool({name: 'diff_create',- documentAccess: 'inspect',description:'Create a structural diff between two node trees. Compares properties (fills, strokes, effects, text, size, position) in unified diff format.',params: {@@ -176,7 +175,6 @@ export const diffCreate = defineTool({export const diffShow = defineTool({name: 'diff_show',- documentAccess: 'inspect',description:'Preview what would change if properties were applied to a node. Shows a unified diff of current vs proposed state.',params: {diff --git a/packages/core/src/tools/analyze/eval/index.ts b/packages/core/src/tools/analyze/eval/index.tsindex 45730811b..cb0fca20c 100644--- a/packages/core/src/tools/analyze/eval/index.ts+++ b/packages/core/src/tools/analyze/eval/index.ts@@ -4,7 +4,6 @@ import { wrapEvalCode } from './wrap'export const evalCode = defineTool({name: 'eval',- documentAccess: 'modify',description:'Execute JavaScript with full Figma Plugin API access. Use for operations not covered by other tools. The `figma` global is available.',params: {diff --git a/packages/core/src/tools/analyze/overlaps/index.ts b/packages/core/src/tools/analyze/overlaps/index.tsindex 9cc6b5695..7e2780adc 100644--- a/packages/core/src/tools/analyze/overlaps/index.ts+++ b/packages/core/src/tools/analyze/overlaps/index.ts@@ -330,7 +330,6 @@ export function computeOverlaps(export const analyzeOverlaps = defineTool({name: 'analyze_overlaps',- documentAccess: 'inspect',description:'Detect visual overlaps and layout overflows across the current page. Useful for finding content that covers footers, text that bleeds outside frames, and accidental sibling overlaps.',params: {diff --git a/packages/core/src/tools/analyze/spacing.ts b/packages/core/src/tools/analyze/spacing.tsindex 37ce20714..332c65d56 100644--- a/packages/core/src/tools/analyze/spacing.ts+++ b/packages/core/src/tools/analyze/spacing.ts@@ -4,7 +4,6 @@ import { defineTool } from '#core/tools/schema'export const analyzeSpacing = defineTool({name: 'analyze_spacing',- documentAccess: 'inspect',description:'Analyze spacing values (gap, padding) across the current page. Checks grid compliance.',params: {diff --git a/packages/core/src/tools/analyze/typography.ts b/packages/core/src/tools/analyze/typography.tsindex 175f51c71..33604fbe0 100644--- a/packages/core/src/tools/analyze/typography.ts+++ b/packages/core/src/tools/analyze/typography.ts@@ -4,7 +4,6 @@ import { defineTool } from '#core/tools/schema'export const analyzeTypography = defineTool({name: 'analyze_typography',- documentAccess: 'inspect',description:'Analyze typography usage across the current page. Shows font families, sizes, weights, and their frequencies.',params: {diff --git a/packages/core/src/tools/calc.ts b/packages/core/src/tools/calc.tsindex afea37362..469892125 100644--- a/packages/core/src/tools/calc.ts+++ b/packages/core/src/tools/calc.ts@@ -20,7 +20,6 @@ function evalExpr(export const calc = defineTool({name: 'calc',- documentAccess: 'inspect',description:'Arithmetic calculator. ALWAYS use instead of mental math. ' +'Pass one expression or a JSON array of expressions — all evaluated in one call. ' +diff --git a/packages/core/src/tools/codegen/component-map.ts b/packages/core/src/tools/codegen/component-map.tsindex e2a2d9533..2ec934578 100644--- a/packages/core/src/tools/codegen/component-map.ts+++ b/packages/core/src/tools/codegen/component-map.ts@@ -110,7 +110,6 @@ function buildScreenInfo(export const designToComponentMap = defineTool({name: 'design_to_component_map',- documentAccess: 'inspect',description:'Analyze the document and return a structured component decomposition: components (with variants, props, instance counts), screens, and a dependency overview.',params: {diff --git a/packages/core/src/tools/codegen/tokens.ts b/packages/core/src/tools/codegen/tokens.tsindex b971b64cc..0ff7641d6 100644--- a/packages/core/src/tools/codegen/tokens.ts+++ b/packages/core/src/tools/codegen/tokens.ts@@ -162,7 +162,6 @@ function renderJSON(tokens: TokenEntry[], modes: { id: string; name: string }[])export const designToTokens = defineTool({name: 'design_to_tokens',- documentAccess: 'inspect',description:'Extract design tokens from Figma variables as CSS custom properties, Tailwind theme config, or JSON. Resolves aliases, handles multiple modes (light/dark).',params: {diff --git a/packages/core/src/tools/create/basic.ts b/packages/core/src/tools/create/basic.tsindex d73385628..fd756616b 100644--- a/packages/core/src/tools/create/basic.ts+++ b/packages/core/src/tools/create/basic.ts@@ -4,7 +4,6 @@ import { defineTool, nodeSummary } from '#core/tools/schema'export const createShape = defineTool({name: 'create_shape',mutates: true,- documentAccess: 'modify',description:'Create a shape on the canvas. Use FRAME for containers/cards, RECTANGLE for solid blocks, ELLIPSE for circles, TEXT for labels, LINE for rules and dividers, STAR for starbursts and badges, POLYGON for triangles and regular polygons, and SECTION for page sections. Use create_vector with an SVG path for arbitrary shapes.',params: {@@ -47,7 +46,6 @@ export const createShape = defineTool({export const createPage = defineTool({name: 'create_page',mutates: true,- documentAccess: 'modify',description: 'Create a new page.',params: {name: { type: 'string', description: 'Page name', required: true }@@ -62,7 +60,6 @@ export const createPage = defineTool({export const createSlice = defineTool({name: 'create_slice',mutates: true,- documentAccess: 'modify',description: 'Create a slice (export region) on the canvas.',params: {x: { type: 'number', description: 'X position', required: true },diff --git a/packages/core/src/tools/create/components.ts b/packages/core/src/tools/create/components.tsindex dac3811d0..c91bfe898 100644--- a/packages/core/src/tools/create/components.ts+++ b/packages/core/src/tools/create/components.ts@@ -4,7 +4,6 @@ import { defineTool, nodeSummary, requireNodes } from '#core/tools/schema'export const createComponent = defineTool({name: 'create_component',mutates: true,- documentAccess: 'modify',description: 'Convert a frame/group into a component.',params: {id: { type: 'string', description: 'Node ID to convert', required: true }@@ -20,7 +19,6 @@ export const createComponent = defineTool({export const createInstance = defineTool({name: 'create_instance',mutates: true,- documentAccess: 'modify',description: 'Create an instance of a component.',params: {component_id: { type: 'string', description: 'Component node ID', required: true },@@ -40,7 +38,6 @@ export const createInstance = defineTool({export const combineAsVariants = defineTool({name: 'combine_as_variants',mutates: true,- documentAccess: 'modify',description:'Combine components sharing a parent into a component set (variant set). Components named ' +'"Category/Value" (e.g. "Button/Primary") derive variant properties from the name segments.',diff --git a/packages/core/src/tools/create/icons.ts b/packages/core/src/tools/create/icons.tsindex 07438fcf4..8f3c577d8 100644--- a/packages/core/src/tools/create/icons.ts+++ b/packages/core/src/tools/create/icons.ts@@ -5,7 +5,6 @@ import { defineTool } from '#core/tools/schema'export const fetchIconsTool = defineTool({name: 'fetch_icons',- documentAccess: 'inspect',description:'Pre-fetch icons from Iconify into cache. Batches by prefix (one HTTP request per set). Call this once with all needed icons, then use insert_icon to place them instantly. Popular sets: lucide (outline), mdi (filled), heroicons, tabler, solar, mingcute, ri (remix).',params: {@@ -34,7 +33,6 @@ export const fetchIconsTool = defineTool({export const insertIcon = defineTool({name: 'insert_icon',mutates: true,- documentAccess: 'modify',description:'Insert one or more vector icons onto the canvas. Pass a single name or multiple names to batch-insert into the same parent. If already cached by fetch_icons — instant, no network request.',params: {@@ -95,7 +93,6 @@ export const insertIcon = defineTool({export const searchIconsTool = defineTool({name: 'search_icons',- documentAccess: 'inspect',description:'Search Iconify for icons by keyword. Accepts multiple queries — all searched in parallel. Returns results keyed by query.',params: {diff --git a/packages/core/src/tools/create/render.ts b/packages/core/src/tools/create/render.tsindex 50f33c325..11b3f3ce3 100644--- a/packages/core/src/tools/create/render.ts+++ b/packages/core/src/tools/create/render.ts@@ -3,7 +3,6 @@ import { defineTool } from '#core/tools/schema'export const render = defineTool({name: 'render',mutates: true,- documentAccess: 'modify',description:'Render JSX to design nodes. Supports inline SVG paths, including open stroked paths: <svg viewBox="0 0 24 24" size={24}><path d="M2 12 L22 12" stroke="#000" fill="none" /></svg>. Use replace_id to replace a placeholder while preserving its position.',params: {diff --git a/packages/core/src/tools/create/svg.ts b/packages/core/src/tools/create/svg.tsindex 2800e4b9e..186024563 100644--- a/packages/core/src/tools/create/svg.ts+++ b/packages/core/src/tools/create/svg.ts@@ -4,7 +4,6 @@ import { defineTool } from '#core/tools/schema'export const importSVG = defineTool({name: 'import_svg',mutates: true,- documentAccess: 'modify',description:'Import raw SVG markup onto the canvas as editable vector nodes. Supports common SVG shapes, inherited presentation attributes, transforms, gradients, and internal <use> references.',params: {diff --git a/packages/core/src/tools/create/vector.ts b/packages/core/src/tools/create/vector.tsindex 89d5b5b66..b5614d5ea 100644--- a/packages/core/src/tools/create/vector.ts+++ b/packages/core/src/tools/create/vector.ts@@ -55,7 +55,6 @@ function parseVectorPath(path: string): VectorPathResult {export const createVector = defineTool({name: 'create_vector',mutates: true,- documentAccess: 'modify',description: 'Create a vector node from SVG path data or a VectorNetwork.',params: {x: { type: 'number', description: 'X position', required: true },diff --git a/packages/core/src/tools/describe/index.ts b/packages/core/src/tools/describe/index.tsindex c6acf2e7d..aae7985f8 100644--- a/packages/core/src/tools/describe/index.ts+++ b/packages/core/src/tools/describe/index.ts@@ -4,7 +4,6 @@ import { autoDepth, describeOneNode } from './tree'export const describe = defineTool({name: 'describe',- documentAccess: 'inspect',description:'Semantic description of one or more nodes. Pass `id` for a single node, or `ids` for multiple nodes in one call. Omit depth for auto — adapts to subtree size (small block → deeper, large page → shallower).',params: {diff --git a/packages/core/src/tools/index.ts b/packages/core/src/tools/index.tsindex f05edc661..85d47cc73 100644--- a/packages/core/src/tools/index.ts+++ b/packages/core/src/tools/index.ts@@ -9,8 +9,15 @@ export type {export { ALL_TOOLS, CORE_TOOLS, EXTENDED_TOOLS } from './registry'export const CODEGEN_PROMPT: string = codegenPromptexport { exportImage } from './vector'-export { defineTool, nodeToResult, nodeSummary, requireNode, NodeNotFoundError } from './schema'-export type { DocumentAccess, ToolDef, ParamDef, ParamType } from './schema'+export {+ defineTool,+ nodeToResult,+ nodeSummary,+ requireNode,+ NodeNotFoundError,+ toolChangesDocument+} from './schema'+export type { ToolDef, ParamDef, ParamType } from './schema'export { toolsToAI, buildDebugLog } from './ai-adapter'export type { ToolLogEntry, ToolDebugLog, AIAdapterOptions, StepBudget } from './ai-adapter'export { calcClusterConfidence, wrapEvalCode } from './analyze'diff --git a/packages/core/src/tools/modify/effects.ts b/packages/core/src/tools/modify/effects.tsindex a41cb7282..090ad0028 100644--- a/packages/core/src/tools/modify/effects.ts+++ b/packages/core/src/tools/modify/effects.ts@@ -7,7 +7,6 @@ import { defineTool, nodeNotFound } from '#core/tools/schema'export const setEffects = defineTool({name: 'set_effects',mutates: true,- documentAccess: 'modify',description:'Set effects on a node (drop shadow, inner shadow, blur). Pass an array or a single effect.',params: {diff --git a/packages/core/src/tools/modify/geometry.ts b/packages/core/src/tools/modify/geometry.tsindex ee79b6282..f559b106f 100644--- a/packages/core/src/tools/modify/geometry.ts+++ b/packages/core/src/tools/modify/geometry.ts@@ -3,7 +3,6 @@ import { defineTool, nodeNotFound } from '#core/tools/schema'export const setRotation = defineTool({name: 'set_rotation',mutates: true,- documentAccess: 'modify',description: 'Set rotation angle of a node in degrees.',params: {id: { type: 'string', description: 'Node ID', required: true },@@ -20,7 +19,6 @@ export const setRotation = defineTool({export const setOpacity = defineTool({name: 'set_opacity',mutates: true,- documentAccess: 'modify',description: 'Set opacity of a node (0-1).',params: {id: { type: 'string', description: 'Node ID', required: true },@@ -37,7 +35,6 @@ export const setOpacity = defineTool({export const setRadius = defineTool({name: 'set_radius',mutates: true,- documentAccess: 'modify',description: 'Set corner radius. Use individual corners for independent values.',params: {id: { type: 'string', description: 'Node ID', required: true },@@ -74,7 +71,6 @@ export const setRadius = defineTool({export const setMinMax = defineTool({name: 'set_minmax',mutates: true,- documentAccess: 'modify',description: 'Set min/max width and height constraints on a node.',params: {id: { type: 'string', description: 'Node ID', required: true },diff --git a/packages/core/src/tools/modify/layout.ts b/packages/core/src/tools/modify/layout.tsindex c227c0528..cd73ea7bb 100644--- a/packages/core/src/tools/modify/layout.ts+++ b/packages/core/src/tools/modify/layout.ts@@ -5,7 +5,6 @@ import { defineTool, nodeNotFound } from '#core/tools/schema'export const setLayout = defineTool({name: 'set_layout',mutates: true,- documentAccess: 'modify',description: 'Set auto-layout (flexbox) on a frame. Direction, alignment, spacing, padding.',params: {id: { type: 'string', description: 'Frame node ID', required: true },@@ -87,7 +86,6 @@ export const setLayout = defineTool({export const setConstraints = defineTool({name: 'set_constraints',mutates: true,- documentAccess: 'modify',description: 'Set resize constraints for a node within its parent.',params: {id: { type: 'string', description: 'Node ID', required: true },@@ -118,7 +116,6 @@ export const setConstraints = defineTool({export const setLayoutChild = defineTool({name: 'set_layout_child',mutates: true,- documentAccess: 'modify',description:'Configure auto-layout child: sizing (FIXED/HUG/FILL), grow, alignment, absolute positioning.',params: {diff --git a/packages/core/src/tools/modify/paint.ts b/packages/core/src/tools/modify/paint.tsindex 262d95af5..67be68e90 100644--- a/packages/core/src/tools/modify/paint.ts+++ b/packages/core/src/tools/modify/paint.ts@@ -8,7 +8,6 @@ import { defineTool } from '#core/tools/schema'export const setFill = defineTool({name: 'set_fill',mutates: true,- documentAccess: 'modify',description:'Set fill on a node. Solid: color="#ff0000". Linear gradient: gradient="top-bottom" or "left-right" with color (start) and color_end (end).',params: {@@ -63,7 +62,6 @@ export const setFill = defineTool({export const setStroke = defineTool({name: 'set_stroke',mutates: true,- documentAccess: 'modify',description: 'Set the stroke (border) of a node.',params: {id: { type: 'string', description: 'Node ID', required: true },@@ -97,7 +95,6 @@ export const setStroke = defineTool({export const setImageFill = defineTool({name: 'set_image_fill',mutates: true,- documentAccess: 'modify',description: 'Set an image fill on a node from base64-encoded image data.',params: {id: { type: 'string', description: 'Node ID', required: true },diff --git a/packages/core/src/tools/modify/state.ts b/packages/core/src/tools/modify/state.tsindex f028223cc..e7722022b 100644--- a/packages/core/src/tools/modify/state.ts+++ b/packages/core/src/tools/modify/state.ts@@ -3,7 +3,6 @@ import { defineTool } from '#core/tools/schema'export const setVisible = defineTool({name: 'set_visible',mutates: true,- documentAccess: 'modify',description: 'Set visibility of a node.',params: {id: { type: 'string', description: 'Node ID', required: true },@@ -20,7 +19,6 @@ export const setVisible = defineTool({export const setBlend = defineTool({name: 'set_blend',mutates: true,- documentAccess: 'modify',description: 'Set blend mode of a node.',params: {id: { type: 'string', description: 'Node ID', required: true },@@ -59,7 +57,6 @@ export const setBlend = defineTool({export const setLocked = defineTool({name: 'set_locked',mutates: true,- documentAccess: 'modify',description: 'Set locked state of a node.',params: {id: { type: 'string', description: 'Node ID', required: true },@@ -76,7 +73,6 @@ export const setLocked = defineTool({export const setStrokeAlign = defineTool({name: 'set_stroke_align',mutates: true,- documentAccess: 'modify',description: 'Set stroke alignment of a node.',params: {id: { type: 'string', description: 'Node ID', required: true },diff --git a/packages/core/src/tools/modify/text.ts b/packages/core/src/tools/modify/text.tsindex faf193d92..e933312ce 100644--- a/packages/core/src/tools/modify/text.ts+++ b/packages/core/src/tools/modify/text.ts@@ -8,7 +8,6 @@ import { defineTool, nodeNotFound } from '#core/tools/schema'export const setText = defineTool({name: 'set_text',mutates: true,- documentAccess: 'modify',description: 'Set text content of a text node.',params: {id: { type: 'string', description: 'Node ID', required: true },@@ -25,7 +24,6 @@ export const setText = defineTool({export const setFont = defineTool({name: 'set_font',mutates: true,- documentAccess: 'modify',description: 'Set font properties of a text node.',params: {id: { type: 'string', description: 'Node ID', required: true },@@ -51,7 +49,6 @@ export const setFont = defineTool({export const setFontRange = defineTool({name: 'set_font_range',mutates: true,- documentAccess: 'modify',description: 'Set font properties for a text range.',params: {id: { type: 'string', description: 'Node ID', required: true },@@ -87,7 +84,6 @@ export const setFontRange = defineTool({export const setTextResize = defineTool({name: 'set_text_resize',mutates: true,- documentAccess: 'modify',description: 'Set text auto-resize mode.',params: {id: { type: 'string', description: 'Node ID', required: true },@@ -109,7 +105,6 @@ export const setTextResize = defineTool({export const setTextProperties = defineTool({name: 'set_text_properties',mutates: true,- documentAccess: 'modify',description:'Set text layout properties: alignment, auto-resize, text case, decoration, truncation.',params: {diff --git a/packages/core/src/tools/modify/update.ts b/packages/core/src/tools/modify/update.tsindex 28e568a91..c4b0c028d 100644--- a/packages/core/src/tools/modify/update.ts+++ b/packages/core/src/tools/modify/update.ts@@ -6,7 +6,6 @@ import { defineTool, nodeNotFound } from '#core/tools/schema'export const updateNode = defineTool({name: 'update_node',mutates: true,- documentAccess: 'modify',description:'Update properties of an existing node: position, size, opacity, corner radius, visibility, text, font.',params: {diff --git a/packages/core/src/tools/read/components.ts b/packages/core/src/tools/read/components.tsindex b0325e9ca..59e5e0254 100644--- a/packages/core/src/tools/read/components.ts+++ b/packages/core/src/tools/read/components.ts@@ -24,7 +24,6 @@ interface LibraryComponentResult {export const getComponents = defineTool({name: 'get_components',- documentAccess: 'inspect',description:'List reusable components from the document and enabled component libraries, optionally filtered by name.',params: {diff --git a/packages/core/src/tools/read/fonts.ts b/packages/core/src/tools/read/fonts.tsindex 219a4a3cb..5b466b21e 100644--- a/packages/core/src/tools/read/fonts.ts+++ b/packages/core/src/tools/read/fonts.ts@@ -4,7 +4,6 @@ import { defineTool } from '#core/tools/schema'export const getFontStatus = defineTool({name: 'get_font_status',- documentAccess: 'inspect',description:'Report whether fonts used on the current page are faithfully available. Returns requested ' +'faces, their loaded source, active substitutions, and affected nodes.',@@ -14,7 +13,6 @@ export const getFontStatus = defineTool({export const listFonts = defineTool({name: 'list_fonts',- documentAccess: 'inspect',description: 'List fonts used in the current page.',params: {family: { type: 'string', description: 'Filter by family name (substring)' }@@ -47,7 +45,6 @@ export const listFonts = defineTool({export const listAvailableFonts = defineTool({name: 'list_available_fonts',- documentAccess: 'inspect',description:'List font families the host can render (system fonts on desktop plus any bundled fonts). ' +'Use this to discover what fonts are available to set on a text node — distinct from list_fonts ' +diff --git a/packages/core/src/tools/read/jsx.ts b/packages/core/src/tools/read/jsx.tsindex 3129276c3..5be756d8a 100644--- a/packages/core/src/tools/read/jsx.ts+++ b/packages/core/src/tools/read/jsx.ts@@ -7,7 +7,6 @@ const MAX_JSX_LENGTH = 12_000export const getJSX = defineTool({name: 'get_jsx',- documentAccess: 'inspect',description:'Get JSX representation of a node and its children. Compact round-trip format — same syntax as the render tool.',params: {@@ -36,7 +35,6 @@ export const getJSX = defineTool({export const diffJSX = defineTool({name: 'diff_jsx',- documentAccess: 'inspect',description:'Structural diff between two nodes in JSX format. Shows added/removed children, changed props.',params: {diff --git a/packages/core/src/tools/read/libraries.ts b/packages/core/src/tools/read/libraries.tsindex aee171f49..346622fdb 100644--- a/packages/core/src/tools/read/libraries.ts+++ b/packages/core/src/tools/read/libraries.ts@@ -3,7 +3,6 @@ import { defineTool } from '#core/tools/schema'export const listLibraries = defineTool({name: 'list_libraries',- documentAccess: 'inspect',description: 'List available published component libraries.',params: {},execute: async (figma) => {@@ -15,7 +14,6 @@ export const listLibraries = defineTool({export const insertLibraryComponent = defineTool({name: 'insert_library_component',- documentAccess: 'modify',description:'Insert a reusable component from an enabled library by stable library and asset identity.',mutates: true,diff --git a/packages/core/src/tools/read/nodes.ts b/packages/core/src/tools/read/nodes.tsindex 0eece3235..5fee785c6 100644--- a/packages/core/src/tools/read/nodes.ts+++ b/packages/core/src/tools/read/nodes.ts@@ -40,7 +40,6 @@ function nodeToTreeEntry(export const getPageTree = defineTool({name: 'get_page_tree',- documentAccess: 'inspect',description:'Get the node tree of the current page. Returns lightweight hierarchy: id, type, name, size. Use depth, root_id, or node_types to keep large pages small. Use get_node for full properties of a specific node.',params: {@@ -79,7 +78,6 @@ export const getPageTree = defineTool({export const getNode = defineTool({name: 'get_node',- documentAccess: 'inspect',description:'Get detailed properties of a node by ID. Use depth to limit child recursion (0 = node only, 1 = direct children, etc). Default: unlimited.',params: {@@ -98,7 +96,6 @@ export const getNode = defineTool({export const findNodes = defineTool({name: 'find_nodes',- documentAccess: 'inspect',description: 'Find nodes by name pattern and/or type.',params: {name: { type: 'string', description: 'Name substring to match (case-insensitive)' },diff --git a/packages/core/src/tools/read/pages.ts b/packages/core/src/tools/read/pages.tsindex 7d823c639..83b72af0a 100644--- a/packages/core/src/tools/read/pages.ts+++ b/packages/core/src/tools/read/pages.ts@@ -4,7 +4,6 @@ import { defineTool } from '#core/tools/schema'export const listPages = defineTool({name: 'list_pages',- documentAccess: 'inspect',description: 'List all pages in the document.',params: {},execute: (figma) => {@@ -19,7 +18,7 @@ export const listPages = defineTool({export const switchPage = defineTool({name: 'switch_page',mutates: true,- documentAccess: 'inspect',+ changesDocument: false,description: 'Switch to a different page by name or ID.',params: {page: { type: 'string', description: 'Page name or ID', required: true }@@ -35,7 +34,6 @@ export const switchPage = defineTool({export const getCurrentPage = defineTool({name: 'get_current_page',- documentAccess: 'inspect',description: 'Get the current page name and ID.',params: {},execute: (figma) => {@@ -45,7 +43,6 @@ export const getCurrentPage = defineTool({export const pageBounds = defineTool({name: 'page_bounds',- documentAccess: 'inspect',description: 'Get bounding box of all objects on the current page.',params: {},execute: (figma) => {diff --git a/packages/core/src/tools/read/query.ts b/packages/core/src/tools/read/query.tsindex 4ed23922d..d01ffbe90 100644--- a/packages/core/src/tools/read/query.ts+++ b/packages/core/src/tools/read/query.ts@@ -3,7 +3,6 @@ import { queryByXPath } from '#core/xpath'export const queryNodes = defineTool({name: 'query_nodes',- documentAccess: 'inspect',description: `Query nodes using XPath selectors. Node types are element names (FRAME, TEXT, RECTANGLE, ELLIPSE, etc.). Attributes: name, width, height, x, y, visible, opacity, cornerRadius, fontSize, fontFamily, fontWeight, layoutMode, itemSpacing, paddingTop/Right/Bottom/Left, strokeWeight, rotation, locked, blendMode, text, lineHeight, letterSpacing.Examples:diff --git a/packages/core/src/tools/read/selection.ts b/packages/core/src/tools/read/selection.tsindex 69d8de280..ae43fd993 100644--- a/packages/core/src/tools/read/selection.ts+++ b/packages/core/src/tools/read/selection.ts@@ -3,7 +3,6 @@ import { defineTool, nodeToResult } from '#core/tools/schema'export const getSelection = defineTool({name: 'get_selection',- documentAccess: 'inspect',description: 'Get details about currently selected nodes.',params: {},execute: (figma) => {@@ -15,7 +14,7 @@ export const getSelection = defineTool({export const selectNodes = defineTool({name: 'select_nodes',mutates: true,- documentAccess: 'inspect',+ changesDocument: false,description: 'Select one or more nodes by ID.',params: {ids: { type: 'string[]', description: 'Node IDs to select', required: true }diff --git a/packages/core/src/tools/schema.ts b/packages/core/src/tools/schema.tsindex 5bd5d2331..98e7ea757 100644--- a/packages/core/src/tools/schema.ts+++ b/packages/core/src/tools/schema.ts@@ -11,7 +11,6 @@ import type { SceneNode } from '@open-pencil/scene-graph'import type { FigmaAPI, FigmaNodeProxy } from '#core/figma-api'export type ParamType = 'string' | 'number' | 'boolean' | 'color' | 'string[]'-export type DocumentAccess = 'inspect' | 'modify'export interface ParamDef {type: ParamType@@ -26,7 +25,8 @@ export interface ParamDef {export interface ToolDef {name: stringdescription: string- documentAccess: DocumentAccess+ /** Whether execution changes persisted document content. Defaults to `mutates`. */+ changesDocument?: booleanmutates?: booleanparams: Record<string, ParamDef>execute: (figma: FigmaAPI, args: Record<string, unknown>) => unknown@@ -53,7 +53,8 @@ type ResolvedParams<P extends Record<string, ParamDef>> = {export function defineTool<P extends Record<string, ParamDef>>(def: {name: stringdescription: string- documentAccess: DocumentAccess+ /** Whether execution changes persisted document content. Defaults to `mutates`. */+ changesDocument?: booleanmutates?: booleanparams: Pexecute: (figma: FigmaAPI, args: ResolvedParams<P>) => unknown@@ -61,6 +62,10 @@ export function defineTool<P extends Record<string, ParamDef>>(def: {return def as ToolDef}+export function toolChangesDocument(def: ToolDef): boolean {+ return def.changesDocument ?? def.mutates === true+}+export class NodeNotFoundError extends Error {constructor(id: string) {super(`Node not found: ${id}`)diff --git a/packages/core/src/tools/stock-photo.ts b/packages/core/src/tools/stock-photo.tsindex ea1a23378..faa4bae87 100644--- a/packages/core/src/tools/stock-photo.ts+++ b/packages/core/src/tools/stock-photo.ts@@ -18,7 +18,6 @@ export {export const stockPhoto = defineTool({name: 'stock_photo',mutates: true,- documentAccess: 'modify',description:'Search stock photos and apply to nodes. Pass a JSON array — all fetched in parallel. ' +'Each item: {id, query, index?, orientation?}. Only works on leaf shapes (Rectangle/Ellipse).',diff --git a/packages/core/src/tools/structure/arrange.ts b/packages/core/src/tools/structure/arrange.tsindex 2b68d5f85..0405c45ad 100644--- a/packages/core/src/tools/structure/arrange.ts+++ b/packages/core/src/tools/structure/arrange.ts@@ -4,7 +4,6 @@ import { defineTool } from '#core/tools/schema'export const arrangeNodes = defineTool({name: 'arrange',mutates: true,- documentAccess: 'modify',description:'Arrange top-level nodes on the canvas in a grid, row, or column layout. Useful after batch creation to tidy up overlapping frames.',params: {diff --git a/packages/core/src/tools/structure/basic.ts b/packages/core/src/tools/structure/basic.tsindex 945e1192b..c2a40bd84 100644--- a/packages/core/src/tools/structure/basic.ts+++ b/packages/core/src/tools/structure/basic.ts@@ -3,7 +3,6 @@ import { defineTool, nodeNotFound, nodeSummary } from '#core/tools/schema'export const deleteNode = defineTool({name: 'delete_node',mutates: true,- documentAccess: 'modify',description: 'Delete a node by ID.',params: {id: { type: 'string', description: 'Node ID to delete', required: true }@@ -19,7 +18,6 @@ export const deleteNode = defineTool({export const cloneNode = defineTool({name: 'clone_node',mutates: true,- documentAccess: 'modify',description: 'Clone (duplicate) a node.',params: {id: { type: 'string', description: 'Node ID to clone', required: true }@@ -35,7 +33,6 @@ export const cloneNode = defineTool({export const renameNode = defineTool({name: 'rename_node',mutates: true,- documentAccess: 'modify',description: 'Rename a node in the layers panel.',params: {id: { type: 'string', description: 'Node ID', required: true },@@ -51,7 +48,6 @@ export const renameNode = defineTool({export const nodeBounds = defineTool({name: 'node_bounds',- documentAccess: 'inspect',description: 'Get absolute bounding box of a node.',params: {id: { type: 'string', description: 'Node ID', required: true }@@ -66,7 +62,6 @@ export const nodeBounds = defineTool({export const nodeMove = defineTool({name: 'node_move',mutates: true,- documentAccess: 'modify',description: 'Move a node to new coordinates.',params: {id: { type: 'string', description: 'Node ID', required: true },@@ -85,7 +80,6 @@ export const nodeMove = defineTool({export const nodeResize = defineTool({name: 'node_resize',mutates: true,- documentAccess: 'modify',description: 'Resize a node.',params: {id: { type: 'string', description: 'Node ID', required: true },diff --git a/packages/core/src/tools/structure/batch.ts b/packages/core/src/tools/structure/batch.tsindex 6656234a9..ee0069e4a 100644--- a/packages/core/src/tools/structure/batch.ts+++ b/packages/core/src/tools/structure/batch.ts@@ -92,7 +92,6 @@ function applyBatchProps(node: FigmaNodeProxy, props: Record<string, unknown>):export const batchUpdate = defineTool({name: 'batch_update',mutates: true,- documentAccess: 'modify',description:'Execute multiple modifications in one call. Each operation is {id, props} where props can include: spacing, padding, padding_horizontal, padding_vertical, counter_align, sizing_horizontal, sizing_vertical, grow, name, visible, corner_radius, auto_resize (for text), direction. Runs all updates with one layout recompute.',params: {diff --git a/packages/core/src/tools/structure/hierarchy.ts b/packages/core/src/tools/structure/hierarchy.tsindex cc6cde6d0..dbde91b16 100644--- a/packages/core/src/tools/structure/hierarchy.ts+++ b/packages/core/src/tools/structure/hierarchy.ts@@ -3,7 +3,6 @@ import { defineTool, nodeSummary, requireNodes } from '#core/tools/schema'export const reparentNode = defineTool({name: 'reparent_node',mutates: true,- documentAccess: 'modify',description: 'Move a node into a different parent.',params: {id: { type: 'string', description: 'Node ID to move', required: true },@@ -22,7 +21,6 @@ export const reparentNode = defineTool({export const groupNodes = defineTool({name: 'group_nodes',mutates: true,- documentAccess: 'modify',description: 'Group selected nodes.',params: {ids: { type: 'string[]', description: 'Node IDs to group', required: true }@@ -39,7 +37,6 @@ export const groupNodes = defineTool({export const ungroupNode = defineTool({name: 'ungroup_node',mutates: true,- documentAccess: 'modify',description: 'Ungroup a group node.',params: {id: { type: 'string', description: 'Group node ID', required: true }@@ -55,7 +52,6 @@ export const ungroupNode = defineTool({export const flattenNodes = defineTool({name: 'flatten_nodes',mutates: true,- documentAccess: 'modify',description: 'Flatten nodes into a single vector.',params: {ids: { type: 'string[]', description: 'Node IDs to flatten', required: true }@@ -69,7 +65,6 @@ export const flattenNodes = defineTool({export const nodeToComponent = defineTool({name: 'node_to_component',mutates: true,- documentAccess: 'modify',description: 'Convert one or more frames/groups into components.',params: {ids: { type: 'string[]', description: 'Node IDs to convert', required: true }diff --git a/packages/core/src/tools/structure/replace.ts b/packages/core/src/tools/structure/replace.tsindex 9be47be1a..d649f7dd7 100644--- a/packages/core/src/tools/structure/replace.ts+++ b/packages/core/src/tools/structure/replace.ts@@ -3,7 +3,6 @@ import { defineTool } from '#core/tools/schema'export const nodeReplaceWith = defineTool({name: 'node_replace_with',mutates: true,- documentAccess: 'modify',description: 'Replace a node with JSX content.',params: {id: { type: 'string', description: 'Node ID to replace', required: true },diff --git a/packages/core/src/tools/structure/tree.ts b/packages/core/src/tools/structure/tree.tsindex 39e4691eb..ce997799a 100644--- a/packages/core/src/tools/structure/tree.ts+++ b/packages/core/src/tools/structure/tree.ts@@ -3,7 +3,6 @@ import { defineTool, getRawNodeOrError, nodeNotFound, nodeSummary } from '#core/export const nodeAncestors = defineTool({name: 'node_ancestors',- documentAccess: 'inspect',description: 'Get the ancestor chain from a node to the page root.',params: {id: { type: 'string', description: 'Node ID', required: true },@@ -26,7 +25,6 @@ export const nodeAncestors = defineTool({export const nodeChildren = defineTool({name: 'node_children',- documentAccess: 'inspect',description: 'Get direct children of a node.',params: {id: { type: 'string', description: 'Node ID', required: true }@@ -40,7 +38,6 @@ export const nodeChildren = defineTool({export const nodeTree = defineTool({name: 'node_tree',- documentAccess: 'inspect',description: 'Get a node tree with types and hierarchy.',params: {id: { type: 'string', description: 'Node ID', required: true },@@ -68,7 +65,6 @@ export const nodeTree = defineTool({export const nodeBindings = defineTool({name: 'node_bindings',- documentAccess: 'inspect',description: 'Get variable bindings for a node.',params: {id: { type: 'string', description: 'Node ID', required: true }diff --git a/packages/core/src/tools/variables/bindings.ts b/packages/core/src/tools/variables/bindings.tsindex 648805ac3..0b25c813d 100644--- a/packages/core/src/tools/variables/bindings.ts+++ b/packages/core/src/tools/variables/bindings.ts@@ -3,7 +3,6 @@ import { defineTool } from '#core/tools/schema'export const bindVariable = defineTool({name: 'bind_variable',mutates: true,- documentAccess: 'modify',description:'Bind a variable to a node property. For fills/strokes color bindings use indexed format like "fills/0/color".',params: {diff --git a/packages/core/src/tools/variables/collections.ts b/packages/core/src/tools/variables/collections.tsindex 0920d8595..30b206b29 100644--- a/packages/core/src/tools/variables/collections.ts+++ b/packages/core/src/tools/variables/collections.ts@@ -2,7 +2,6 @@ import { defineTool } from '#core/tools/schema'export const listCollections = defineTool({name: 'list_collections',- documentAccess: 'inspect',description: 'List all variable collections.',params: {},execute: (figma) => {@@ -13,7 +12,6 @@ export const listCollections = defineTool({export const getCollection = defineTool({name: 'get_collection',- documentAccess: 'inspect',description: 'Get a variable collection by ID.',params: {id: { type: 'string', description: 'Collection ID', required: true }@@ -31,7 +29,6 @@ export const getCollection = defineTool({export const createCollection = defineTool({name: 'create_collection',mutates: true,- documentAccess: 'modify',description: 'Create a new variable collection.',params: {name: { type: 'string', description: 'Collection name', required: true }@@ -44,7 +41,6 @@ export const createCollection = defineTool({export const deleteCollection = defineTool({name: 'delete_collection',mutates: true,- documentAccess: 'modify',description: 'Delete a variable collection and all its variables.',params: {id: { type: 'string', description: 'Collection ID', required: true }diff --git a/packages/core/src/tools/variables/read.ts b/packages/core/src/tools/variables/read.tsindex 792a710ab..3c52dba80 100644--- a/packages/core/src/tools/variables/read.ts+++ b/packages/core/src/tools/variables/read.ts@@ -2,7 +2,6 @@ import { defineTool } from '#core/tools/schema'export const listVariables = defineTool({name: 'list_variables',- documentAccess: 'inspect',description: 'List all design variables (colors, numbers, strings, booleans).',params: {type: {@@ -19,7 +18,6 @@ export const listVariables = defineTool({export const getVariable = defineTool({name: 'get_variable',- documentAccess: 'inspect',description: 'Get a variable by ID.',params: {id: { type: 'string', description: 'Variable ID', required: true }@@ -33,7 +31,6 @@ export const getVariable = defineTool({export const findVariables = defineTool({name: 'find_variables',- documentAccess: 'inspect',description: 'Find variables by name pattern.',params: {query: { type: 'string', description: 'Name substring (case-insensitive)', required: true },diff --git a/packages/core/src/tools/variables/unbind.ts b/packages/core/src/tools/variables/unbind.tsindex 070712d50..a22ba350c 100644--- a/packages/core/src/tools/variables/unbind.ts+++ b/packages/core/src/tools/variables/unbind.ts@@ -3,7 +3,6 @@ import { defineTool } from '#core/tools/schema'export const unbindVariable = defineTool({name: 'unbind_variable',mutates: true,- documentAccess: 'modify',description: 'Remove a variable binding from a node property.',params: {node_id: { type: 'string', description: 'Node ID', required: true },diff --git a/packages/core/src/tools/variables/values.ts b/packages/core/src/tools/variables/values.tsindex 733020875..30451b03c 100644--- a/packages/core/src/tools/variables/values.ts+++ b/packages/core/src/tools/variables/values.ts@@ -13,7 +13,6 @@ function parseVariableValue(type: VariableType, value: string): VariableValue {export const createVariable = defineTool({name: 'create_variable',mutates: true,- documentAccess: 'modify',description: 'Create a new variable in a collection.',params: {name: { type: 'string', description: 'Variable name', required: true },@@ -36,7 +35,6 @@ export const createVariable = defineTool({export const setVariable = defineTool({name: 'set_variable',mutates: true,- documentAccess: 'modify',description: 'Set the value of a variable for a specific mode.',params: {id: { type: 'string', description: 'Variable ID', required: true },@@ -59,7 +57,6 @@ export const setVariable = defineTool({export const deleteVariable = defineTool({name: 'delete_variable',mutates: true,- documentAccess: 'modify',description: 'Delete a variable.',params: {id: { type: 'string', description: 'Variable ID', required: true }diff --git a/packages/core/src/tools/vector/boolean.ts b/packages/core/src/tools/vector/boolean.tsindex 51f8a64e0..05d6f3520 100644--- a/packages/core/src/tools/vector/boolean.ts+++ b/packages/core/src/tools/vector/boolean.ts@@ -3,7 +3,6 @@ import { defineTool, nodeSummary } from '#core/tools/schema'export const booleanUnion = defineTool({name: 'boolean_union',mutates: true,- documentAccess: 'modify',description: 'Union (combine) multiple nodes.',params: {ids: { type: 'string[]', description: 'Node IDs to union', required: true }@@ -17,7 +16,6 @@ export const booleanUnion = defineTool({export const booleanSubtract = defineTool({name: 'boolean_subtract',mutates: true,- documentAccess: 'modify',description: 'Subtract the second node from the first.',params: {ids: { type: 'string[]', description: 'Node IDs (first minus rest)', required: true }@@ -31,7 +29,6 @@ export const booleanSubtract = defineTool({export const booleanIntersect = defineTool({name: 'boolean_intersect',mutates: true,- documentAccess: 'modify',description: 'Intersect multiple nodes.',params: {ids: { type: 'string[]', description: 'Node IDs to intersect', required: true }@@ -45,7 +42,6 @@ export const booleanIntersect = defineTool({export const booleanExclude = defineTool({name: 'boolean_exclude',mutates: true,- documentAccess: 'modify',description: 'Exclude (XOR) multiple nodes.',params: {ids: { type: 'string[]', description: 'Node IDs to exclude', required: true }diff --git a/packages/core/src/tools/vector/export.ts b/packages/core/src/tools/vector/export.tsindex de47675e1..cb92a5195 100644--- a/packages/core/src/tools/vector/export.ts+++ b/packages/core/src/tools/vector/export.ts@@ -4,7 +4,6 @@ import { defineTool } from '#core/tools/schema'export const exportSVG = defineTool({name: 'export_svg',- documentAccess: 'inspect',description: 'Export nodes as SVG markup. Returns the SVG string.',params: {ids: {@@ -29,7 +28,6 @@ export const exportSVG = defineTool({export const exportPDF = defineTool({name: 'export_pdf',- documentAccess: 'inspect',description:'Export nodes as a vector PDF document. Text remains selectable, paths stay sharp at any zoom. Returns base64-encoded PDF data.',params: {@@ -57,7 +55,6 @@ export const exportPDF = defineTool({export const exportImage = defineTool({name: 'export_image',- documentAccess: 'inspect',description:'Export nodes as a raster image (PNG, JPG, or WEBP). Returns base64-encoded image data. Use to visually verify designs.',params: {diff --git a/packages/core/src/tools/vector/path.ts b/packages/core/src/tools/vector/path.tsindex 65a7d87bc..c5763db90 100644--- a/packages/core/src/tools/vector/path.ts+++ b/packages/core/src/tools/vector/path.ts@@ -16,7 +16,6 @@ function getVectorNode(export const pathGet = defineTool({name: 'path_get',- documentAccess: 'inspect',description: 'Get vector path data of a node.',params: {id: { type: 'string', description: 'Node ID', required: true }@@ -32,7 +31,6 @@ export const pathGet = defineTool({export const pathSet = defineTool({name: 'path_set',mutates: true,- documentAccess: 'modify',description: 'Set vector path data on a node. Provide a VectorNetwork JSON.',params: {id: { type: 'string', description: 'Node ID', required: true },@@ -50,7 +48,6 @@ export const pathSet = defineTool({export const pathScale = defineTool({name: 'path_scale',mutates: true,- documentAccess: 'modify',description: 'Scale vector path from center.',params: {id: { type: 'string', description: 'Node ID', required: true },@@ -81,7 +78,6 @@ export const pathScale = defineTool({export const pathFlip = defineTool({name: 'path_flip',mutates: true,- documentAccess: 'modify',description: 'Flip vector path horizontally or vertically.',params: {id: { type: 'string', description: 'Node ID', required: true },@@ -117,7 +113,6 @@ export const pathFlip = defineTool({export const pathMove = defineTool({name: 'path_move',mutates: true,- documentAccess: 'modify',description: 'Move all path points by an offset.',params: {id: { type: 'string', description: 'Node ID', required: true },diff --git a/packages/core/src/tools/vector/viewport.ts b/packages/core/src/tools/vector/viewport.tsindex f8ef5eb1d..cc2d46905 100644--- a/packages/core/src/tools/vector/viewport.ts+++ b/packages/core/src/tools/vector/viewport.ts@@ -2,7 +2,6 @@ import { defineTool } from '#core/tools/schema'export const viewportGet = defineTool({name: 'viewport_get',- documentAccess: 'inspect',description: 'Get current viewport position and zoom level.',params: {},execute: (figma) => {@@ -13,7 +12,7 @@ export const viewportGet = defineTool({export const viewportSet = defineTool({name: 'viewport_set',mutates: true,- documentAccess: 'inspect',+ changesDocument: false,description: 'Set viewport position and zoom.',params: {x: { type: 'number', description: 'Center X', required: true },@@ -29,7 +28,7 @@ export const viewportSet = defineTool({export const viewportZoomToFit = defineTool({name: 'viewport_zoom_to_fit',mutates: true,- documentAccess: 'inspect',+ changesDocument: false,description: 'Zoom viewport to fit specified nodes.',params: {ids: { type: 'string[]', description: 'Node IDs to fit in view', required: true }diff --git a/packages/mcp/package.json b/packages/mcp/package.jsonindex 9bfac1f57..9a08d8118 100644--- a/packages/mcp/package.json+++ b/packages/mcp/package.json@@ -36,7 +36,7 @@},"./tools": {"types": "./dist/tools.d.mts",- "bun": "./src/tool/catalog.ts",+ "bun": "./src/tool/metadata.ts","import": "./dist/tools.mjs","default": "./dist/tools.mjs"}diff --git a/packages/mcp/src/index.ts b/packages/mcp/src/index.tsindex 6c39b9038..972bc4b1d 100644--- a/packages/mcp/src/index.ts+++ b/packages/mcp/src/index.ts@@ -1,6 +1,6 @@#!/usr/bin/env nodeimport { startServer } from '#mcp/server'-import { parseDisabledTools } from '#mcp/tool/catalog'+import { readToolPolicyFromEnv } from '#mcp/tool/policy'if (process.argv.includes('--help') || process.argv.includes('-h')) {process.stdout.write(@@ -67,12 +67,14 @@ if (rawAppTimeoutText) {}}+const toolPolicy = readToolPolicyFromEnv()+const handle = await startServer({httpPort: withTcp ? port : 0,withTcp,socketPath: process.env.OPENPENCIL_MCP_SOCKET?.trim() || null,- enableEval: process.env.OPENPENCIL_MCP_EVAL === '1',- disabledTools: parseDisabledTools(process.env.OPENPENCIL_MCP_DISABLED_TOOLS),+ enableEval: toolPolicy.allowEval,+ disabledTools: toolPolicy.disabledTools,mcpRoot: process.env.OPENPENCIL_MCP_ROOT?.trim() || process.cwd(),// Auth token: undefined → auto-generate, empty string → disable auth,// non-empty → use trimmed value. Whitespace-only is rejected to prevent adiff --git a/packages/mcp/src/server.ts b/packages/mcp/src/server.tsindex fba8ce5d8..46bf49e28 100644--- a/packages/mcp/src/server.ts+++ b/packages/mcp/src/server.ts@@ -14,7 +14,8 @@ import { MCP_CORS_HEADERS, MCP_CORS_METHODS, MCP_EXPOSED_HEADERS } from '#mcp/htimport type { RPCJSONObject } from '#mcp/json'import { preprocessRPC } from '#mcp/jsx-preprocess'import { createMCPSessionManager } from '#mcp/server/sessions'-import type { MCPToolCatalogEntry } from '#mcp/tool/catalog'+import { createToolDescriptors } from '#mcp/tool/manifest'+import type { ToolDescriptor, ToolPolicy } from '#mcp/tool/metadata'import { registerTools } from '#mcp/tool/registration'import packageJSON from '../package.json' with { type: 'json' }@@ -106,9 +107,9 @@ function createHonoApp(options: {browserRPC: ReturnType<typeof createBrowserRPCBridge>mcpSessions: ReturnType<typeof createMCPSessionManager>sendToBrowser: (msg: RPCJSONObject) => Promise<unknown>- toolCatalog: MCPToolCatalogEntry[]+ toolDescriptors: ToolDescriptor[]}): Hono {- const { authToken, corsOrigin, browserRPC, mcpSessions, sendToBrowser, toolCatalog } = options+ const { authToken, corsOrigin, browserRPC, mcpSessions, sendToBrowser, toolDescriptors } = optionsconst app = new Hono()@@ -124,15 +125,17 @@ function createHonoApp(options: {)}- app.get('/health', async (c) =>- c.json({+ app.get('/health', async (c) => {+ const provided = bearerToken(c.req.header('authorization'))+ const canInspectConfiguration = authToken === null || isAuthorized(provided, authToken)+ return c.json({status: browserRPC.isConnected() ? 'ok' : 'no_app',version: MCP_VERSION,installCommand: await mcpInstallCommand(),authRequired: authToken !== null,- tools: toolCatalog+ ...(canInspectConfiguration ? { tools: toolDescriptors } : {})})- )+ })app.use('/rpc', async (c, next) => {// When authToken is null (operator explicitly disabled auth), skip token check —@@ -280,8 +283,10 @@ function wireConnectionHandling(function buildServerContext(options: ServerOptions) {const httpPort = options.httpPort ?? 7600- const enableEval = options.enableEval ?? false- const disabledTools = [...new Set(options.disabledTools)]+ const toolPolicy: ToolPolicy = {+ allowEval: options.enableEval ?? false,+ disabledTools: [...new Set(options.disabledTools)]+ }const mcpRoot = options.mcpRoot ?? null// Auto-generated so all transports require auth by default. Override via OPENPENCIL_MCP_AUTH_TOKEN or authToken option.// Pass authToken: null explicitly to disable auth entirely.@@ -305,19 +310,14 @@ function buildServerContext(options: ServerOptions) {const mcpSessions = createMCPSessionManager({serverVersion: MCP_VERSION,registerTools: (mcpServer: McpServer) =>- registerTools(mcpServer, { disabledTools, enableEval, mcpRoot, sendRPC: sendToBrowser })+ registerTools(mcpServer, { policy: toolPolicy, mcpRoot, sendRPC: sendToBrowser })})const browserRPC = createBrowserRPCBridge({authToken,onConnectionChange: mcpSessions.notifyToolsChanged})const sendToBrowser = browserRPC.sendRPC- const toolCatalog = registerTools(null, {- disabledTools,- enableEval,- mcpRoot,- sendRPC: sendToBrowser- })+ const toolDescriptors = createToolDescriptors(mcpRoot !== null)const app = createHonoApp({authToken,@@ -325,7 +325,7 @@ function buildServerContext(options: ServerOptions) {browserRPC,mcpSessions,sendToBrowser,- toolCatalog+ toolDescriptors})const wss = new WebSocketServer({ noServer: true })@@ -338,7 +338,7 @@ function buildServerContext(options: ServerOptions) {app,wss,authToken,- disabledTools+ disabledTools: toolPolicy.disabledTools}}diff --git a/packages/mcp/src/stdio.ts b/packages/mcp/src/stdio.tsindex d8e3150a3..ba711d268 100644--- a/packages/mcp/src/stdio.ts+++ b/packages/mcp/src/stdio.ts@@ -4,7 +4,8 @@ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'import { MCP_VERSION, registerTools } from '#mcp/server'import { createStdioRPCBridge } from '#mcp/stdio/bridge'-import { parseDisabledTools } from '#mcp/tool/catalog'+import type { ToolPolicy } from '#mcp/tool/metadata'+import { parseDisabledTools } from '#mcp/tool/policy'import { readDiscoveryFile } from '#mcp/transport/discovery'if (process.argv.includes('--help') || process.argv.includes('-h')) {@@ -28,11 +29,13 @@ if (process.argv.includes('--help') || process.argv.includes('-h')) {process.exit(0)}-const enableEval = process.env.OPENPENCIL_MCP_EVAL === '1'-const disabledTools =- process.env.OPENPENCIL_MCP_DISABLED_TOOLS === undefined- ? ((await readDiscoveryFile())?.disabledTools ?? [])- : parseDisabledTools(process.env.OPENPENCIL_MCP_DISABLED_TOOLS)+const toolPolicy: ToolPolicy = {+ allowEval: process.env.OPENPENCIL_MCP_EVAL === '1',+ disabledTools:+ process.env.OPENPENCIL_MCP_DISABLED_TOOLS === undefined+ ? ((await readDiscoveryFile())?.disabledTools ?? [])+ : parseDisabledTools(process.env.OPENPENCIL_MCP_DISABLED_TOOLS)+}const mcpRoot = process.env.OPENPENCIL_MCP_ROOT?.trim() || process.cwd()// Auth token: undefined → auto-discover from discovery file, empty string →// disable auth, whitespace-only → reject (same fail-fast as index.ts to catch@@ -71,7 +74,7 @@ const bridge = createStdioRPCBridge({})const mcpServer = new McpServer({ name: 'open-pencil', version: MCP_VERSION })-registerTools(mcpServer, { disabledTools, enableEval, mcpRoot, sendRPC: bridge.sendRPC })+registerTools(mcpServer, { policy: toolPolicy, mcpRoot, sendRPC: bridge.sendRPC })const transport = new StdioServerTransport()mcpServer.connect(transport).catch((err) => {diff --git a/packages/mcp/src/tool/catalog.ts b/packages/mcp/src/tool/catalog.tsdeleted file mode 100644index 29876f88d..000000000--- a/packages/mcp/src/tool/catalog.ts+++ /dev/null@@ -1,22 +0,0 @@-import type { DocumentAccess } from '@open-pencil/core/tools'--export type MCPToolAvailability = 'default' | 'eval' | 'filesystem'--export type MCPToolCatalogEntry = {- name: string- description: string- availability: MCPToolAvailability- documentAccess: DocumentAccess-}--export function parseDisabledTools(value: string | undefined): string[] {- if (!value) return []- return [- ...new Set(- value- .split(',')- .map((name) => name.trim())- .filter(Boolean)- )- ]-}diff --git a/packages/mcp/src/tool/manifest.ts b/packages/mcp/src/tool/manifest.tsnew file mode 100644index 000000000..42324e76f--- /dev/null+++ b/packages/mcp/src/tool/manifest.ts@@ -0,0 +1,91 @@+import type { ToolDef } from '@open-pencil/core/tools'+import { ALL_TOOLS, toolChangesDocument } from '@open-pencil/core/tools'++import type {+ ToolAvailability,+ ToolCapability,+ ToolDescriptor,+ ToolEffect+} from '#mcp/tool/metadata'++const TOOL_CAPABILITY_OVERRIDES: Readonly<Partial<Record<string, readonly ToolCapability[]>>> = {+ eval: ['document:read', 'document:write', 'code:execute'],+ fetch_icons: ['network:access'],+ insert_icon: ['document:write', 'network:access'],+ list_available_fonts: ['document:read'],+ search_icons: ['network:access'],+ stock_photo: ['document:write', 'network:access']+}++export function coreToolEffect(def: ToolDef): ToolEffect {+ return toolChangesDocument(def) ? 'write' : 'read'+}++export function coreToolCapabilities(def: ToolDef): ToolCapability[] {+ const override = TOOL_CAPABILITY_OVERRIDES[def.name]+ return override ? [...override] : [toolChangesDocument(def) ? 'document:write' : 'document:read']+}++export function coreToolAvailability(def: ToolDef): ToolAvailability {+ return def.name === 'eval' ? 'eval' : 'default'+}++function coreToolDescriptor(def: ToolDef): ToolDescriptor {+ return {+ name: def.name,+ description: def.description,+ effect: coreToolEffect(def),+ availability: coreToolAvailability(def),+ capabilities: coreToolCapabilities(def)+ }+}++export function createToolDescriptors(filesystemEnabled: boolean): ToolDescriptor[] {+ const descriptors = ALL_TOOLS.map(coreToolDescriptor)+ descriptors.push(+ {+ name: 'list_documents',+ description:+ 'List open OpenPencil documents/tabs with their IDs, file paths, current pages, and pages.',+ effect: 'read',+ availability: 'default',+ capabilities: ['document:read']+ },+ {+ name: 'save_file',+ description:+ 'Save the current document to disk. An optional path must stay inside the configured MCP root.',+ effect: 'read',+ availability: 'default',+ capabilities: ['document:read', 'filesystem:write']+ },+ ...(filesystemEnabled+ ? [+ {+ name: 'open_file',+ description: 'Open a .fig or .pen file from inside the configured MCP root.',+ effect: 'write',+ availability: 'filesystem',+ capabilities: ['filesystem:read', 'document:write']+ } satisfies ToolDescriptor,+ {+ name: 'new_document',+ description:+ 'Create a new empty document with an optional save path inside the configured MCP root.',+ effect: 'write',+ availability: 'filesystem',+ capabilities: ['document:write', 'filesystem:write']+ } satisfies ToolDescriptor+ ]+ : []),+ {+ name: 'get_codegen_prompt',+ description:+ 'Get design-to-code generation guidelines. Call before generating frontend code.',+ effect: 'read',+ availability: 'default',+ capabilities: []+ }+ )+ return descriptors+}diff --git a/packages/mcp/src/tool/metadata.ts b/packages/mcp/src/tool/metadata.tsnew file mode 100644index 000000000..38cf5d686--- /dev/null+++ b/packages/mcp/src/tool/metadata.ts@@ -0,0 +1,65 @@+export type ToolEffect = 'read' | 'write'+export type ToolAvailability = 'default' | 'eval' | 'filesystem'+export type ToolCapability =+ | 'document:read'+ | 'document:write'+ | 'filesystem:read'+ | 'filesystem:write'+ | 'network:access'+ | 'code:execute'++export interface ToolDescriptor {+ name: string+ description: string+ effect: ToolEffect+ availability: ToolAvailability+ capabilities: ToolCapability[]+}++export interface ToolPolicy {+ allowEval: boolean+ disabledTools: string[]+}++function isRecord(value: unknown): value is Record<string, unknown> {+ return typeof value === 'object' && value !== null && !Array.isArray(value)+}++const TOOL_EFFECTS: ReadonlySet<string> = new Set<ToolEffect>(['read', 'write'])+const TOOL_AVAILABILITIES: ReadonlySet<string> = new Set<ToolAvailability>([+ 'default',+ 'eval',+ 'filesystem'+])+const TOOL_CAPABILITIES: ReadonlySet<string> = new Set<ToolCapability>([+ 'document:read',+ 'document:write',+ 'filesystem:read',+ 'filesystem:write',+ 'network:access',+ 'code:execute'+])++export function parseToolDescriptor(value: unknown): ToolDescriptor | null {+ if (!isRecord(value)) return null+ const { name, description, effect, availability, capabilities } = value+ if (typeof name !== 'string' || !name) return null+ if (typeof description !== 'string') return null+ if (typeof effect !== 'string' || !TOOL_EFFECTS.has(effect)) return null+ if (typeof availability !== 'string' || !TOOL_AVAILABILITIES.has(availability)) return null+ if (+ !Array.isArray(capabilities) ||+ capabilities.some(+ (capability) => typeof capability !== 'string' || !TOOL_CAPABILITIES.has(capability)+ )+ ) {+ return null+ }+ return {+ name,+ description,+ effect: effect as ToolEffect,+ availability: availability as ToolAvailability,+ capabilities: capabilities as ToolCapability[]+ }+}diff --git a/packages/mcp/src/tool/policy.ts b/packages/mcp/src/tool/policy.tsnew file mode 100644index 000000000..41df5d5ff--- /dev/null+++ b/packages/mcp/src/tool/policy.ts@@ -0,0 +1,20 @@+import type { ToolPolicy } from '#mcp/tool/metadata'++export function parseDisabledTools(value: string | undefined): string[] {+ if (!value) return []+ return [+ ...new Set(+ value+ .split(',')+ .map((name) => name.trim())+ .filter(Boolean)+ )+ ]+}++export function readToolPolicyFromEnv(env: NodeJS.ProcessEnv = process.env): ToolPolicy {+ return {+ allowEval: env.OPENPENCIL_MCP_EVAL === '1',+ disabledTools: parseDisabledTools(env.OPENPENCIL_MCP_DISABLED_TOOLS)+ }+}diff --git a/packages/mcp/src/tool/registration.ts b/packages/mcp/src/tool/registration.tsindex f5c41b53c..3111bfd3d 100644--- a/packages/mcp/src/tool/registration.ts+++ b/packages/mcp/src/tool/registration.ts@@ -1,14 +1,16 @@import { Buffer } from 'node:buffer'import { resolve } from 'node:path'-import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'+import type { McpServer, ToolCallback } from '@modelcontextprotocol/sdk/server/mcp.js'+import type { ToolAnnotations } from '@modelcontextprotocol/sdk/types.js'import { z } from 'zod'import { ALL_TOOLS, CODEGEN_PROMPT } from '@open-pencil/core/tools'import type { RPCJSONObject } from '#mcp/json'import { MAX_RESULT_BYTES, fail, ok, resultTooLargeMessage } from '#mcp/result'-import type { MCPToolAvailability, MCPToolCatalogEntry } from '#mcp/tool/catalog'+import { createToolDescriptors } from '#mcp/tool/manifest'+import type { ToolDescriptor, ToolEffect, ToolPolicy } from '#mcp/tool/metadata'import { resolveSafePath, writeToolOutput } from '#mcp/tool/output'import { paramToZod } from '#mcp/tool/schema'@@ -34,34 +36,45 @@ function splitAutomationTarget(args: Record<string, unknown>): {}export interface RegisterToolsOptions {- disabledTools?: Iterable<string>- enableEval: boolean+ policy: ToolPolicymcpRoot?: string | nullsendRPC: RPCSender}-type CatalogToolOptions = {- description: string- documentAccess: MCPToolCatalogEntry['documentAccess']- availability?: MCPToolAvailability-} & Record<string, unknown>+function toolAnnotations(effect: ToolEffect): ToolAnnotations {+ return {+ readOnlyHint: effect === 'read',+ destructiveHint: effect === 'write'+ }+}++function descriptorByName(descriptors: readonly ToolDescriptor[]): Map<string, ToolDescriptor> {+ return new Map(descriptors.map((descriptor) => [descriptor.name, descriptor]))+}-export function registerTools(- mcpServer: McpServer | null,- options: RegisterToolsOptions-): MCPToolCatalogEntry[] {- const { enableEval, sendRPC } = options- const disabledTools = new Set(options.disabledTools)+export function registerTools(mcpServer: McpServer, options: RegisterToolsOptions): void {+ const { policy, sendRPC } = options+ const disabledTools = new Set(policy.disabledTools)const resolvedRoot = options.mcpRoot ? resolve(options.mcpRoot) : null- const catalog: MCPToolCatalogEntry[] = []- const register = (name: string, toolOptions: CatalogToolOptions, ...args: unknown[]) => {- const { documentAccess, availability = 'default', ...sdkOptions } = toolOptions- catalog.push({ name, description: toolOptions.description, documentAccess, availability })- if (!mcpServer || disabledTools.has(name)) return- if (availability === 'eval' && !enableEval) return- if (availability === 'filesystem' && !resolvedRoot) return- const registerTool = mcpServer.registerTool.bind(mcpServer) as (...a: unknown[]) => void- registerTool(name, sdkOptions, ...args)+ const descriptors = descriptorByName(createToolDescriptors(resolvedRoot !== null))+ const register = <InputArgs extends z.ZodObject>(+ name: string,+ toolOptions: { description: string; inputSchema: InputArgs },+ handler: ToolCallback<InputArgs>+ ) => {+ const descriptor = descriptors.get(name)+ if (!descriptor) throw new Error(`Missing MCP tool descriptor for "${name}"`)+ if (disabledTools.has(name)) return+ if (descriptor.availability === 'eval' && !policy.allowEval) return+ mcpServer.registerTool(+ name,+ {+ ...toolOptions,+ annotations: toolAnnotations(descriptor.effect),+ _meta: { 'openpencil/capabilities': descriptor.capabilities }+ },+ handler+ )}for (const def of ALL_TOOLS) {@@ -73,8 +86,6 @@ export function registerTools(def.name,{description: def.description,- documentAccess: def.documentAccess,- availability: def.name === 'eval' ? 'eval' : 'default',inputSchema: z.object({ ...shape, ...automationTargetSchema })},async (args: Record<string, unknown>) => {@@ -129,7 +140,6 @@ export function registerTools({description:'List open OpenPencil documents/tabs with their IDs, file paths, current pages, and pages.',- documentAccess: 'inspect',inputSchema: z.object({})},async () => {@@ -148,9 +158,8 @@ export function registerTools('save_file',{description: resolvedRoot- ? `Save the current document to disk. If path is provided, it must be inside ${resolvedRoot}.`+ ? 'Save the current document to disk. If path is provided, it must be inside the configured MCP root.': 'Save the current document to disk. Uses the existing file path if available, otherwise prompts for a location.',- documentAccess: 'inspect',inputSchema: resolvedRoot? z.object({path: z@@ -190,9 +199,7 @@ export function registerTools(register('open_file',{- description: `Open a .fig or .pen file from disk into a new tab. Path must be inside ${resolvedRoot}.`,- documentAccess: 'inspect',- availability: 'filesystem',+ description: 'Open a .fig or .pen file from inside the configured MCP root.',inputSchema: z.object({path: z.string()@@ -221,9 +228,8 @@ export function registerTools(register('new_document',{- description: `Create a new empty document. Optionally set a save path inside ${resolvedRoot}.`,- documentAccess: 'modify',- availability: 'filesystem',+ description:+ 'Create a new empty document with an optional save path inside the configured MCP root.',inputSchema: z.object({path: z.string()@@ -257,11 +263,8 @@ export function registerTools({description:'Get design-to-code generation guidelines. Call before generating frontend code.',- documentAccess: 'inspect',inputSchema: z.object({})},async () => ok({ prompt: CODEGEN_PROMPT }))-- return catalog}diff --git a/packages/mcp/tsdown.config.ts b/packages/mcp/tsdown.config.tsindex 171150dfc..3e29532fb 100644--- a/packages/mcp/tsdown.config.ts+++ b/packages/mcp/tsdown.config.ts@@ -7,7 +7,7 @@ export default defineConfig({stdio: './src/stdio.ts',transport: './src/transport/paths.ts',discovery: './src/transport/discovery.ts',- tools: './src/tool/catalog.ts'+ tools: './src/tool/metadata.ts'},platform: 'node',format: ['esm'],diff --git a/tests/engine/mcp/server/index.test.ts b/tests/engine/mcp/server/index.test.tsindex e9b5b8261..e9d8a05b4 100644--- a/tests/engine/mcp/server/index.test.ts+++ b/tests/engine/mcp/server/index.test.ts@@ -9,7 +9,7 @@ import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/import { SceneGraph } from '@open-pencil/scene-graph'import { startServer } from '#mcp/server'-import { registerTools } from '#mcp/tool/registration'+import { createToolDescriptors } from '#mcp/tool/manifest'import {connectMockBrowser,@@ -22,6 +22,7 @@ const isUnix = process.platform !== 'win32'const SOCKET_DIR = join(tmpdir(), `openpencil-test-server-${process.pid}`)const TEST_MCP_ROOT = join(tmpdir(), 'open-pencil-mcp-root')const TEST_AUTH_TOKEN = 'test-auth-token'+const TEST_CLIENT_AUTH_TOKEN = 'test-client-token'let testCounter = 0// ---------------------------------------------------------------------------@@ -35,7 +36,7 @@ function testSocketPath(): string | null {async function createTestClient(disabledTools: string[] = []) {if (isUnix) await mkdir(SOCKET_DIR, { recursive: true })- const authToken = 'test-client-token'+ const authToken = TEST_CLIENT_AUTH_TOKENconst handle = await startServer({httpPort: 0,withTcp: true,@@ -136,32 +137,24 @@ describe('MCP server', () => {test('lists all registered tools', async () => {const { tools } = await client.listTools()- const catalog = registerTools(null, {- enableEval: false,- mcpRoot: null,- sendRPC: async () => ({})- })- const expectedNames = catalog+ const expectedNames = createToolDescriptors(false).filter((tool) => tool.availability === 'default').map((tool) => tool.name).sort()expect(tools.map((tool) => tool.name).sort()).toEqual(expectedNames)})- test('classifies document access independently from runtime state mutation', () => {- const catalog = registerTools(null, {- enableEval: true,- mcpRoot: TEST_MCP_ROOT,- sendRPC: async () => ({})- })- const accessByName = new Map(catalog.map((tool) => [tool.name, tool.documentAccess] as const))- expect(accessByName.get('get_page_tree')).toBe('inspect')- expect(accessByName.get('switch_page')).toBe('inspect')- expect(accessByName.get('viewport_set')).toBe('inspect')- expect(accessByName.get('export_image')).toBe('inspect')- expect(accessByName.get('update_node')).toBe('modify')- expect(accessByName.get('new_document')).toBe('modify')- expect(accessByName.get('eval')).toBe('modify')+ test('describes effects, capabilities, and runtime availability independently', () => {+ const descriptors = createToolDescriptors(true)+ const byName = new Map(descriptors.map((tool) => [tool.name, tool] as const))+ expect(byName.get('get_page_tree')?.effect).toBe('read')+ expect(byName.get('switch_page')?.effect).toBe('read')+ expect(byName.get('viewport_set')?.effect).toBe('read')+ expect(byName.get('export_image')?.effect).toBe('read')+ expect(byName.get('update_node')?.effect).toBe('write')+ expect(byName.get('new_document')?.capabilities).toEqual(['document:write', 'filesystem:write'])+ expect(byName.get('eval')?.availability).toBe('eval')+ expect(byName.get('eval')?.capabilities).toContain('code:execute')})test('omits tools disabled in the generic registration filter', async () => {@@ -179,13 +172,24 @@ describe('MCP server', () => {expect(names).not.toContain('list_documents')expect(names).toContain('get_page_tree')- const healthResponse = await fetch(`http://127.0.0.1:${ctx.handle.httpPort}/health`)+ const healthResponse = await fetch(`http://127.0.0.1:${ctx.handle.httpPort}/health`, {+ headers: { Authorization: `Bearer ${TEST_CLIENT_AUTH_TOKEN}` }+ })const health = (await healthResponse.json()) as HealthResponse- const catalogNames = health.tools.map((tool) => tool.name)+ const catalogNames = (health.tools ?? []).map((tool) => tool.name)expect(catalogNames).toContain('create_shape')expect(catalogNames).toContain('list_documents')})+ test('tools expose standard MCP effect annotations', async () => {+ const { tools } = await client.listTools()+ const byName = new Map(tools.map((tool) => [tool.name, tool] as const))+ expect(byName.get('get_page_tree')?.annotations?.readOnlyHint).toBe(true)+ expect(byName.get('get_page_tree')?.annotations?.destructiveHint).toBe(false)+ expect(byName.get('update_node')?.annotations?.readOnlyHint).toBe(false)+ expect(byName.get('update_node')?.annotations?.destructiveHint).toBe(true)+ })+test('tools have descriptions and input schemas', async () => {const { tools } = await client.listTools()for (const tool of tools) {diff --git a/tests/engine/mcp/server/security.test.ts b/tests/engine/mcp/server/security.test.tsindex 97d5f2f2e..0544b5144 100644--- a/tests/engine/mcp/server/security.test.ts+++ b/tests/engine/mcp/server/security.test.ts@@ -78,6 +78,7 @@ describe('MCP server auto-generated auth token', () => {const healthResp = await fetch(`http://127.0.0.1:${httpPort}/health`)const health = (await healthResp.json()) as HealthResponseexpect(health.authRequired).toBe(true)+ expect(health.tools).toBeUndefined()} finally {await handle.close()}diff --git a/tests/helpers/mcp/server.ts b/tests/helpers/mcp/server.tsindex 08ce946a1..9665109e1 100644--- a/tests/helpers/mcp/server.ts+++ b/tests/helpers/mcp/server.ts@@ -9,13 +9,13 @@ import {computeAllLayouts,executeRPCCommand} from '@open-pencil/core'-import type { MCPToolCatalogEntry } from '@open-pencil/mcp/tools'+import type { ToolDescriptor } from '@open-pencil/mcp/tools'export interface HealthResponse {status: stringversion: stringauthRequired: boolean- tools: MCPToolCatalogEntry[]+ tools?: ToolDescriptor[]discoveryPath?: string}