Skip to main content
Glama

create_spec

Create or overwrite a component, page, or dataviz spec in the local registry. Validates JSON schemas before saving, enabling code generation from the spec.

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

TableJSON Schema
NameRequiredDescriptionDefault
specYesJSON 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.
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description fully discloses behavioral traits: silent overwrite if same name exists, error behavior for Zod validation failures, JSON parse errors, and unknown type values. Provides complete error handling details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with sections for prerequisites, returns, error behavior, spec type schemas, and usage guidance. Every sentence adds value, and the main purpose is front-loaded with no wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (multiple spec types with validation), the description covers prerequisites, success/error returns, and schema details. The lack of an output schema is compensated by explaining the return format. Complete for an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Although schema coverage is 100%, the description adds significant meaning beyond the schema by detailing the required fields for each spec type (component, page, dataviz), including nested structures and constraints like atoms must have composesSpecs=[].

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Create or overwrite' and the resource 'a spec in the local registry', distinguishing it from read-only sibling tools like get_spec. It also specifies validation against Zod schemas.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit guidance: 'Use this tool: to define a new component before calling generate_code, or to update an existing spec... Always call get_specs first to avoid accidentally overwriting.' This clearly states when to use and a critical prerequisite.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sarveshsea/memi'

If you have feedback or need assistance with the MCP directory API, please join our Discord server