create_spec
Define or update design system specifications for components, pages, or data visualizations with JSON validation before saving to the local registry.
Instructions
Create or overwrite a spec in the local registry. Validates against Zod schemas before saving.
Prerequisites: None. The spec body must be valid JSON. If a spec with the same name already exists, it is silently overwritten.
Returns on success: Plain confirmation string Spec "<name>" saved (<type>).
Error behavior: Returns isError with Zod validation error details if the spec body doesn't match the schema. Returns isError for JSON parse failures or unknown type values.
Spec type schemas:
"component": Must include name, type="component", atomicLevel ("atom"|"molecule"|"organism"|"template"), purpose, props[], variants[], composesSpecs[], codeConnect{}. Atoms must have composesSpecs=[].
"page": Must include name, type="page", purpose, sections[].
"dataviz": Must include name, type="dataviz", chartType, dataShape.
Use this tool: to define a new component before calling generate_code, or to update an existing spec's props or variants. Always call get_specs first to avoid accidentally overwriting an existing spec.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| spec | Yes | JSON string of the full spec object. Must include a 'type' field ('component', 'page', or 'dataviz') and all required fields for that spec type. Zod validation errors are returned as structured error messages if the shape is invalid. |