* feat: name the call and list every problem in validation errors Tool arguments were checked with v.parse, whose error names only the first problem and neither the tool nor the argument, so a model that sent a wrong create_shape call read 'Expected string but received 42'. Tool arguments in Core, which AI chat, MCP, the CLI, and WebMCP all reach, the automation bridge's file commands, design JSX component properties, and gradient stops now throw a heading that names the call followed by v.summarize, which lists each issue with its path. parseToolArgs is exported for the app's own parses of tool arguments. * test(design-jsx): pass a deliberately wrong property value through the types The test checks what a script sees for a non-string instance property, which the Instance types reject at compile time. * docs: say that MCP clients get the MCP SDK's validation report The MCP SDK validates tool arguments against the registered schema before OpenPencil's handler runs, so an MCP client already received every problem with its path and does not see parseToolArgs' message. |
||
|---|---|---|
| .. | ||
| scripts | ||
| src | ||
| tests | ||
| AGENTS.md | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
| tsdown.config.ts | ||
@open-pencil/design-jsx
OpenPencil design JSX: build editable scene trees with <Frame>, <Text>, and the other elements, style them with paint and effect helpers and design variables, and export scene nodes back to JSX.
Set the JSX import source in tsconfig.json ("jsx": "react-jsx", "jsxImportSource": "@open-pencil/design-jsx") or per file:
/** @jsxImportSource @open-pencil/design-jsx */
import { renderTree } from '@open-pencil/core/design-jsx'
import { Frame, Text, solid } from '@open-pencil/design-jsx'
import { SceneGraph } from '@open-pencil/scene-graph'
const graph = new SceneGraph()
await renderTree(
graph,
<Frame w={320} p={16} fill={solid('#FFFFFF')}>
<Text>Hello</Text>
</Frame>
)
JSX written as a string, as agents and the MCP render tool send it, needs no build step:
import { renderJSX } from '@open-pencil/core/design-jsx'
await renderJSX(graph, '<Frame w={320} p={16} bg="#FFFFFF"><Text>Hello</Text></Frame>')
This package depends only on @open-pencil/scene-graph and @open-pencil/emit. Rendering needs icons, SVG conversion, and layout, which @open-pencil/core/design-jsx provides; other engines can supply their own through createDesignJSXRenderer(services).