Skip to main content
Glama

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
NameRequiredDescriptionDefault
app_idYesID приложения
theme_idYesID темы
theme_nameYesНазвание темы
prototypeNoПрототип темыdefault

Implementation Reference

  • 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}` }] }; }
  • 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'] } },
  • Registration of the 'create_theme' tool handler in the main switch statement for CallToolRequestSchema.
    case 'create_theme': return await createThemeTool(args);

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/emmy-design/webasyst-mcp'

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