Skip to main content
Glama

list_app_themes

Retrieve available design themes for a Webasyst application to customize its appearance and user interface.

Instructions

Получить список тем оформления приложения

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
app_idYesID приложения

Implementation Reference

  • 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')}` }] }; }
  • Registers the tool handler in the switch statement within the CallToolRequest handler.
    case 'list_app_themes': return await listAppThemesTool(args);
  • 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'] } },
  • 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; }
  • 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 не найдена'); }

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