Skip to main content
Glama

Current operating environment

getInstalledApps

Retrieve a list of installed applications on the current device to assess the operating environment and manage application configurations.

Instructions

获取当前设备已安装的应用信息

Input Schema

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

{ "properties": {}, "required": [], "type": "object" }

Implementation Reference

  • The switch case that implements the getInstalledApps tool logic. It uses platform-specific commands to fetch lists of installed applications and returns them as JSON.
    case "getInstalledApps": { let installedApps: string[] = []; try { if (os.platform() === 'darwin') { // macOS 使用 system_profiler 命令获取已安装的应用 const apps = execSync('system_profiler SPApplicationsDataType -json').toString(); installedApps = JSON.parse(apps).SPApplicationsDataType.map((app: any) => app._name); } else if (os.platform() === 'linux') { // Linux 使用 dpkg 或 rpm 命令获取已安装的软件包 try { installedApps = execSync('dpkg --list | grep ^ii').toString().split('\n').map(line => line.split(/\s+/)[1]); } catch (error) { installedApps = execSync('rpm -qa').toString().split('\n'); } } else if (os.platform() === 'win32') { // Windows 使用 Get-WmiObject 命令获取已安装的应用 const apps = execSync('powershell -Command "Get-WmiObject -Class Win32_Product | Select-Object -Property Name"').toString(); installedApps = apps.split('\n').filter(line => line.trim()).slice(1); } } catch (error) { console.error("获取已安装应用信息失败:", error); } return { content: [{ type: "text", text: JSON.stringify({ installedApps }, null, 2) }] };
  • The tool schema definition including name, description, and empty input schema, provided in the list of tools for registration.
    { name: "getInstalledApps", description: "获取当前设备已安装的应用信息", inputSchema: { type: "object", properties: {}, required: [] } },
  • src/index.ts:787-787 (registration)
    Registration of the ListToolsRequestSchema handler which returns the list of tools including getInstalledApps.
    server.setRequestHandler(ListToolsRequestSchema, handleRequest);
  • src/index.ts:790-790 (registration)
    Registration of the CallToolRequestSchema handler which dispatches to the getInstalledApps case.
    server.setRequestHandler(CallToolRequestSchema, handleCallToolRequest);

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/JackXuyi/env-mcp'

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