create_theme
Create a new visual theme for Webasyst applications by specifying app ID, theme ID, name, and optional prototype to customize appearance.
Instructions
Создать тему оформления для приложения
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app_id | Yes | ID приложения | |
| theme_id | Yes | ID темы | |
| theme_name | Yes | Название темы | |
| prototype | No | Прототип темы | default |
Implementation Reference
- webasyst-mcp.js:541-574 (handler)Main handler function that creates a new app theme: directories, theme.xml descriptor, basic index.html template, and cover.png placeholder.async function createThemeTool({ app_id, theme_id, theme_name, prototype = 'default' }) { const rootPath = await findWebasystRoot(); const themesPath = path.join(rootPath, 'wa-apps', app_id, 'themes', theme_id); if (await fileExists(themesPath)) throw new Error(`Тема ${theme_id} уже существует`); await ensureDir(themesPath); // Create theme.xml const themeXml = `<?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_id}" system="0" vendor="custom" app="${app_id}" version="1.0.0"> <name locale="en_US">${theme_name}</name> <name locale="ru_RU">${theme_name}</name> <description locale="en_US">Custom theme</description> <description locale="ru_RU">Пользовательская тема</description> <files> <file path="index.html"> <description locale="en_US">Main template</description> <description locale="ru_RU">Основной шаблон</description> </file> </files> </theme> `; await fs.writeFile(path.join(themesPath, 'theme.xml'), themeXml); // Create basic index.html await fs.writeFile(path.join(themesPath, 'index.html'), `{* ${theme_name} *}\n<!DOCTYPE html>\n<html>\n<head>\n <title>{\$wa->title()}</title>\n <link rel="stylesheet" href="{\$wa_url}wa-content/css/wa/wa-2.0.css">\n</head>\n<body>\n <div class="block double-padded">\n {$content}\n </div>\n</body>\n</html>\n`); // Create cover.png placeholder await fs.writeFile(path.join(themesPath, 'cover.png'), ''); return { content: [{ type: 'text', text: `Тема ${theme_name} (${theme_id}) создана для приложения ${app_id}:\n${themesPath}` }] }; }
- webasyst-mcp.js:1714-1715 (schema)Tool schema definition including input parameters: app_id (required), theme_id (required), theme_name (required), prototype (optional, default 'default').{ name: 'create_theme', description: 'Создать тему оформления для приложения', inputSchema: { type: 'object', properties: { app_id: { type: 'string', description: 'ID приложения' }, theme_id: { type: 'string', description: 'ID темы' }, theme_name: { type: 'string', description: 'Название темы' }, prototype: { type: 'string', default: 'default', description: 'Прототип темы' } }, required: ['app_id', 'theme_id', 'theme_name'] } },
- webasyst-mcp.js:1776-1776 (registration)Registration of the 'create_theme' tool handler in the main switch statement for CallToolRequestSchema.case 'create_theme': return await createThemeTool(args);