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: []
      }
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It states the action ('获取') but doesn't disclose behavioral traits like whether it's read-only (implied by 'get'), requires permissions, has rate limits, returns structured data, or handles errors. For a tool with zero annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence in Chinese that directly states the tool's function without unnecessary words. It's front-loaded with the core action and resource, making it easy to parse. Every part earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 0 parameters, no annotations, and no output schema, the description is minimally adequate. It specifies the resource (App Schema info for wake-up apps) but lacks details on return format, error handling, or system dependencies. For a read operation in a system info context, it meets basic needs but could be more informative.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, focusing on the tool's purpose. Baseline is 4 for zero-parameter tools when the schema is complete.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb '获取' (get/retrieve) and the resource 'App Schema 信息' (App Schema information), specifying it's for '当前设备所有注册唤醒的' (all registered wake-up apps on the current device). This distinguishes it from siblings like getInstalledApps by focusing on schema/wake-up registration rather than general installation. However, it doesn't explicitly contrast with siblings beyond the resource specificity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, context (e.g., system diagnostics vs. app management), or exclusions (e.g., not for unregistered apps). With many sibling tools for system info, this lack of differentiation leaves usage unclear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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