Skip to main content
Glama
JackXuyi

Current operating environment

getAppSchemas

Retrieve registered app schema information from your current operating environment to understand available application capabilities and integration points.

Instructions

获取当前设备所有注册唤醒的 App Schema 信息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the getAppSchemas tool. It detects the platform and retrieves registered URL schemes for applications: on macOS by parsing Info.plist in .app bundles, on Linux by checking MimeType in .desktop files, on Windows by querying the registry for URL Protocols. Returns a JSON object mapping app names to their schemes.
    case "getAppSchemas": { let appSchemas: Record<string, string[]> = {}; try { if (os.platform() === 'darwin') { // macOS 使用 mdfind 命令查找所有 .app 包 const appPaths = execSync('mdfind "kMDItemContentType == com.apple.application-bundle"').toString().split('\n'); for (const appPath of appPaths) { if (appPath) { try { // 读取 Info.plist 文件 const plistPath = `${appPath}/Contents/Info.plist`; if (fs.existsSync(plistPath)) { const plistContent = fs.readFileSync(plistPath, 'utf8'); const plistData: any = plist.parse(plistContent); if (plistData.CFBundleURLTypes) { const schemes = plistData.CFBundleURLTypes .flatMap((type: any) => type.CFBundleURLSchemes || []) .filter((scheme: string) => scheme); if (schemes.length > 0) { appSchemas[plistData.CFBundleName || appPath] = schemes; } } } } catch (error) { console.warn(`无法读取 ${appPath} 的 Info.plist 文件:`, error); continue; // 跳过无法读取的 .app 包 } } } } else if (os.platform() === 'linux') { // Linux 通过检查 .desktop 文件获取 URL Scheme 信息 const desktopFiles = execSync('find /usr/share/applications /~/.local/share/applications -name "*.desktop"').toString().split('\n'); desktopFiles.forEach(file => { if (file) { const content = execSync(`cat ${file}`).toString(); const schemes = content.match(/MimeType=(.+)/)?.[1].split(';').filter(s => s.startsWith('x-scheme-handler/')).map(s => s.replace('x-scheme-handler/', '')); if (schemes && schemes.length > 0) { appSchemas[file] = schemes; } } }); } else if (os.platform() === 'win32') { // Windows 通过注册表获取 URL Scheme 信息 const regOutput = execSync('reg query HKEY_CLASSES_ROOT /f "URL Protocol" /s').toString(); const schemes = regOutput.split('\n').filter(line => line.trim().startsWith('HKEY_CLASSES_ROOT\\')).map(line => line.split('\\')[1]); schemes.forEach(scheme => { appSchemas[scheme] = [scheme]; }); } } catch (error) { console.error("获取 App Schema 信息失败:", error); } return { content: [{ type: "text", text: JSON.stringify(appSchemas, null, 2) }] }; }
  • src/index.ts:163-171 (registration)
    Registration of the getAppSchemas tool in the listTools handler, including name, description, and empty input schema.
    { name: "getAppSchemas", description: "获取当前设备所有注册唤醒的 App Schema 信息", inputSchema: { type: "object", properties: {}, required: [] } },

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