Skip to main content
Glama

list_webasyst_apps

Retrieve all Webasyst applications for framework management. Optionally include system apps to view complete project structure.

Instructions

Получить список всех приложений Webasyst

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
include_systemNoВключить системные приложения

Implementation Reference

  • The main execution logic for the 'list_webasyst_apps' tool. Locates Webasyst root, iterates over wa-apps directories, parses lib/config/app.php configs using helpers, filters system app, and returns a formatted text list of apps with names and versions.
    async function listWebasystAppsTool({ include_system = false } = {}) { const rootPath = await findWebasystRoot(); const appsPath = path.join(rootPath, 'wa-apps'); const result = []; for (const appDir of await fs.readdir(appsPath)) { const configPath = path.join(appsPath, appDir, 'lib', 'config', 'app.php'); if (!(await fileExists(configPath))) continue; const appInfo = await readPHPConfigArray(configPath).catch(() => ({})); if (appDir === 'webasyst' && !include_system) continue; result.push({ id: appDir, name: appInfo.name || appDir, version: appInfo.version || '0.0.1' }); } return { content: [{ type: 'text', text: `Найдено приложений: ${result.length}\n\n${result.map(a => `- ${a.name} (${a.id}) - v${a.version}`).join('\n')}` }] }; }
  • Input schema for the tool, defining an optional boolean parameter 'include_system' to include system apps like 'webasyst'.
    { name: 'list_webasyst_apps', description: 'Получить список всех приложений Webasyst', inputSchema: { type: 'object', properties: { include_system: { type: 'boolean', default: false, description: 'Включить системные приложения' } } } },
  • Tool handler registration in the CallToolRequestSchema switch statement, mapping the tool name to the listWebasystAppsTool function.
    case 'list_webasyst_apps': return await listWebasystAppsTool(args);
  • Helper function used by the tool to locate the Webasyst installation root by walking up directories until finding index.php and wa-system.
    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 не найдена'); }
  • Helper function to parse PHP config arrays from app.php files, extracting string, boolean, and numeric key-value pairs.
    async function readPHPConfigArray(phpFilePath) { const content = await fs.readFile(phpFilePath, 'utf-8'); const match = content.match(/return\s+(array\s*\([\s\S]*?\)|\[[\s\S]*?\]);/); if (!match) return {}; const body = match[1]; const result = {}; // Parse string values: 'key' => 'value' const stringPairs = body.matchAll(/'([^']+)'\s*=>\s*'([^']*)'/g); for (const m of stringPairs) { result[m[1]] = m[2]; } // Parse boolean values: 'key' => true/false const boolPairs = body.matchAll(/'([^']+)'\s*=>\s*(true|false)/gi); for (const m of boolPairs) { result[m[1]] = m[2].toLowerCase() === 'true'; } // Parse numeric values: 'key' => 123 const numPairs = body.matchAll(/'([^']+)'\s*=>\s*(\d+)/g); for (const m of numPairs) { result[m[1]] = parseInt(m[2], 10); } return result; }

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