create_site_theme
Create custom themes for Webasyst sites by defining style types, color schemes, layout features, and responsive options to match specific design requirements.
Instructions
Создать тему для Site
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| theme_name | Yes | ||
| theme_title | Yes | ||
| style_type | No | ||
| color_scheme | No | ||
| layout_features | No | ||
| responsive_breakpoints | No | ||
| dark_mode | No | ||
| rtl_support | No | ||
| webasyst_path | Yes |
Implementation Reference
- webasyst-mcp.js:693-708 (handler)The core handler function that creates a new Site theme. It generates the theme directory, writes theme.xml with metadata, a basic theme.css with CSS variables, and an index.html template.async function createSiteThemeTool({ theme_name, theme_title, style_type = 'modern', color_scheme = {}, layout_features = [], responsive_breakpoints = true, dark_mode = false, rtl_support = false, webasyst_path }) { const t = path.join(webasyst_path, 'wa-apps', 'site', 'themes', theme_name); await ensureDir(t); const xml = `<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE theme PUBLIC "wa-app-theme" "http://www.webasyst.com/wa-content/xml/wa-app-theme.dtd"> <theme id="${theme_name}" system="0" vendor="custom" app="site" version="1.0.0"> <name locale="en_US">${theme_title}</name> <name locale="ru_RU">${theme_title}</name> <description locale="en_US">${theme_title} theme</description> <description locale="ru_RU">Тема ${theme_title}</description> </theme> `; await fs.writeFile(path.join(t, 'theme.xml'), xml); await fs.writeFile(path.join(t, 'theme.css'), `:root {\n --primary: ${color_scheme.primary || 'var(--accent-color)'};\n}\n`); await fs.writeFile(path.join(t, 'index.html'), `{* ${theme_title} *}\n<!DOCTYPE html>\n<html>\n<head>\n <title>{\$wa->title()}</title>\n <link rel="stylesheet" href="{\$wa_theme_url}theme.css">\n</head>\n<body>\n <div class="site-theme">${theme_title}</div>\n</body>\n</html>\n`); return { content: [{ type: 'text', text: `Тема "${theme_title}" создана: ${t}` }] };
- webasyst-mcp.js:1782-1782 (registration)Registration of the 'create_site_theme' tool in the MCP server's request handler switch statement, mapping the tool name to its handler function.case 'create_site_theme': return await createSiteThemeTool(args);
- webasyst-mcp.js:1720-1721 (schema)Tool schema definition including input parameters for theme creation (name, title, styling options, path) as listed in the server's tool list response.{ name: 'create_site_theme', description: 'Создать тему для Site', inputSchema: { type: 'object', properties: { theme_name: { type: 'string' }, theme_title: { type: 'string' }, style_type: { type: 'string' }, color_scheme: { type: 'object' }, layout_features: { type: 'array', items: { type: 'string' } }, responsive_breakpoints: { type: 'boolean' }, dark_mode: { type: 'boolean' }, rtl_support: { type: 'boolean' }, webasyst_path: { type: 'string' } }, required: ['theme_name', 'theme_title', 'webasyst_path'] } },