list_app_themes
Retrieve available design themes for a Webasyst application to customize its appearance and user interface.
Instructions
Получить список тем оформления приложения
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app_id | Yes | ID приложения |
Implementation Reference
- webasyst-mcp.js:125-135 (handler)The handler function that implements the 'list_app_themes' tool. It finds the Webasyst root, checks the themes directory for the given app_id, lists subdirectories containing theme.xml, and returns a formatted text response.async function listAppThemesTool({ app_id }) { const rootPath = await findWebasystRoot(); const themesPath = path.join(rootPath, 'wa-apps', app_id, 'themes'); if (!(await fileExists(themesPath))) return { content: [{ type: 'text', text: `У приложения ${app_id} нет тем` }] }; const themes = []; for (const dir of await fs.readdir(themesPath)) { const themeXml = path.join(themesPath, dir, 'theme.xml'); if (await fileExists(themeXml)) themes.push(dir); } return { content: [{ type: 'text', text: `Темы приложения ${app_id}:\n\n${themes.map(t => `- ${t}`).join('\n')}` }] }; }
- webasyst-mcp.js:1764-1764 (registration)Registers the tool handler in the switch statement within the CallToolRequest handler.case 'list_app_themes': return await listAppThemesTool(args);
- webasyst-mcp.js:1702-1702 (schema)Defines the tool name, description, and input schema (requires 'app_id' as string) in the ListToolsRequest response.{ name: 'list_app_themes', description: 'Получить список тем оформления приложения', inputSchema: { type: 'object', properties: { app_id: { type: 'string', description: 'ID приложения' } }, required: ['app_id'] } },
- webasyst-mcp.js:22-28 (helper)Helper function used by the handler to check if theme.xml exists in theme directories.async function fileExists(p) { try { await fs.access(p); return true; } catch { return false; }
- webasyst-mcp.js:31-45 (helper)Helper function used by the handler to locate the Webasyst root directory.async function findWebasystRoot(startCwd = process.cwd()) { let currentDir = startCwd; while (currentDir !== '/') { const indexPath = path.join(currentDir, 'index.php'); const systemPath = path.join(currentDir, 'wa-system'); try { await fs.access(indexPath); await fs.access(systemPath); return currentDir; } catch { currentDir = path.dirname(currentDir); } } throw new Error('Корневая директория Webasyst не найдена'); }