list_templates
List pre-built database schema templates for common app patterns, such as ecommerce, blog, SaaS, and social media, to generate realistic test data with proper relationships.
Instructions
List pre-built schema templates for common application patterns.
Available templates:
ecommerce: Customers, products, orders, order items, reviews (5 tables)
blog: Authors, posts, comments, tags, post_tags (5 tables)
saas: Organizations, members, subscriptions, invoices (4 tables)
social: Users, posts, likes, follows, messages (5 tables)
Each template includes realistic field types, proper foreign key relationships, weighted enum distributions, and auto-locale detection via country fields.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- packages/mcp/src/tools.ts:296-298 (handler)The MCP handler function for the 'list_templates' tool. Calls listTemplates() from @engine and wraps result in ok().
function handleListTemplates(): ToolResult { return ok(listTemplates()); } - src/lib/engine/templates/index.ts:25-35 (handler)Core implementation: iterates TEMPLATE_REGISTRY and returns a lightweight array of TemplateSummary objects (id, name, description, tables, default_counts), omitting the full schema.
export function listTemplates(): TemplateSummary[] { return Object.values(TEMPLATE_REGISTRY).map( ({ id, name, description, tables, default_counts }) => ({ id, name, description, tables, default_counts, }), ); } - packages/mcp-server/src/index.ts:291-328 (handler)Alternative MCP server registration for 'list_templates' that calls GET /api/v1/templates via an API call rather than using the engine directly.
server.tool( "list_templates", `List pre-built schema templates for common application patterns. Available templates: - ecommerce: Customers, products, orders, order items, reviews (5 tables) - blog: Authors, posts, comments, tags, post_tags (5 tables) - saas: Organizations, members, subscriptions, invoices (4 tables) - social: Users, posts, likes, follows, messages (5 tables) Each template includes realistic field types, proper foreign key relationships, weighted enum distributions, and auto-locale detection via country fields.`, {}, async () => { const res = await apiCall("GET", "/api/v1/templates"); if (!res.ok) { return { content: [ { type: "text" as const, text: `API error (${res.status}): ${JSON.stringify(res.data, null, 2)}`, }, ], isError: true, }; } return { content: [ { type: "text" as const, text: JSON.stringify(res.data, null, 2), }, ], }; } ); - The TemplateSummary interface defining the shape of objects returned by listTemplates() — id, name, description, tables, default_counts.
export interface TemplateSummary { id: string; name: string; description: string; tables: string[]; default_counts: Record<string, number>; - packages/mcp/src/tools.ts:143-186 (registration)Tool definition registration in the MCP tool definitions array — declares name 'list_templates', description, and empty inputSchema.
{ name: "list_templates", description: "List pre-built schema templates for common database patterns: e-commerce, blog, SaaS, and social network.", inputSchema: { type: "object", properties: {}, }, }, { name: "generate_from_template", description: "Generate test data using a pre-built template. Available templates: ecommerce, blog, saas, social. Use 'scale' to multiply record counts.", inputSchema: { type: "object", properties: { template: { type: "string", description: "Template ID: ecommerce, blog, saas, or social", }, locale: { type: "string", description: "Locale for generated data. Default: en", }, scale: { type: "number", description: "Multiplier for all table record counts. E.g. scale=10 generates 10x the default rows.", }, format: { type: "string", enum: ["json", "csv", "sql"], description: "Output format. Default: json", }, seed: { type: "number", description: "PRNG seed for reproducible output.", }, }, required: ["template"], }, }, ];